Having trouble installing packages like tidyverse, seems like my C compiler doesnt work

Hello there,

I'm new to R and hoping, that someone can help me :slightly_smiling_face: . After quite some research I havent found anyone facing a similar problem.

I'm facing trouble with installing certain packages, which are dependencies for tidyverse and ggplot, like stringi. I installed R via homebrew and I also installed gcc and xcode.
When I try to install stringi I get the following Error:
(I cant use reprex since it depends on stringi ...)


R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin18.2.0 (64-bit)
Running under: macOS Mojave 10.14.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/Cellar/openblas/0.3.5/lib/libopenblasp-r0.3.5.dylib

[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_3.5.3 tools_3.5.3  


* installing *source* package ‘stringi’ ...
** Paket ‘stringi’ erfolgreich entpackt und MD5 Summen überprüft
checking for R_HOME... /usr/local/Cellar/r/3.5.3/lib/R
checking for R... /usr/local/Cellar/r/3.5.3/lib/R/bin/R
checking for endianness... little
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 local ICUDT_DIR... icu61/data
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking elf.h usability... no
checking elf.h presence... no
checking for elf.h... no
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking whether the C++ compiler supports the long long type... yes
checking whether the compiler implements namespaces... yes
checking whether the compiler supports Standard Template Library... yes
checking whether std::map is available... yes
checking for pkg-config... no
*** pkg-config could not be found
*** Trying with "standard" fallback flags
checking whether we may build an ICU4C-based project... no
*** The available ICU4C cannot be used
checking whether we may compile src/icu61/common/putil.cpp... yes
checking whether we may compile src/icu61/i18n/number_affixutils.cpp... yes
checking whether we can fetch icudt... downloading the ICU data library (icudt)
output path: icu61/data/icudt61l.zip
trying URL 'http://www.ibspan.waw.pl/~gagolews/stringi/icudt61l.zip'
Content type 'application/zip' length 10791080 bytes (10.3 MB)
downloaded 10.3 MB

icudt fetch successful
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/uconfig_local.h
config.status: creating src/install.libs.R

*** stringi configure summary:

*** compiler settings used:
    CPP=clang++ -E
    CFLAGS=-g -O2 -fPIC  
    CPPFLAGS=-I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include   -UDEBUG -DNDEBUG
    CXX=clang++ -std=gnu++11
    CXXFLAGS=-g -O2 -fPIC  

** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_brkiter.cpp -o stri_brkiter.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_collator.cpp -o stri_collator.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_common.cpp -o stri_common.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_compare.cpp -o stri_compare.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_container_base.cpp -o stri_container_base.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_container_bytesearch.cpp -o stri_container_bytesearch.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.3/lib/R/include" -DNDEBUG -I. -Iicu61       -Iicu61/unicode -Iicu61/common       -Iicu61/i18n -DU_STATIC_IMPLEMENTATION       -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL   -UDEBUG -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC -fPIC  -g -O2 -c stri_container_listint.cpp -o stri_container_listint.o
make: *** [stri_container_listint.o] Interrupt: 2
ERROR: compilation failed for package ‘stringi’
* removing ‘/usr/local/lib/R/3.5/site-library/stringi’

The good news is that is possible to install R and most packages on Mojave. You know the bad news.

The first thing I'd do (which won't fix this problem but potentially avoid others) is to install R from the official CRAN binary https://cran.r-project.org

Next, make sure you'e on Xcode 10.2 and you've installed the command line utilities.

xcode-select --install

Try re-installing pkg-config from homebrew, per https://stackoverflow.com/questions/13483059/how-do-i-fix-brew-install-pkg-config#13483060

Brew install or reinstall ICU4C

is what I'd try on mine.

1 Like

Thanks for your advice!

I installed R from CRAN, Xcode was updated before and everything I had trouble with before seems to be working now! Didn't even need to re install pkg-config.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.