[R-pkg-devel] Weird MAKEFLAGS bug
William Dunlap
wdunlap at tibco.com
Tue Jan 10 22:37:06 CET 2017
MAKEFLAGS='CXXFLAGS=-std=c++0x -O2' R CMD SHLIB
passes two items, 'CXXFLAGS=-std=c++0x' and '-O2', not the single item
'CXXFLAG=-std=c++0x -O2', to make. Suitably recent versions of GNU
make take the make argument -O2 to control the 'output-sync'.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Jan 10, 2017 at 12:39 PM, Costas Tsirogiannis
<analekta at gmail.com> wrote:
> 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 <edd at 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 at 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 at max:~$
>>
>> Dirk
>>
>> --
>> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list