[R-pkg-devel] Problems with devtools::build() in R

Serguei Sokol @ergue|@@oko| @end|ng |rom gm@||@com
Tue May 16 18:32:50 CEST 2023


Le 16/05/2023 à 18:07, Jarrett Phillips a écrit :
> Hi All,
> 
> I'm trying to generate a `tar.gz` file on a Mac for R package submission to
> CRAN but am having issues.
> 
> I'm using `devtools`, specifically `build()` and `install()`.
> 
> My package relies on compiled code via `Rcpp/RcppArmadillo`.
> 
>      build("HACSim_OO")
>      ── R CMD build
> ─────────────────────────────────────────────────────────────────
>      ✔  checking for file ‘/Users/jarrettphillips/Desktop/HAC
> simulation/HACSim_OO/DESCRIPTION’ ...
>      ─  preparing ‘HACSim’:
>      ✔  checking DESCRIPTION meta-information ...
>      ─  cleaning src
>      ─  installing the package to process help pages
>           -----------------------------------
>      ─  installing *source* package ‘HACSim’ ...
>         ** using staged installation
>         ** libs
>         clang++ -arch arm64 -std=gnu++11 -
> I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
>   -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include'
> -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include'
> -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -Wall
> -pedantic -fdiagnostics-color=always -c RcppExports.cpp -o RcppExports.o
>         clang++ -arch arm64 -std=gnu++11
> -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
>   -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include'
> -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include'
> -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -Wall
> -pedantic -fdiagnostics-color=always -c accumulate.cpp -o accumulate.o
>         clang++ -arch arm64 -std=gnu++11 -dynamiclib
> -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module
> -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib
> -L/opt/R/arm64/lib -o HACSim.so RcppExports.o accumulate.o
> -L/Library/Frameworks/R.framework/Resources/lib -lRlapack
> -L/Library/Frameworks/R.framework/Resources/lib -lRblas
> -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1
> -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lquadmath
> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
> -Wl,CoreFoundation
>         ld: warning: directory not found for option
> '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1'
>         ld: warning: directory not found for option
> '-L/opt/R/arm64/gfortran/lib'
>         ld: library not found for -lgfortran
>         clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>         make: *** [HACSim.so] Error 1
>         ERROR: compilation failed for package ‘HACSim’
>      ─  removing
> ‘/private/var/folders/r4/xm5blbcd2tn06tjv00lm1c780000gn/T/RtmpN4uaYR/Rinstdf4219594de/HACSim’
>           -----------------------------------
>      ERROR: package installation failed
>      Error in `(function (command = NULL, args = character(),
> error_on_status = TRUE, …`:
>      ! System command 'R' failed
>       ---
>       Exit status: 1
>       stdout & stderr: <printed>
>       ---
>      Type .Last.error to see the more details.
> 
> `clang` is installed (since I am able to run the code within my package)
> and I've verified by typing `gcc` in the Mac Terminal. I've also installed
> `Homebrew` and `gfortran`, verifying via typing in the Terminal.
> 
> Any idea on what's going on how to fix the issue(s)?
Try to add in <your_package_dir>/src/Makevars:

PKG_LIBS=$(FLIBS)

Best,
Serguei.



More information about the R-package-devel mailing list