stringi install error: configure: error: C compiler cannot create executables
Asked Answered
L

4

6

I am trying to install stringi package after a recent update of R to newest version. However, I met this error:

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /usr/local/Cellar/r/3.4.3/lib/R
checking for R... /usr/local/Cellar/r/3.4.3/lib/R/bin/R
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /bin/cat
checking for gcc... /usr/local/opt/llvm/bin/clang -fopenmp
checking whether the C compiler works... no
configure: error: in `/private/var/folders/y5/m7pd62wn3939vyqxygrd_ff80000gn/T/RtmpNBCRW2/R.INSTALL8ec750ee123/stringi':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/usr/local/lib/R/3.4/site-library/stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

Following some posts, I tried:

install.packages('stringi', configure.args='--disable-cxx11')

or:

install.packages('stringi', type='mac.binary')

How could I correctly install stringi, did I miss something?

Additional info: I updated R with Homebrew. I successfully installed data.table before trying to install stringi, therefore it seems to be caused by package-specific problem.

Here is my session info:

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin17.2.0 (64-bit)
Running under: macOS High Sierra 10.13.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 
Lieutenancy answered 28/12, 2017 at 15:50 Comment(2)
See this SO post and this github issueAtal
@Ben, thanks for the link. Didn't follow this after I somehow installed it.Lieutenancy
E
7

I got the same problem when updating the stringi package. As was stated here https://github.com/gagolews/stringi/issues/291, the issue wasn't with stringi but instead in ~/.R/Makevars. Installation was successful upon deleting this file using rm ~/.R/Makevars in your command line.

Erymanthus answered 13/1, 2020 at 5:39 Comment(0)
L
0

I have no idea about what caused the error. But finally I was able to install stringi through following steps:

  • remove all versions of R installed by homebrew with: brew uninstall --force r

  • download gfortran(not sure whether this is necessary, just following the installation guide in manual) and R 3.4.3 for Mac OS X from CRAN (I chose .pkg, while .dmg files are also available) and install them.

  • open studio and run install.packages('stringi'), which seems installed the binary package successfully.

Lieutenancy answered 30/12, 2017 at 7:7 Comment(0)
G
0

Upgrade you compiler, here is an example works on openSUSE:

install newer version of compiler:

zypper in gcc7 gcc7-c++ gcc7-c++ gcc7-fortran

Edit your compiler config files, open /usr/lib64/R/etc/Makeconf, and add following content:

CC = gcc-7
CXX = g++-7
CXX98 = g++-7
CXX11 = g++-7
CXX14 = g++-7
CXX17 = g++-7
FC = gfortran-7
F77 = gfortran-7

Theoretically, you do not need to restart your R, just install the package you need directly.

Happy coding ;)

Greenhorn answered 19/3, 2018 at 8:33 Comment(0)
M
0

If you are on MacOS your xcode license might be expired. Try running:

sudo xcodebuild -license

from the command line and agreeing with the license.

Mature answered 10/10, 2019 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.