Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork219
Description
Hi. In relation to the discussion in#1188 I just wanted to mention an issue introduced there.
Problem
Adding quotes around path in#1189 broke compilation for anybody who was usingCxxFlags in simple compilation script like:
CXXFLAGS="$(R CMD config --cppflags)"CXXFLAGS="$CXXFLAGS$(R --vanilla --slave -e"Rcpp:::CxxFlags()")"g++$CXXFLAGS -c main.cpp
This is because bash will use exactly what is returned byCxxFlags as argument for the compiler (g++). This means that the compiler gets-I"/some/path" and searches for headers in"/some/path" rather then/some/path.
Other use cases
- You can resolve the quotes in bash by doing
eval g++ ...in the script, but one cannot modify the all the compiler calls to use "eval" in eg../configurescripts fromautoconf. - If one uses the
CxxFlags()in GNU make, it works. This is becausemakeresolves the quotes. For example, the compilation of RInside examples (example/standard) works fine. - On the other hand, it seems to break
cmake-based compilation. When I try to compile the same examples usingcmake 3.16.3for configuration, it fails with the error. Apparently passing path with quotes toinclude_directories()through a variable causes some weird behaviour.
Questions
- If anybody has a good idea how to fix this without hurting windows users and their beloved spaces, I would be happy to implement it and make a pull request. The only half-decent workaround I can think of now is quoting pathif it has a space.
- Is there a better way to do get include paths from Rcpp, which would work with eg. autoconf?
Notes
We run into this problem, as we useRInside in ourC++ code. We currently use a workaround of stripping quotes.
Themain.cpp file can be as simple as:
#include<Rcpp.h>intmain () {return0;}
I'm not attachingsessionInfo() as this issue is not about R.
@eddelbuettel Do you think it is an issue at all and would you expect such a bash script to work? If not, I you can close the issue, and we'll stick with our workaround.