[Rcpp-devel] Getting different build commands on Linux vs. Mac OS
ralf.stubner at r-institute.com
Mon Apr 30 23:33:36 CEST 2018
> Am 30.04.2018 um 21:01 schrieb Evan Biederstedt <evan.biederstedt at gmail.com>:
> > You can change the used compiler for *your* system via ~/.R/Makevars, though. From my point of view that is a (short-time) workaround only. You have to figure out why clang does not like your package/library.
> I've yet to test changing the compiler in ~/.R/Makevars. However, it's not clear to me why this would be a short-term solution. Could you clarify why using g++ instead of clang would be a problem gong forwards?
Because clang is the default compiler for R on MacOS. So you would make it difficult for other people (let alone CRAN) to make use of the package. However, I think there is something wrong about your macOS machine. I have just tried to compile your package on a macOS machine that I have access to, and I got quite different results:
$ R CMD INSTALL bambi_1.0.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘bambi’ ...
/usr/local/clang4/bin/clang++ -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
/usr/local/clang4/bin/clang++ -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c bambi.cpp -o bambi.o
bambi.cpp:7:14: fatal error: 'bam_lmdb.h' file not found
1 error generated.
make: *** [bambi.o] Error 1
ERROR: compilation failed for package ‘bambi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/bambi’
I had not installed the necessary C library, so unsurprisingly the compilation step already failed. What I find interesting is that in my case "-std=gnu++11“ and "-I../inst/include/" are present in the command line options for clang++. These are also missing from what you quoted and are also a consequence of src/Makevars. It almost looks as if this file got lost on your macOS box …
More information about the Rcpp-devel