I am trying to write basic matrix multiplication function using RcppArmadillo.
My function is the following
cppFunction("arma::mat m(arma::mat A, arma::mat B) { return A % B; }",
depends="RcppArmadillo")
But I get the following error when I try to run this code
using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.0.40.1)’
using SDK: ‘MacOSX14.0.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.3-arm64/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RcppArmadillo/include" -I"/private/var/folders/cj/1q7b5jmd56b7pz7389t0pp8r0000gn/T/RtmpfpevIA/sourceCpp-aarch64-apple-darwin20-1.0.11" -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c filec7d12061aeb.cpp -o filec7d12061aeb.o
clang++ -arch arm64 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o sourceCpp_15.so filec7d12061aeb.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0 -L/opt/gfortran/lib -lgfortran -lemutls_w -lquadmath -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
ld: warning: search path '/opt/gfortran/lib' not found
ld: library 'gfortran' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_15.so] Error 1
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error 1 occurred building shared library.
I'm unable to debug the code, any kind of help is appreciated. I hope my code syntax is right.