I am working on a problem involving NIMBLE in R and I am getting the following error on compilation:
> Cmodel <- compileNimble(Rmodel)
Compiling
[Note] This may take a minute.
[Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
Error: Failed to create the shared library. Run 'printErrors(' to see the compilation errors.
> printErrors
using C++ compiler: 'Apple clang version 16.0.0 (clang-1600.0.26.6)' using SDK: "MacOSX15.2.sdk'
In file included from dynamicRegistrations_03_02_14_17_39.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nimble/include/nimble/ dynamicRegistrations.h:27:
/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nimble/include/nimble/RcppUtils.h:26:10: fatal error: 'string'
file not found
26 | #include ‹string›
A~vNNnn
1 error generated.
make: *** [dynamicRegistrations_03_02_14_17_39.0] Error 1
I am working on a Macbook Air M1 (2020) with macOS Sequoia 15.3.1.
gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I reproduced the problem with a test.cpp
example and achieved a similar error.
Example: test.cpp
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
void hello_world() {
Rcpp::Rcout << "Hello World!" << std::endl;
}
// After compile, this function will be immediately called using
// the below snippet and results will be sent to the R console.
/*** R
hello_world()
*/
Here's the error from test.cpp
> Rcpp::sourceCpp("test.cpp")
using C++ compiler: 'Apple clang version 16.0.0 (clang-1600.0.26.6)' using SDK: "MacOSX15.2.sdk'
clang++-arch arm64-std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I../inst/include -I"/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcp p/include"-I"/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppArmadill o/include" -I"/Users/r. mummah/Documents/GitHub/species-futures" -I/opt/R/arm64/include
-fPIC
-falign-functions=64 -Wall -g -02
- test.cpp -o test.o
In file included from test.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppA rmadillo/include/RcppArmadillo.h:29:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppA rmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/ include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/ include/Rcpp/r/headers.h:66:
/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include/Rcpp/platform/ compiler.h:100:10: fatal error: 'math' file not found
100 | #include <cmath>
AvNvNnn
1 error generated.
make: *** [test.0] Error 1
Error in Rcpp::sourceCpp("test.cpp") :
Error 1 occurred building shared library.
I believe this is a Mac-related issue with the C++ compiler. Has anyone else run into this issue? Any suggestions to fix this problem?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744993331a4605039.html
评论列表(0条)