Gmake errors but only on certain Windows machines - gnu-make

I get the following error when I run my makefile in windows using gmake.
It happens on only 1 PC of 5 in the group - the other 4 run perfectly, and the file that's "not found" is definitely in the file system - I can run an assemble from the command line with the same path and it works fine.
C:\Eclipse\tools\gmake\gmake.exe BUILD_TYPE=RAM all
07:43:14 **** Build of configuration Debug for project U500 ****
"C:\\Eclipse\\tools\\gmake\\gmake.exe" BUILD_TYPE=RAM all
mkdir -p "object_flash"
mkdir -p "object"
mkdir -p "../TSP for iNav/Builds/iNav RAM/output"
mkdir -p "../TSP for iNav/Builds/Flash Release/output"
AS object/CpuCore.o
here is the curdir C:/work/Insulet/PhoenixII/robert_test_workspace/U500/Debug
C:/Eclipse/tools/codesourcery_arm_3.4.2/bin/arm-none-eabi-as -o object/CpuCore.o -gdwarf2 -meabi=4 -I"../../source/CPU" ../../source/CPU/CpuCore.s
Assembler messages:
**Can't open ../../source/CPU/CpuCore.s
for reading: Invalid argument**
The makefile is (look for #### for the rule causing an issue)
====
ifeq ($(BUILD_TYPE),RAM)
BUILDDIR = ../TSP for iNav/Builds/iNav RAM
MAPFILE = iNav_RAM.map
LDFILE = iNav_RAM.ld
IMGNAME = iNav_RAM.elf
DEBUGFLAGS = -DDEBUG_DEVELOPMENT_MODE
OBJDIR = ./object
DRIVERDIR =objects/ ``
#UT_OBJECTS = UnitTest.o
else
ifeq ($(BUILD_TYPE),FLASH)
BUILDDIR = ../TSP for iNav/Builds/FLASH Release
MAPFILE = FLASH_Release.map
LDFILE = FLASH_Release.ld
IMGNAME = FLASH_Release.elf
#POSTPROCESSING = sh -c 'pushd ../TSP\ for\ iNav/Batch\ Files/;\
cmd.exe /c "ProcessFlashReleaseImage.bat";\
popd'
#POSTPROCESSING = sh -c '$(OBJCOPY) -R .lcdmem -O binary -S $(IMG) $(APP_FLASH_IMG)'
#
# copy /b $(APP_FLASH_IMG) + $(UPGRADER_IMG) $(COMBINED_FLASH_IMG);\
# ../TSP\ for\ iNav/Build\ Tools/ProcessImage_iNavMainApp $(COMBINED_FLASH_IMG)'
APP_FLASH_IMG = "$(BUILDDIR)/Output/Pre_FLASH_Release.bin"
UPGRADER_IMG = "../TSP for iNav/UpgraderBin/Upgrader.bin"
COMBINED_FLASH_IMG = "$(BUILDDIR)/Output/FLASH_Release.bin"
OBJDIR = ./object_flash
OBJDIR1 = .\objects
#DEBUGFLAGS = -D__CSURF__
else
#This is to build the boot ROM
ifeq ($(BUILD_TYPE),FLASH_BOOT)
#### mods for boot flash needed
BUILDDIR = ../TSP for iNav/Builds/iNav Flash Boot
MAPFILE = BOOT_FLASH_Release.map
LDFILE = BOOT_FLASH_Release.ld
IMGNAME = BOOT_FLASH_Release.elf
#POSTPROCESSING = sh -c 'pushd ../TSP\ for\ iNav/Batch\ Files/;\
cmd.exe /c "ProcessFlashReleaseImage.bat";\
popd'
#POSTPROCESSING = sh -c '$(OBJCOPY) -R .lcdmem -O binary -S $(IMG) $(APP_FLASH_IMG)'
#
# copy /b $(APP_FLASH_IMG) + $(UPGRADER_IMG) $(COMBINED_FLASH_IMG);\
# ../TSP\ for\ iNav/Build\ Tools/ProcessImage_iNavMainApp $(COMBINED_FLASH_IMG)'
APP_FLASH_IMG = "$(BUILDDIR)/Output/Pre_FLASH_Release.bin"
UPGRADER_IMG = "../TSP for iNav/UpgraderBin/Upgrader.bin"
COMBINED_FLASH_IMG = "$(BUILDDIR)/Output/FLASH_Release.bin"
OBJDIR = ./object_flash
OBJDIR1 = .\objects
else
error:
#echo 'invalid build type: $(BUILD_TYPE)'
endif
endif
endif
IMG = "$(BUILDDIR)/Output/$(IMGNAME)"
#export C_COLON = /c
export C_COLON = /cygdrive/c
#export TOOL_LOCATION = $(C_COLON)/mgc/embedded/tools/codesourcery_arm_3.4.2/bin
export TOOL_LOCATION = C:/Eclipse/tools/codesourcery_arm_3.4.2/bin
export CC = $(TOOL_LOCATION)/arm-none-eabi-gcc
export AS = $(TOOL_LOCATION)/arm-none-eabi-as
export LD = $(TOOL_LOCATION)/arm-none-eabi-ld
export AR = $(TOOL_LOCATION)/arm-none-eabi-ar
export OBJCOPY = $(TOOL_LOCATION)/arm-none-eabi-objcopy
export RM = rm -f
export CP = cp
INCLUDDIRS = -I"../../source" -I"../../source/Drivers" -I"../../source/CPU" -I"../../source/smx/XFD" -I"../../source/smx/XFS" -I"../../source/smx/xusbd" -I"../../source/smx/xusbd/Core" -I"../../source/smx/xusbd/DCD" -I"../../source/smx/xusbd/Function" -I"."
CFLAGS = $(DEBUGFLAGS) -gdwarf-2 -mcpu=arm9 -fno-short-enums -fno-zero-initialized-in-bss -fsigned-char $(INCLUDDIRS) -Wall -Wno-missing-braces $(EXTRA_CFLAGS)
LDLIBS = --start-group "./TSP_for_iNav/CSL-ARM-GNU-Debug/Output/TSP_for_iNav.lib" "../TSP for iNav/GNU Libraries/libgcc.a" "../TSP for iNav/GNU Libraries/libc.a" --end-group
MAP = "$(BUILDDIR)/Output/$(MAPFILE)"
LINKSCRIPT = "./TSP_for_iNav/src/csgnu_arm/$(LDFILE)"
LDFLAGS = -Map $(MAP) -T$(LINKSCRIPT)
_APP_OBJECTS = alarm.o SdDiag.o alarm_repair.o beep.o cgmLog.o comm.o cond_state.o confirm.o confirm_calc.o confirm_pump.o conversion.o critical.o cursor_list.o diag.o display.o eeprom.o entry.o entry_bg.o font.o fooddb.o graph.o h_main.o handlers.o history.o history_page.o icons.o language.o language_Compiler_verify.o lcd.o list.o log.o logs.o mainloop.o menu.o pending.o prog_view.o pump.o pump_alert.o pump_cmd.o pumpmfg.o pumpverify.o queue.o ram.o rtc.o sched.o screen.o serial.o state.o state_alert.o state_bg_setup.o state_bgmeter.o state_bkgd_ck.o state_cgm.o state_comm.o state_fooddb.o state_presets.o state_sw.o suggbol.o suggbol_hist.o swtimer.o usb.o view.o view_bg.o
#APP_OBJECTS = $(patsubst %,$(OBJDIR)/%,$(_APP_OBJECTS))
APP_OBJECTS = $(addprefix $(OBJDIR)/,$(_APP_OBJECTS))
_DRIVER_OBJECTS = BGBoard.o BGMeter.o Flash.o init_lcd.o Interrupt.o MX21Config.o MX21_RTC.o MicroManager.o crc16-123.o eNavCGM.o gpio.o h_diag.o h_eeprom.o h_icons.o h_lcd.o h_rtc.o h_sys.o h_usb.o h_usbevt.o h_usbints.o h_usbos.o h_usbotg.o h_usbphy.o h_usbregs.o h_usbtrace.o hwTimer.o i2c.o key.o pwm.o rf.o secui.o spi.o super.o trans.o uart.o wdog.o
DRIVER_OBJECTS =$(addprefix $(OBJDIR)/,$(_DRIVER_OBJECTS))
_CPU_OBJECTS = AITC.o RunTimeInit.o
CPU_OBJECTS =$(addprefix $(OBJDIR)/,$(_CPU_OBJECTS))
_USB_OBJECTS = norfd.o norio_insulet.o fapi.o fcache.o fdnor.o fdram.o fdwin.o ffind.o fmount.o fpath.o fport.o funicode.o udhdw.o udinit.o uddcd.o uddevice.o udep0.o udfunc.o udutil.o udmx21.o udcompos.o udftempl.o udmouse.o udmstor.o udserial.o
USB_OBJECTS =$(addprefix $(OBJDIR)/,$(_USB_OBJECTS))
_ASM_OBJECTS = CpuCore.o CpuException.o
ASM_OBJECTS =$(addprefix $(OBJDIR)/,$(_ASM_OBJECTS))
OBJECTS = $(APP_OBJECTS) $(DRIVER_OBJECTS) $(CPU_OBJECTS) $(USB_OBJECTS) $(ASM_OBJECTS)
ARCHIVES = app.a Drivers.a CPU.a smx.a
.PHONY: all clean img TSP_lib
all: img
-include $(OBJECTS:.o=.d)
img: $(ASM_OBJECTS) $(ARCHIVES) TSP_lib
#echo LD $#
$(LD) -o $(IMG) $(ASM_OBJECTS) $(ARCHIVES) $(LDLIBS) $(LDFLAGS)
# $(POSTPROCESSING)
# #../TSP\ for\ iNav/Batch\ Files/ProcessFlashReleaseImage.bat
TSP_lib:
$(MAKE) -C "./TSP_for_iNav"
app.a: $(APP_OBJECTS)
#echo AR $#
$(AR) rc $# $(APP_OBJECTS)
Drivers.a: $(DRIVER_OBJECTS)
#echo AR $#
$(AR) rc $# $(DRIVER_OBJECTS)
CPU.a: $(CPU_OBJECTS)
#echo AR $#
$(AR) rc $# $(CPU_OBJECTS)
smx.a: $(USB_OBJECTS)
#echo AR $#
$(AR) rc $# $(USB_OBJECTS)
########### rule causing problems ###########
$(OBJDIR)/CpuCore.o: ../../source/CPU/CpuCore.s
-mkdir -p "object_flash"
-mkdir -p "object"
-mkdir -p "../TSP for iNav/Builds/iNav RAM/output"
-mkdir -p "../TSP for iNav/Builds/Flash Release/output"
#echo AS $#
#echo here is the curdir ${CURDIR}
$(AS) -o $# -gdwarf2 -meabi=4 -I"../../source/CPU" $<
$(OBJDIR)/CpuException.o: ../../source/CPU/CpuException.s
#echo AS $#
$(AS) -o $# -gdwarf2 -meabi=4 -I"../../source/CPU" $<
lcd.o: lcd.c
#echo CC $#
$(CC) $(CFLAGS) -O3 -c -o $# $<
#$(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/drivers/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/drivers/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/CPU/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/XFD/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/XFS/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/xusbd/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/xusbd/core/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/xusbd/DCD/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
$(OBJDIR)/%.o: ../../source/SMX/xusbd/Function/%.c
#echo CC $#
$(CC) $(CFLAGS) -c -o $# $<
# $(CC) -MM -MT '$(#:.o=.d) $#' $(CFLAGS) $< > $(<:.c=.d)
clean:
#echo CLEAN
rm -f $(OBJECTS)
rm -f ../../TSP\ for\ iNav/Builds/Flash\ Release/output/BOOT_FLASH_Release.elf
rm -f ../../TSP\ for\ iNav/Builds/Flash\ Release/output/BOOT_FLASH_Release.map
rm -f ../../TSP\ for\ iNav/Builds/Flash\ Release/output/FLASH_Release.elf
rm -f ../../TSP\ for\ iNav/Builds/Flash\ Release/output/FLASH_Release.map
rm -f ../../TSP\ for\ iNav/Builds/iNAV\ RAM/output/iNAV_RAM.map
rm -f ../../TSP\ for\ iNav/Builds/iNAV\ RAM/output/iNAV_RAM.elf
# del $(OBJECTS) $(OBJECTS:.o=.d) $(ARCHIVES) $(IMG)
# $(MAKE) clean -C "../../TSP for iNav"
cleanobj:
#echo CLEANOBJ
$(RM) $(OBJECTS)

Turns out there was something fishy on the guys path, so all is well now.

Related

gsub for loop x rows at a time

I am not sure if this has been asked before and feel free to edit the title of this question if it can be phrased better. I have a list of files that need to be moved. They are stored on a server and are quite large so they take a bit of time to move. I can only really move 10 files at a time but I can submit multiple jobs. So what I want to do is use gsub and a for loop to edit a script with the first 10 files then a new script with the next 10 files to move and then a new script with the next 10 files to move and so on. Here is an example of the files I want to move. The list has 26 files... I know I mentioned I wanted to move in groups of 10 but I am curious what would happen if there were 6 samples instead of 10. The output files can be named whatever, that doesn't really matter. They obviously need to be unique. I will also attach the for loop that I tried to run but what I struggled with was looping through the list and also making a unique name
mcli <- structure(list(`mcli[c(1:25), ]` = structure(1:26, .Label = c("mcli mv --recursive /path/to/directory/D00063/alignment/ /path/to/directory/D00063/new.folder/alignment/",
"mcli mv --recursive /path/to/directory/D00063/bam/ /path/to/directory/D00063/new.folder/bam/",
"mcli mv --recursive /path/to/directory/D00063/fastqc/ /path/to/directory/D00063/new.folder/fastqc/",
"mcli mv --recursive /path/to/directory/D00063/gvcf/ /path/to/directory/D00063/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00063/trim/ /path/to/directory/D00063/new.folder/trim/",
"mcli mv --recursive /path/to/directory/D00064/alignment/ /path/to/directory/D00064/new.folder/alignment/",
"mcli mv --recursive /path/to/directory/D00064/bam/ /path/to/directory/D00064/new.folder/bam/",
"mcli mv --recursive /path/to/directory/D00064/fastqc/ /path/to/directory/D00064/new.folder/fastqc/",
"mcli mv --recursive /path/to/directory/D00064/gvcf/ /path/to/directory/D00064/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00064/trim/ /path/to/directory/D00064/new.folder/trim/",
"mcli mv --recursive /path/to/directory/D00105/gvcf/ /path/to/directory/D00105/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00151/gvcf/ /path/to/directory/D00151/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00188/gvcf/ /path/to/directory/D00188/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D002053/D02053/ /path/to/directory/D002053/new.folder/D02053/",
"mcli mv --recursive /path/to/directory/D00220/gvcf/ /path/to/directory/D00220/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00257/gvcf/ /path/to/directory/D00257/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00258/gvcf/ /path/to/directory/D00258/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00264/gvcf/ /path/to/directory/D00264/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00268/alignment/ /path/to/directory/D00268/new.folder/alignment/",
"mcli mv --recursive /path/to/directory/D00268/bam/ /path/to/directory/D00268/new.folder/bam/",
"mcli mv --recursive /path/to/directory/D00268/fastqc/ /path/to/directory/D00268/new.folder/fastqc/",
"mcli mv --recursive /path/to/directory/D00268/gvcf/ /path/to/directory/D00268/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00268/logs/ /path/to/directory/D00268/new.folder/logs/",
"mcli mv --recursive /path/to/directory/D00268/trim/ /path/to/directory/D00268/new.folder/trim/",
"mcli mv --recursive /path/to/directory/D00269/gvcf/ /path/to/directory/D00269/new.folder/gvcf/",
"mcli mv --recursive /path/to/directory/D00270/gvcf/ /path/to/directory/D00270/new.folder/gvcf/"), class = "factor")), .Names = "mcli[c(1:25), ]", row.names = c(NA,
-25L), class = "data.frame")
Here is an example of the script I want to edit
slurm <- structure(list(V1 = c("#!/bin/bash -l", "#SBATCH --nodes=1",
"#SBATCH --ntasks-per-node=10 ", "#SBATCH --mem-per-cpu=5gb",
"#SBATCH -t 20:00:00", "#SBATCH --mail-type=ALL",
"#SBATCH --mail-user=email ", "#SBATCH -o %j.out",
"#SBATCH -e %j.err", "", "", "cd $SLURM_SUBMIT_DIR",
"", "srun --exclusive --ntasks 1 abc123 &", "srun --exclusive --ntasks 1 def456 &",
"srun --exclusive --ntasks 1 ghi789 &", "srun --exclusive --ntasks 1 jkl101112 &",
"srun --exclusive --ntasks 1 mno131415 &", "srun --exclusive --ntasks 1 pqr161718 &",
"srun --exclusive --ntasks 1 stu192021 &", "srun --exclusive --ntasks 1 vwx222324 &",
"srun --exclusive --ntasks 1 yza252627 &", "srun --exclusive --ntasks 1 abc282930 &",
"", "wait")), row.names = c(NA,
-25L), class = c("data.table", "data.frame"))
example code that doesn't work
for(i in 1:length(mcli[[1]])){
df2 <- as.data.frame(slurm)
df2[,'V1'] <- gsub("abc123", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("def456", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("ghi789", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("jkl101112", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("mno131415", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("pqr161718", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("stu192021", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("vwx222324", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("yza252627", mcli[['V1']][i], df2[,'V1'])
df2[,'V1'] <- gsub("abc282930", mcli[['V1']][i], df2[,'V1'])
write.table(df2, paste(file = "/path/to/random/folder/",mcli[['V1']][i], ".csh", sep = ""), row.names = FALSE, col.names =FALSE, quote = FALSE)
}
expected output script1
#!/bin/bash -l
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=10
#SBATCH --mem-per-cpu=5gb
#SBATCH -t 20:00:00
#SBATCH --mail-type=ALL
#SBATCH --mail-user=bgwillia#umn.edu
#SBATCH -o %j.out
#SBATCH -e %j.err
cd $SLURM_SUBMIT_DIR
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00063/alignment/ /path/to/directory/D00063/new.folder/alignment/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00063/bam/ /path/to/directory/D00063/new.folder/bam/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00063/fastqc/ /path/to/directory/D00063/new.folder/fastqc/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00063/gvcf/ /path/to/directory/D00063/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00063/trim/ /path/to/directory/D00063/new.folder/trim/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00064/alignment/ /path/to/directory/D00064/new.folder/alignment/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00064/bam/ /path/to/directory/D00064/new.folder/bam/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00064/fastqc/ /path/to/directory/D00064/new.folder/fastqc/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00064/gvcf/ /path/to/directory/D00064/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00064/trim/ /path/to/directory/D00064/new.folder/trim/ &
wait
expected output script2
#!/bin/bash -l
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=10
#SBATCH --mem-per-cpu=5gb
#SBATCH -t 20:00:00
#SBATCH --mail-type=ALL
#SBATCH --mail-user=bgwillia#umn.edu
#SBATCH -o %j.out
#SBATCH -e %j.err
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00105/gvcf/ /path/to/directory/D00105/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00151/gvcf/ /path/to/directory/D00151/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00188/gvcf/ /path/to/directory/D00188/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D002053/D02053/ /path/to/directory/D002053/new.folder/D02053/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00220/gvcf/ /path/to/directory/D00220/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00257/gvcf/ /path/to/directory/D00257/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00258/gvcf/ /path/to/directory/D00258/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00264/gvcf/ /path/to/directory/D00264/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/alignment/ /path/to/directory/D00268/new.folder/alignment/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/bam/ /path/to/directory/D00268/new.folder/bam/ &
wait
expected output script3
#!/bin/bash -l
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=10
#SBATCH --mem-per-cpu=5gb
#SBATCH -t 20:00:00
#SBATCH --mail-type=ALL
#SBATCH --mail-user=bgwillia#umn.edu
#SBATCH -o %j.out
#SBATCH -e %j.err
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/fastqc/ /path/to/directory/D00268/new.folder/fastqc/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/gvcf/ /path/to/directory/D00268/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/logs/ /path/to/directory/D00268/new.folder/logs/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/trim/ /path/to/directory/D00268/new.folder/trim/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00269/gvcf/ /path/to/directory/D00269/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00270/gvcf/ /path/to/directory/D00270/new.folder/gvcf/ &
wait
Instead of a frame, I'm going to operate on a vector of commands to run:
mcli <- c("mcli mv --recursive /path/to/directory/D00063/alignment/ /path/to/directory/D00063/new.folder/alignment/", "mcli mv --recursive /path/to/directory/D00063/bam/ /path/to/directory/D00063/new.folder/bam/", "mcli mv --recursive /path/to/directory/D00063/fastqc/ /path/to/directory/D00063/new.folder/fastqc/", "mcli mv --recursive /path/to/directory/D00063/gvcf/ /path/to/directory/D00063/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00063/trim/ /path/to/directory/D00063/new.folder/trim/", "mcli mv --recursive /path/to/directory/D00064/alignment/ /path/to/directory/D00064/new.folder/alignment/", "mcli mv --recursive /path/to/directory/D00064/bam/ /path/to/directory/D00064/new.folder/bam/", "mcli mv --recursive /path/to/directory/D00064/fastqc/ /path/to/directory/D00064/new.folder/fastqc/", "mcli mv --recursive /path/to/directory/D00064/gvcf/ /path/to/directory/D00064/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00064/trim/ /path/to/directory/D00064/new.folder/trim/", "mcli mv --recursive /path/to/directory/D00105/gvcf/ /path/to/directory/D00105/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00151/gvcf/ /path/to/directory/D00151/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00188/gvcf/ /path/to/directory/D00188/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D002053/D02053/ /path/to/directory/D002053/new.folder/D02053/", "mcli mv --recursive /path/to/directory/D00220/gvcf/ /path/to/directory/D00220/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00257/gvcf/ /path/to/directory/D00257/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00258/gvcf/ /path/to/directory/D00258/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00264/gvcf/ /path/to/directory/D00264/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00268/alignment/ /path/to/directory/D00268/new.folder/alignment/", "mcli mv --recursive /path/to/directory/D00268/bam/ /path/to/directory/D00268/new.folder/bam/", "mcli mv --recursive /path/to/directory/D00268/fastqc/ /path/to/directory/D00268/new.folder/fastqc/", "mcli mv --recursive /path/to/directory/D00268/gvcf/ /path/to/directory/D00268/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00268/logs/ /path/to/directory/D00268/new.folder/logs/", "mcli mv --recursive /path/to/directory/D00268/trim/ /path/to/directory/D00268/new.folder/trim/", "mcli mv --recursive /path/to/directory/D00269/gvcf/ /path/to/directory/D00269/new.folder/gvcf/", "mcli mv --recursive /path/to/directory/D00270/gvcf/ /path/to/directory/D00270/new.folder/gvcf/")
I do this for three reasons: (1) I get warnings about corrupt data frame: columns will be truncated or padded with NAs; (2) those are factors, when we really just need character (easily fixed, I know); and (3) I want this to be generalizable to any other column/vector.
I'll modify your slurm template a little, as
slurm <- list(
bef = "#!/bin/bash -l\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=10 \n#SBATCH --mem-per-cpu=5gb\n#SBATCH -t 20:00:00\n#SBATCH --mail-type=ALL\n#SBATCH --mail-user=email \n#SBATCH -o %j.out\n#SBATCH -e %j.err\n\n\ncd $SLURM_SUBMIT_DIR",
job = "srun --exclusive --ntasks 1 %s &",
aft = "\n\nwait\n"
)
From here:
scripts <- by(mcli, (seq_along(mcli)-1) %/% 10,
FUN = function(z) {
paste(slurm$bef, paste(sprintf(slurm$job, z), collapse = "\n"),
slurm$aft, sep = "\n")
})
Each of the elements of scripts is a full 10-job batch file. For instance, the last is
> cat(scripts[[3]], "\n")
#!/bin/bash -l
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=10
#SBATCH --mem-per-cpu=5gb
#SBATCH -t 20:00:00
#SBATCH --mail-type=ALL
#SBATCH --mail-user=email
#SBATCH -o %j.out
#SBATCH -e %j.err
cd $SLURM_SUBMIT_DIR
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/fastqc/ /path/to/directory/D00268/new.folder/fastqc/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/gvcf/ /path/to/directory/D00268/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/logs/ /path/to/directory/D00268/new.folder/logs/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00268/trim/ /path/to/directory/D00268/new.folder/trim/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00269/gvcf/ /path/to/directory/D00269/new.folder/gvcf/ &
srun --exclusive --ntasks 1 mcli mv --recursive /path/to/directory/D00270/gvcf/ /path/to/directory/D00270/new.folder/gvcf/ &
wait
If you need those as individual files, you can do something like:
for (i in seq_along(scripts)) {
writeLines(scripts[[i]], paste0("script", i))
}

Errors while installing R packages

While installing R packages into solaris server, we got the below error:
"/R-3.6.1/R-3.6.1/include" is present in our server, where as while installing the package, some script is executing internally and looking for "I/R-3.6.1/R-3.6.1/include", its not found.
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c api.cpp -o api.o
sh: I/R-3.6.1/R-3.6.1/include: not found
make: Fatal error: Command failed for target `Rcpp.so'
ERROR: compilation failed for package 'Rcpp'
Full install.packages() output:
installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** using staged installation
** libs
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c api.cpp -o api.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c attributes.cpp -o attributes.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c barrier.cpp -o barrier.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c date.cpp -o date.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c module.cpp -o module.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
I"/R-3.6.1/R-3.6.1/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -KPIC -c rcpp_init.cpp -o rcpp_init.o
sh: I/R-3.6.1/R-3.6.1/include: not found
*** Error code 127 (ignored)
-shared -L/usr/local/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o
sh: line 2: -shared: not found
*** Error code 127
The following command caused the error:
if test "zapi.o attributes.o barrier.o date.o module.o rcpp_init.o" != "z"; then \
echo -shared -L/usr/local/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o ; \
-shared -L/usr/local/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o ; \
fi
make: Fatal error: Command failed for target `Rcpp.so'
ERROR: compilation failed for package 'Rcpp'
* removing '/R-3.6.1/R-3.6.1/library/Rcpp'
makeconf entries as follows: (we have altered the CXX, CXX11, CXX14)
enter code here
# etc/Makeconf. Generated from Makeconf.in by configure.
#
# ${R_HOME}/etc/Makeconf
#
# R was configured using the following call
# (not including env. vars and site configuration)
# configure
## This fails if it contains spaces, or if it is quoted
include $(R_SHARE_DIR)/make/vars.mk
AR = ar
BLAS_LIBS = -L"$(R_HOME)/lib$(R_ARCH)" -lRblas
C_VISIBILITY = -fvisibility=hidden
CC = gcc -std=gnu99
CFLAGS = -g -O2 $(LTO)
CPICFLAGS = -fPIC
CPPFLAGS = -I/usr/local/include
CXX = /opt/csw/gcc4/bin
CXXCPP = /lib/cpp
CXXFLAGS = $(LTO)
CXXPICFLAGS = -KPIC
CXX98 =
CXX98FLAGS = $(LTO)
CXX98PICFLAGS =
CXX98STD =
CXX11 = /opt/csw/gcc4/bin
CXX11FLAGS = $(LTO)
CXX11PICFLAGS =
CXX11STD =
CXX14 = /opt/csw/gcc4/bin
CXX14FLAGS = $(LTO)
CXX14PICFLAGS =
CXX14STD =
CXX17 =
CXX17FLAGS = $(LTO)
CXX17PICFLAGS =
CXX17STD =
CXX_VISIBILITY =
DYLIB_EXT = .so
DYLIB_LD = $(CC)
DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
ECHO = echo
ECHO_C = \c
ECHO_N =
ECHO_T =
F_VISIBILITY = -fvisibility=hidden
## FC is the compiler used for all Fortran as from R 3.6.0
FC = gfortran
FCFLAGS = -g -O2 $(LTO)
## additional libs needed when linking with $(FC), e.g. on some Oracle compilers
FCLIBS_XTRA =
FFLAGS = -g -O2 $(LTO)
FLIBS = -lgfortran -lm -R/opt/csw/lib
FPICFLAGS = -fPIC
FOUNDATION_CPPFLAGS =
FOUNDATION_LIBS =
JAR =
JAVA = /usr/bin/java
JAVAC =
JAVAH =
## JAVA_HOME might be used in the next three.
## They are for packages 'JavaGD' and 'rJava'
JAVA_HOME = /usr/jdk/instances/jdk1.8.0/jre
JAVA_CPPFLAGS =
JAVA_LIBS =
JAVA_LD_LIBRARY_PATH =
LAPACK_LIBS = -L"$(R_HOME)/lib$(R_ARCH)" -lRlapack
LDFLAGS = -L/usr/local/lib
## we only need this is if it is external, as otherwise link to R
LIBINTL=
LIBM = -lm
LIBR0 =
LIBR1 =
LIBR =
LIBS = -lpcre -llzma -lbz2 -lz -lnsl -lsocket -lrt -lsunmath -ldl -lm -liconv -licuuc -licui18n
## needed by R CMD config
LIBnn = lib
LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool"
LTO =
## needed to build applications linking to static libR
MAIN_LD = $(CC)
MAIN_LDFLAGS = -fopenmp
MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS)
MKINSTALLDIRS = "$(R_HOME)/bin/mkinstalldirs"
OBJC =
OBJCFLAGS = $(LTO)
OBJC_LIBS =
OBJCXX =
R_ARCH =
RANLIB = ranlib
SAFE_FFLAGS = -g -O2
SED = /usr/xpg4/bin/sed
SHELL = /bin/sh
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = $(CXX)
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX98LD = $(CXX98) $(CXX98STD)
SHLIB_CXX98LDFLAGS = -shared
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = $(CXX14) $(CXX14STD)
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = $(CXX17) $(CXX17STD)
SHLIB_CXX17LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = $(CC)
SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS)
SHLIB_LIBADD =
## We want to ensure libR is picked up from $(R_HOME)/lib
## before e.g. /usr/local/lib if a version is already installed.
SHLIB_LINK = $(SHLIB_LD) $(SHLIB_LDFLAGS) $(LIBR0) $(LDFLAGS)
SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS =
SHLIB_OPENMP_FFLAGS = -fopenmp
STRIP_STATIC_LIB =
STRIP_SHARED_LIB =
TCLTK_CPPFLAGS = -I/usr/include
TCLTK_LIBS =
YACC = yacc
## Legacy settings: no longer used by R as of 3.6.0
## Setting FC often sets F77 (on Solaris make even if set)
## so must follow FC in this file.
F77 = gfortran
FCPICFLAGS = -fPIC
F77_VISIBILITY = -fvisibility=hidden
SHLIB_FCLD = $(FC)
SHLIB_FCLDFLAGS = -shared
SHLIB_OPENMP_FCFLAGS = -fopenmp
## for linking to libR.a
STATIC_LIBR = # "$(R_HOME)/lib$(R_ARCH)/libR.a" $(BLAS_LIBS) $(FLIBS) $(LIBINTL) -lreadline -lncurses $(LIBS)
## These are recorded as macros for legacy use in packages
## set on AIX, formerly for old glibc (-D__NO_MATH_INLINES)
R_XTRA_CFLAGS =
## was formerly set on HP-UX
R_XTRA_CPPFLAGS = -I"$(R_INCLUDE_DIR)" -DNDEBUG
## currently unset
R_XTRA_CXXFLAGS =
## used for gfortran in R > 3.6.0
R_XTRA_FFLAGS =
## SHLIB_CFLAGS SHLIB_CXXFLAGS SHLIB_FFLAGS are apparently currently unused
## SHLIB_CXXFLAGS is undocumented, there is no SHLIB_FCFLAGS
ALL_CFLAGS = $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(CFLAGS)
ALL_CPPFLAGS = -I"$(R_INCLUDE_DIR)" -DNDEBUG $(PKG_CPPFLAGS) $(CLINK_CPPFLAGS) $(CPPFLAGS)
ALL_CXXFLAGS = $(PKG_CXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(CXXFLAGS)
ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(OBJCFLAGS)
ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(OBJCXXFLAGS)
ALL_FFLAGS = $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FFLAGS)
## can be overridden by R CMD SHLIB
P_FCFLAGS = $(PKG_FFLAGS)
ALL_FCFLAGS = $(P_FCFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FCFLAGS)
## LIBR here as a couple of packages use this without SHLIB_LINK
ALL_LIBS = $(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR)# $(LIBINTL)
.SUFFIXES:
.SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o
.c.o:
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $#
.c.d:
#echo "making $# from $<"
#$(CC) -MM $(ALL_CPPFLAGS) $< > $#
.m.d:
#echo > $#
.cc.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $#
.cpp.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $#
.cc.d:
#echo > $#
.cpp.d:
#echo > $#
.m.o:
$(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $#
.mm.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $#
.M.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $#
.f.o:
$(FC) $(ALL_FFLAGS) -c $< -o $#
## #FCFLAGS_f9x# are flags needed to recognise the extensions
.f95.o:
$(FC) $(ALL_FCFLAGS) -c $< -o $#
.f90.o:
$(FC) $(ALL_FCFLAGS) -c $< -o $#
Let's look at some parts of the posted Makeconf file:
CC = gcc -std=gnu99
CFLAGS = -g -O2 $(LTO)
CPICFLAGS = -fPIC
CPPFLAGS = -I/usr/local/include
This part dealing with C looks fine.
CXX = /opt/csw/gcc4/bin
CXXCPP = /lib/cpp
CXXFLAGS = $(LTO)
CXXPICFLAGS = -KPIC
The value of CXX must be the executable for the C++ compiler, optionally with full path if it is not in $PATH. For example, I have
CXX = g++ -std=gnu++11
(Note that C++11 is the default nowadays.)
For CXXFLAGS you should add optimization. A good starting point could be
CXXFLAGS = -g -O2 $(LTO)
Finally CXXPICFLAGS is wrong for your compiler. -fpic should work.
Assuming you are using the same compiler for all C++ versions, the CXXnn* variables are straightforward:
CXXnn gets the compiler (without any additional flags)
CXXnnFLAGS and CXXnnPICFLAGS is the same as CXXFLAGS and CXXPICFLAGS
CXXnnSTD gets the compiler flags necessary to activate that particular standard, e.g. CXX98STD = -std=gnu++98 or CXX11STD = -std=gnu++11
Leave all fields empty, if your compiler does not support the standard version, e.g. gcc v4 does not support C++17, and C++14 might be only partial as "C++1y"

error: C compiler cannot create executables

I am trying to install Rcplex in R on a macbook and I'm following the instruction at this link http://jrzubizarreta.com/INSTALL.
On terminal, in the folder where the unzipped Rcplex directory is, I typed
cd /Library/Frameworks/R.framework/Versions/3.4/Resources/library
R CMD INSTALL --configure-args="PKG_CFLAGS='-m64 -fPIC' PKG_CPPFLAGS=-
I/Applications/CPLEX_Studio_Community129/cplex/include PKG_LIBS='-
l/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic
-m64 -lm -lpthread -framework CoreFoundation -framework IOKit'" Rcplex
as by instructions. However, I get the following error:
configure: error: Could not link CPLEX library using -
L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic
-m64 -lm -lpthread -framework CoreFoundation -framework IOKit
The error persist if I use the sudo option before R CMD INSTALL [...].
The config.log states:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Rcplex configure 0.3.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ ./configure PKG_CFLAGS=-m64 -fPIC PKG_CPPFLAGS=-I/Applications/CPLEX_Studio_Community129/cplex/include PKG_LIBS=-L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit
## --------- ##
## Platform. ##
## --------- ##
hostname = Michele.local
uname -m = x86_64
uname -r = 16.7.0
uname -s = Darwin
uname -v = Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
hostinfo = Mach kernel version:
Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 16.00 gigabytes
Default processor set: 365 tasks, 1663 threads, 4 processors
Load average: 2.45, Mach factor: 1.68
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /Users/ssandrews/anaconda/bin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /Users/ssandrews/anaconda/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.5/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/X11/bin
PATH: /Library/TeX/texbin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1631: checking for gcc
configure:1657: result: clang
configure:1901: checking for C compiler version
configure:1904: clang --version </dev/null >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:1907: $? = 0
configure:1909: clang -v </dev/null >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:1912: $? = 0
configure:1914: clang -V </dev/null >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:1917: $? = 1
configure:1940: checking for C compiler default output file name
configure:1943: clang -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:1946: $? = 0
configure:1992: result: a.out
configure:1997: checking whether the C compiler works
configure:2003: ./a.out
configure:2006: $? = 0
configure:2023: result: yes
configure:2030: checking whether we are cross compiling
configure:2032: result: no
configure:2035: checking for suffix of executables
configure:2037: clang -o conftest -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2040: $? = 0
configure:2065: result:
configure:2071: checking for suffix of object files
configure:2092: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2095: $? = 0
configure:2117: result: o
configure:2121: checking whether we are using the GNU C compiler
configure:2145: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2151: $? = 0
configure:2155: test -z
|| test ! -s conftest.err
configure:2158: $? = 0
configure:2161: test -s conftest.o
configure:2164: $? = 0
configure:2177: result: yes
configure:2183: checking whether clang accepts -g
configure:2204: clang -c -g -I/usr/local/include conftest.c >&5
configure:2210: $? = 0
configure:2214: test -z
|| test ! -s conftest.err
configure:2217: $? = 0
configure:2220: test -s conftest.o
configure:2223: $? = 0
configure:2234: result: yes
configure:2251: checking for clang option to accept ANSI C
configure:2321: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2327: $? = 0
configure:2331: test -z
|| test ! -s conftest.err
configure:2334: $? = 0
configure:2337: test -s conftest.o
configure:2340: $? = 0
configure:2358: result: none needed
configure:2376: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
conftest.c:2:3: error: unknown type name 'choke'
choke me
^
conftest.c:2:11: error: expected ';' after top level declarator
choke me
^
;
2 errors generated.
configure:2382: $? = 1
configure: failed program was:
| #ifndef __cplusplus
| choke me
| #endif
configure:2520: checking how to run the C preprocessor
configure:2638: result: clang -E
configure:2662: clang -E -I/usr/local/include conftest.c
configure:2668: $? = 0
configure:2700: clang -E -I/usr/local/include conftest.c
conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^
1 error generated.
configure:2706: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "Rcplex"
| #define PACKAGE_TARNAME "rcplex"
| #define PACKAGE_VERSION "0.3.2"
| #define PACKAGE_STRING "Rcplex 0.3.2"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:2756: checking for egrep
configure:2766: result: grep -E
configure:2771: checking for ANSI C header files
configure:2796: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2802: $? = 0
configure:2806: test -z
|| test ! -s conftest.err
configure:2809: $? = 0
configure:2812: test -s conftest.o
configure:2815: $? = 0
configure:2904: clang -o conftest -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c -L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit >&5
conftest.c:26:7: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
exit(2);
^
conftest.c:26:7: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:2907: $? = 0
configure:2909: ./conftest
configure:2912: $? = 0
configure:2927: result: yes
configure:2951: checking for sys/types.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for sys/stat.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for stdlib.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for string.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for memory.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for strings.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for inttypes.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for stdint.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for unistd.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z
|| test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:3019: checking ilcplex/cplex.h usability
configure:3031: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c >&5
configure:3037: $? = 0
configure:3041: test -z
|| test ! -s conftest.err
configure:3044: $? = 0
configure:3047: test -s conftest.o
configure:3050: $? = 0
configure:3060: result: yes
configure:3064: checking ilcplex/cplex.h presence
configure:3074: clang -E -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c
configure:3080: $? = 0
configure:3100: result: yes
configure:3135: checking for ilcplex/cplex.h
configure:3142: result: yes
configure:3154: checking for library containing CPXversion
configure:3184: clang -o conftest -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c -L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit >&5
Undefined symbols for architecture x86_64:
"_CPXversion", referenced from:
_main in conftest-074e04.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3190: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "Rcplex"
| #define PACKAGE_TARNAME "rcplex"
| #define PACKAGE_VERSION "0.3.2"
| #define PACKAGE_STRING "Rcplex 0.3.2"
| #define PACKAGE_BUGREPORT ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char CPXversion ();
| int
| main ()
| {
| CPXversion ();
| ;
| return 0;
| }
configure:3239: clang -o conftest -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include conftest.c -lcplex -L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit >&5
ld: library not found for -lcplex
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3245: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "Rcplex"
| #define PACKAGE_TARNAME "rcplex"
| #define PACKAGE_VERSION "0.3.2"
| #define PACKAGE_STRING "Rcplex 0.3.2"
| #define PACKAGE_BUGREPORT ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char CPXversion ();
| int
| main ()
| {
| CPXversion ();
| ;
| return 0;
| }
configure:3273: result: no
configure:3279: error: Could not link CPLEX library using -L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_header_ilcplex_cplex_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_objext=o
ac_cv_prog_CPP='clang -E'
ac_cv_prog_ac_ct_CC=clang
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_egrep='grep -E'
ac_cv_search_CPXversion=no
## ----------------- ##
## Output variables. ##
## ----------------- ##
AWK=''
CC='clang'
CFLAGS='-Wall -g -O2 -m64 -fPIC'
CPLEX_BIN=''
CPP='clang -E'
CPPFLAGS='-I/usr/local/include -I/Applications/CPLEX_Studio_Community129/cplex/include'
DEFS=''
ECHO_C='ECHO_N=''
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
LDFLAGS=''
LIBOBJS=''
LIBS='-L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='Rcplex'
PACKAGE_STRING='Rcplex 0.3.2'
PACKAGE_TARNAME='rcplex'
PACKAGE_VERSION='0.3.2'
PATH_SEPARATOR=':'
PKG_CFLAGS='-m64 -fPIC'
PKG_CPPFLAGS='-I/Applications/CPLEX_Studio_Community129/cplex/include'
PKG_LIBS='-L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'
SHELL='/bin/sh'
ac_ct_CC='clang'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${prefix}/share'
exec_prefix='NONE'
host_alias=''
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='NONE'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define HAVE_INTTYPES_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "Rcplex"
#define PACKAGE_STRING "Rcplex 0.3.2"
#define PACKAGE_TARNAME "rcplex"
#define PACKAGE_VERSION "0.3.2"
#define STDC_HEADERS 1
configure: exit 1
The makefile carries the following information:
SYSTEM = x86-64_osx
LIBFORMAT = static_pic
#------------------------------------------------------------
#
# When you adapt this makefile to compile your CPLEX programs
# please copy this makefile and set CPLEXDIR and CONCERTDIR to
# the directories where CPLEX and CONCERT are installed.
#
#------------------------------------------------------------
CPLEXDIR = ../../..
CONCERTDIR = ../../../../concert
# ---------------------------------------------------------------------
# Compiler selection
# ---------------------------------------------------------------------
CCC = clang++ -O0
CC = clang -O0
JAVAC = javac
# ---------------------------------------------------------------------
# Compiler options
# ---------------------------------------------------------------------
CCOPT = -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -stdlib=libc++
COPT = -m64 -fPIC
JOPT = -classpath $(CPLEXDIR)/lib/cplex.jar -O
# ---------------------------------------------------------------------
# Link options and libraries
# ---------------------------------------------------------------------
CPLEXBINDIR = $(CPLEXDIR)/bin/$(BINDIST)
CPLEXJARDIR = $(CPLEXDIR)/lib/cplex.jar
CPLEXLIBDIR = $(CPLEXDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTLIBDIR = $(CONCERTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
# For dynamic linking
CPLEXBINDIR = $(CPLEXDIR)/bin/$(SYSTEM)
CPLEXLIB = cplex$(dynamic:yes=1290)
run = $(dynamic:yes=DYLD_LIBRARY_PATH=$(CPLEXBINDIR))
CCLNDIRS = -L$(CPLEXLIBDIR) -L$(CONCERTLIBDIR) $(dynamic:yes=-L$(CPLEXBINDIR))
CLNDIRS = -L$(CPLEXLIBDIR) $(dynamic:yes=-L$(CPLEXBINDIR))
CCLNFLAGS = -lconcert -lilocplex -l$(CPLEXLIB) -m64 -lm -lpthread -framework CoreFoundation -framework IOKit -stdlib=libc++
CLNFLAGS = -l$(CPLEXLIB) -m64 -lm -lpthread -framework CoreFoundation -framework IOKit
JAVA = java -d64 -Djava.library.path=$(CPLEXDIR)/bin/x86-64_osx -classpath $(CPLEXJARDIR):
all:
make all_c
make all_cpp
make all_java
execute: all
make execute_c
make execute_cpp
make execute_java
CONCERTINCDIR = $(CONCERTDIR)/include
CPLEXINCDIR = $(CPLEXDIR)/include
EXDIR = $(CPLEXDIR)/examples
EXINC = $(EXDIR)/include
EXDATA = $(EXDIR)/data
EXSRCC = $(EXDIR)/src/c
EXSRCCX = $(EXDIR)/src/c_x
EXSRCCPP = $(EXDIR)/src/cpp
EXSRCJAVA = $(EXDIR)/src/java
CFLAGS = $(COPT) -I$(CPLEXINCDIR)
CCFLAGS = $(CCOPT) -I$(CPLEXINCDIR) -I$(CONCERTINCDIR)
JCFLAGS = $(JOPT)
Any idea on how to fix this issue? Thank you
It says
error: unable to open output file '/Volumes/Andrews/R working
Could it be that the blank in the file/folder name causes trouble? Try to install into a path that does not have blanks in its name. And make sure that path exists and you have write permissions for it.
Update after question was updated with new error message: Now the error is this:
error: Could not link CPLEX library using -L/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm -lpthread -framework CoreFoundation -framework IOKit
This is the wrong path. The CPLEX libraries are not in examples/x86-64_osx/static_pic but are either in bin/x86-64_osx (dynamic library) or in lib/x86-64_osx/static_pic (static library). I don't know which of the two libraries is required, so just put both pathes into the configuration arguments (including the absolute path to your installation, of course). I am not sure whether you also have to put -lcplex or -lcplex129 (depending on whether the static or the dynamic library is required). So if you get the same error without putting these arguments, then try with them.

How can I write a GNU Makefile that has multiple target/prerequisites to execute the same recipe?

As an example:
a:b
cp $< $#
c:d
cp $< $#
e:f
cp $< $#
One solution would be to use a function:
define my_cp
cp $(1) $(2)
endef
a:b
$(call my_cp, $<, $#)
...
But I was wondering if people could suggest an alternative ...
The call thing seems more complex than necessary. You could just use:
CP = cp $< $#
a:b
$(CP)
...
You could also do this:
a c e:
cp $< $#
a: b
c: d
e: f
That's about it though.

Setting up Rcpp GSL for windows

I am trying to set up Rcpp GSL for windows.. I read lot of post on the subject, but I have been unable to find a solution for a while now.. Sorry in advance..
So I am running R 3.1 on windows 8.1. Both Rcpp and Rcpp Armadillo are working fine..
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppGSL_0.2.0 RcppArmadillo_0.4.300.0 Rcpp_0.11.1 foreign_0.8-61
loaded via a namespace (and not attached):
[1] tools_3.1.0
1) I made sure that there is no space in the R directory
2) I installed gnuwin32
3) I changed my Makevars.win
PKG_CPPFLAGS=-I$(LIB_GSL=C:/GnuWin32)/include -I../inst/include
PKG_LIBS=-L$(LIB_GSL=C:/GnuWin32)/lib -lgsl -lgslcblas $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
4) Here is my Makeconf, but let's be honest here.. I have no idea what this is saying
#-*- Makefile -*-
# $(R_HOME}/etc$(R_ARCH)/Makeconf
# Hand-edited version for gnuwin32.
ifdef DEBUG
DLLFLAGS=
DEBUGFLAG=-gdwarf-2
else
DLLFLAGS=-s
DEBUGFLAG=
endif
DLLFLAGS+= -static-libgcc
LINKFLAGS+= -static-libgcc
## Things which are substituted by fixed/Makefile (and also -O2 -> -O2)
WIN = 64
BINPREF =
# SYMPAT = 's/^.* [BCDRT] _/ /p' for 32-bit
# SYMPAT = 's/^.* [BCDRT] / /p' for 64-bit
SYMPAT = 's/^.* [BCDRT] / /p'
IMPDIR = bin/x64
# flags for multilib builds, for compilers, dlltool and windres
M_ARCH = -m64
DT_ARCH = -m i386:x86-64 --as-flags --64
RC_ARCH = -F pe-x86-64
# Used by packages tcltk and tkrplot
TCL_HOME = $(R_HOME)/Tcl
LOCAL_SOFT = d:/RCompile/CRANpkg/extralibs64/local
ifneq ($(strip $(LOCAL_SOFT)),)
LOCAL_CPPFLAGS = -I"$(LOCAL_SOFT)/include"
LOCAL_LIBS = -L"$(LOCAL_SOFT)/lib$(R_ARCH)" -L"$(LOCAL_SOFT)/lib"
endif
DLLTOOL = $(BINPREF)dlltool --as $(BINPREF)as $(DT_ARCH)
DLLTOOLFLAGS = -k
NM = $(BINPREF)nm
RESCOMP = $(BINPREF)windres $(RC_ARCH)
## MAIN_LD needs to be set by the package
LINKER = $(MAIN_LD)
## as a default
DLL = $(CC)
## Things defined in Renviron on Unix
SED = sed
TAR = tar
## Things defined in MkRules
CAT = cat
CP = cp
MKDIR = mkdir
RM = rm -f
SORT = sort
## For use in packages
GRAPHAPP_LIB = -lRgraphapp
TCL_VERSION = 85
ZLIB_LIBS = -lRzlib
AR = $(BINPREF)ar
## Used by packages 'maps' and 'mapdata'
AWK = gawk
BLAS_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRblas
C_VISIBILITY =
CC = $(BINPREF)gcc $(M_ARCH)
CFLAGS = -O2 -Wall $(DEBUGFLAG) -std=gnu99 -mtune=core2
CPICFLAGS =
CPPFLAGS =
CXX = $(BINPREF)g++ $(M_ARCH)
CXXCPP = $(CXX) -E
CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2
CXXPICFLAGS =
CXX1X = $(BINPREF)g++ $(M_ARCH)
CXX1XFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2
CXX1XPICFLAGS =
CXX1XSTD = -std=c++0x
DYLIB_EXT = .dll
DYLIB_LD = $(DLL)
DYLIB_LDFLAGS = -shared
DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
ECHO = echo
ECHO_C =
ECHO_N = -n
ECHO_T =
FC = $(BINPREF)gfortran $(M_ARCH)
FCFLAGS = -O2 $(DEBUGFLAG) -mtune=core2
# additional libs needed when linking with $(FC), e.g. on Solaris
FCLIBS =
F77 = $(BINPREF)gfortran $(M_ARCH)
F77_VISIBILITY =
FFLAGS = -O2 $(DEBUGFLAG) -mtune=core2
FLIBS = -lgfortran
FCPICFLAGS =
FPICFLAGS =
FOUNDATION_CPPFLAGS =
FOUNDATION_LIBS =
JAR =
JAVA =
JAVAC =
JAVAH =
# JAVA_HOME =
# JAVA_LD_LIBRARY_PATH =
JAVA_LIBS = -L"$(JAVA_HOME)/bin/client" -ljvm -ljvm-w32
JAVA_CPPFLAGS = -I"$(JAVA_HOME)/../include" -I"$(JAVA_HOME)/../include/win32"
LAPACK_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRlapack
## we only need this is if it is external, as otherwise link to R
LIBINTL=
LIBM = -lm
LIBR = -L"$(R_HOME)/$(IMPDIR)" -lR
LIBS = -lm
## needed by R CMD config
LIBnn = lib
LIBTOOL =
LDFLAGS =
## needed to build applications linking to static libR
# MAIN_LD =
# MAIN_LDFLAGS =
# MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS)
# don't have this: would 'mkdir -p' do?
# MKINSTALLDIRS = $(R_HOME)/bin/mkinstalldirs
## There is no ObjC support in the recommended toolchain,
## but if a toolchain had support, this it what it would be.
OBJC = $(CC)
OBJCFLAGS = -O2
OBJC_LIBS = -lobjc
OBJCXX =
R_ARCH = /x64
RANLIB = $(BINPREF)ranlib
SAFE_FFLAGS = -O2 -ffloat-store
SED = sed
## it seems some makes (but not ours) get upset if SHELL is set.
# SHELL = /bin/sh
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = $(CXX)
## ideally -shared -static-libstdc++, but not for gcc 4.2.1
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX1XLD = $(CXX1X)
SHLIB_CXX1XLDFLAGS = -shared
SHLIB_EXT = .dll
SHLIB_FCLD = $(FC)
## ideally -shared -static-libgfortran, but not for gcc 4.2.1
SHLIB_FCLDFLAGS = -shared
SHLIB_FFLAGS =
SHLIB_LD = $(CC)
SHLIB_LDFLAGS = -shared
SHLIB_LIBADD =
SHLIB_LINK = $(SHLIB_LD) -Wl,--export-all-symbols $(SHLIB_LDFLAGS) $(LDFLAGS)
SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS = -fopenmp
SHLIB_OPENMP_FCFLAGS = -fopenmp
SHLIB_OPENMP_FFLAGS = -fopenmp
SHLIB_PTHREAD_FLAGS = -pthread
STRIP_LIBS = $(BINPREF)strip --strip-unneeded
STRIP_STATIC_LIBS = $(BINPREF)strip --strip-debug
TCLTK_CPPFLAGS = -I "$(TCL_HOME)/include" -DWin32
TCLTK_LIBS = -L"$(TCL_HOME)/bin64" -ltcl$(TCL_VERSION) -ltk$(TCL_VERSION)
STATIC_LIBR =
R_XTRA_CFLAGS =
R_XTRA_CPPFLAGS = -I"$(R_HOME)/include" -DNDEBUG
R_XTRA_CXXFLAGS =
R_XTRA_FFLAGS =
ALL_CFLAGS = $(R_XTRA_CFLAGS) $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(CFLAGS)
ALL_CPPFLAGS = $(R_XTRA_CPPFLAGS) $(PKG_CPPFLAGS) $(CPPFLAGS) $($*-CPPFLAGS) $(CLINK_CPPFLAGS) $(LOCAL_CPPFLAGS)
ALL_CXXFLAGS = $(R_XTRA_CXXFLAGS) $(PKG_CXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(CXXFLAGS)
ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(OBJCFLAGS)
ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(OBJCXXFLAGS)
ALL_FFLAGS = $(R_XTRA_FFLAGS) $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FFLAGS)
ALL_LIBS = $(PKG_LIBS) $(LOCAL_LIBS) $(SHLIB_LIBADD) $(LIBR) $(LIBINTL)
.SUFFIXES:
.SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o .a .def .dll .exe .rc
.c.o:
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $#
.c.d:
#echo "making $# from $<"
#$(CC) -std=gnu99 -MM $(ALL_CPPFLAGS) $< > $#
.cc.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $#
.cpp.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $#
.cc.d:
#echo "making $# from $<"
#$(CXX) -M $(ALL_CPPFLAGS) $< > $#
.cpp.d:
#echo "making $# from $<"
#$(CXX) -M $(ALL_CPPFLAGS) $< > $#
.m.o:
$(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $#
.m.d:
#echo "making $# from $<"
#$(OBJC) -MM $(ALL_CPPFLAGS) $< > $#
.mm.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $#
.M.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $#
.f.o:
$(F77) $(ALL_FFLAGS) -c $< -o $#
.f95.o:
$(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c $< -o $#
.f90.o:
$(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c $< -o $#
%.exe:
$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $# $^ $($*-LIBS) $(LOCAL_LIBS) $(LIBS)
%.dll:
#echo EXPORTS > $*.def
#$(NM) $^ | $(SED) -n $(SYMPAT) >> $*.def
$(SHLIB_LD) -shared $(DLLFLAGS) -o $# $*.def $^ $(ALL_LIBS)
#$(RM) $*.def
lib%.dll.a: %.def
$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --input-def $*.def --output-lib $#
%.a:
#$(RM) $#
$(AR) crs $# $^
%.o: %.rc
$(RESCOMP) $(RESFLAGS) -i $< -o $#
5) I am just trying to reproduce the example in the GSL vignette
#include <RcppGSL.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
extern "C" SEXP colNorm(SEXP sM) {
try {
RcppGSL::matrix<double> M = sM; // create gsl data structures from SEXP
int k = M.ncol();
Rcpp::NumericVector n(k); // to store results
for (int j = 0; j < k; j++) {
RcppGSL::vector_view<double> colview = gsl_matrix_column (M, j);
n[j] = gsl_blas_dnrm2(colview);
}
M.free() ;
return n; // return vector
} catch( std::exception &ex ) {
forward_exception_to_r( ex );
} catch(...) {
::Rf_error( "c++ exception (unknown reason)" );
}
return R_NilValue; // -Wall
}
and I get this error
sourceCpp("gsltest.cpp")
g++ -m64 -I"C:/R/R-31~1.0/include" -DNDEBUG -I"C:/R/R-3.1.0/library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c gsltest.cpp -o gsltest.o gsltest.cpp:1:21: fatal error: RcppGSL.h: No such file or directory compilation terminated. make: *** [gsltest.o] Error 1 Warning message: running command 'make -f "C:/R/R-31~1.0/etc/x64/Makeconf" -f "C:/R/R-31~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_15178.dll" WIN=64 TCLBIN=64 OBJECTS="gsltest.o"' had status 2
Error in sourceCpp("gsltest.cpp") :
Error 1 occurred building shared library.
Thanks a lot..
For Windows users with the same problem, you need to follow these steps:
Install R, making sure there are no spaces in the path;
Install Rtools;
Download file local300.zip as suggested by Dirk. And unzip it in the R directory;
Edit the path (e.g. following general instructions shown here http://www.computerhope.com/issues/ch000549.htm) to add the link the directory of local300 as LIB_GSL
Edit your Makevars.win, and you are ready to go
PKG_CPPFLAGS=-I$(LIB_GSL)/include -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib/x64 -lgsl -lgslcblas
When you use sourceCpp, if the RcppGSL package does a good job of defining its inline plugin, you need to add to pull in headers, etc ...
// [[Rcpp::depends(RcppGSL)]]
The clue is in what sourceCpp gives you, this below is an extract of what you posted:
g++ -m64 -I"C:/R/R-31~1.0/include" -DNDEBUG
-I"C:/R/R-3.1.0/library/Rcpp/include"
-I"d:/RCompile/CRANpkg/extralibs64/local/include"
-O2 -Wall -mtune=core2 -c gsltest.cpp -o gsltest.o
gsltest.cpp:1:21: fatal error: RcppGSL.h: No such file or directory
If it is too hard to locally build GSL, note that you can also download the actual prebuilt GSL library which CRAN itself uses from this page -- you want the (large-ish) file local300.zip.
It should then should be a matter of adjusting the ennvironment variable LIB_GSL used here:
edd#max:~$ cat svn/rcpp/pkg/RcppGSL/src/Makevars.win
## This assumes that the LIB_GSL variable points to working GSL libraries
PKG_CPPFLAGS=-I$(LIB_GSL)/include -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas
edd#max:~$
where I have removed the now-redundant invocation of Rscript for the Rcpp library we no longer need.

Resources