Error when with Xcode 5.0 and Rcpp (Command Line Tools ARE installed)

前端 未结 3 2112
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 04:49

I have a new iMac and I\'m trying to run code using the Rcpp library that has been working on both my old iMac and Macbook Pro without issue. I have tried everything I can\

相关标签:
3条回答
  • 2020-12-01 05:27

    A easier solution would be the following. You should soft link the llvm compiler, in the terminal type:

    cd /usr/bin
    sudo ln -fs clang llvm-gcc-4.2
    sudo ln -fs clang++ llvm-g++-4.2
    

    Note: This also works for mex in Matlab.

    0 讨论(0)
  • 2020-12-01 05:28

    Quick guess:

    1. You are running the pre-built R binary which Simon built / CRAN provides.

    2. R stores its configuration options from its compile time, those influence its run-time.

    3. Check via the file $R_HOME/etc/Makeconf and look at CC and CXX.

    4. As Romain suggested, override CC and CXX via a file ~/.R/Makevars.

    5. Try again.

    Edit: I just confirmed with a colleague who has the exact same issue on a Mac OS X which he just upgrades to XCode 5 -- one now needs to override CC and CXX as R was built with the previous version of XCode.

    0 讨论(0)
  • 2020-12-01 05:34

    I'm not sure what you mean by "I downloaded a gcc compiler". You don't need to download your own gcc. You can use either the default or use clang++ by having something like this in your ~/.R/Makevars file:

    CC=clang
    CXX=clang++
    CXXFLAGS= -O3 -pedantic
    

    What happens when you try devtools::has_devel:

    > require(devtools)
    > has_devel()
    '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD SHLIB foo.c
    
    clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c foo.c -o foo.o
    clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
    [1] TRUE
    

    or Rcpp::evalCpp:

    > require(Rcpp)
    > evalCpp( "1+1")
    [1] 2    
    
    0 讨论(0)
提交回复
热议问题