Thanks a lot, indeed it worked using the Makevars file. I still do not understand why the command-line input fails but so be it.
One more quick question: if I include the Makevars file in my package code then the requested flags are used every time somebody installs my package in his system. However, -O2 is a gcc-specific flag so it won't work for every compiler. Is there a simple way to declare another optimization flag in Makevars, that works for all compilers? Thanks for all the help, --Constantinos On 10 January 2017 at 12:39, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 10 January 2017 at 11:55, Costas Tsirogiannis wrote: > | Greetings and thanks for previously offered solutions, > | > | I am developing a package that makes use of C++ code, and I want to > compile > | this code for testing reasons with the "R CMD SHLIB" command. Using > Ubuntu > | and gcc 5.4, and because for certain reasons I have to use the c++0x > | standard, I try the following command: > | > | > MAKEFLAGS='CXXFLAGS=-std=c++0x -lpthread -O2' R CMD SHLIB > MyMainCode.cpp > | > | For some weird reason, flag -O2 is not recognized properly and I get the > | following error message: > | > | > make: *** unknown output-sync type '2'. Stop. > | > | If I try -O3, I get "unknown output-sync type '3' ", and so on. > Everything > | works fine if I drop this optimization flag. Could you suggest a > workaround > | for that? > > Sounds weird. Wonder if something else could go on here. > > But in general, using ~/.R/Makevars is better. Try that. > > edd@max:~$ grep FLAGS ~/.R/Makevars | grep -v "^#" > CFLAGS += -O3 -Wall -pipe -pedantic -std=gnu99 > CXXFLAGS += -O3 -Wall -pipe -Wno-unused -pedantic > FFLAGS += -O3 -g0 -Wall -pipe > FCFLAGS += -O3 -g0 -Wall -pipe > CXX1XFLAGS=-O3 -Wall -pipe -Wno-unused -pedantic > FLAGS=-Wall -O3 > DYLIB_LDFLAGS = -Wl,-S -shared -fopenmp# $(CFLAGS) $(CPICFLAGS) > SHLIB_CXXLDFLAGS = -Wl,-S -shared > SHLIB_CXX1XLDFLAGS = -Wl,-S -shared > SHLIB_FCLDFLAGS = -Wl,-S -shared > SHLIB_LDFLAGS = -Wl,-S -shared# $(CFLAGS) $(CPICFLAGS) > edd@max:~$ > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel