[R-SIG-Mac] Problems compiling with R CMD build and devtools::build()

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Wed May 17 20:13:05 CEST 2023


I think the simplest solution is to remove the gfortran you installed, 
and then install it back using the installer on

   https://mac.r-project.org/tools/

Duncan Murdoch

On 17/05/2023 1:26 p.m., Jarrett Phillips wrote:
> Hi Rodney,
> 
> When I paste the directories into the Terminal, I get
> 
> no such file or directory:
> 
> 
> 
> suggesting that they don't exist.
> 
> 
> Seems like I need to create them (I'm a newbie)?
> 
> 
> What should be my next steps?
> 
> 
> Thanks!
> 
> 
> Cheers,
> 
> 
> Jarrett
> 
> 
> 
> 
> On Wed, May 17, 2023 at 1:25 PM Jarrett Phillips <phillipsjarrett1 using gmail.com>
> wrote:
> 
>> Hi Rodney,
>>
>> When I paste the directories into the Terminal, I get
>>
>> no such file or directory:
>>
>>
>>
>> suggesting that they don't exist.
>>
>>
>> Seems like I need to create them (I'm a newbie)?
>>
>>
>> What should be my next steps?
>>
>>
>> Thanks!
>>
>>
>> Cheers,
>>
>>
>> Jarrett
>>
>>
>>
>>
>>
>> On Wed, May 17, 2023 at 1:07 PM Sparapani, Rodney <rsparapa using mcw.edu>
>> wrote:
>>
>>> Hi Jarrett:
>>>
>>>
>>>
>>> Do the two directories exist that clang is warning you about?
>>>
>>>
>>>
>>> '/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1'
>>> '/opt/R/arm64/gfortran/lib'
>>>
>>>
>>>
>>> --
>>>
>>> Rodney Sparapani, Associate Professor of Biostatistics, He/Him/His
>>>
>>> Director, Wisconsin Chapter of the American Statistical Association
>>>
>>> Institute for Health and Equity, Division of Biostatistics
>>>
>>> Medical College of Wisconsin, Milwaukee Campus
>>>
>>>
>>>
>>> *From: *R-SIG-Mac <r-sig-mac-bounces using r-project.org> on behalf of Jarrett
>>> Phillips <phillipsjarrett1 using gmail.com>
>>> *Date: *Wednesday, May 17, 2023 at 11:54 AM
>>> *To: *r-sig-mac using r-project.org <r-sig-mac using r-project.org>
>>> *Subject: *[R-SIG-Mac] Problems compiling with R CMD build and
>>> devtools::build()
>>>
>>> ATTENTION: This email originated from a sender outside of MCW. Use
>>> caution when clicking on links or opening attachments.
>>> ________________________________
>>>
>>> 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 and how to fix the issue(s)?
>>>
>>> Thanks!
>>>
>>> Cheers,
>>>
>>> Jarrett
>>>
>>> P.S. - I've asked on the R package dev list and after trying a number of
>>> solutions was suggested to try here as it seems to be a macOS issue.
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org
>>>
>>> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!H8mHWRdzp34!8RmbGRYgbB_f5U_CMipQjBvZqNIpC_Jg8y9_089pd69hvfqoWwH0HbRuYKPQ0QIOcyz-4Tq-j0GFysnSlDkU3GUmmA$
>>> <https://urldefense.com/v3/__https:/stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!H8mHWRdzp34!8RmbGRYgbB_f5U_CMipQjBvZqNIpC_Jg8y9_089pd69hvfqoWwH0HbRuYKPQ0QIOcyz-4Tq-j0GFysnSlDkU3GUmmA$>
>>>
>>
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list