Skip to content

checking whether the C compiler works... no

6 messages · Brian Ripley, David Winsemius, Simon Urbanek +1 more

#
When trying to install library reshape2, I get below messages.  But I do have some other packages which depend upon C compiler (e.g., Rcpp).  How can this problem be fixed?

Thanks,
Naresh

Messages when trying to install reshape2:
Installing package into ?/usr/local/lib/R/4.1/site-library?
(as ?lib? is unspecified)
also installing the dependencies ?stringi?, ?stringr?

trying URL 'https://cran.r-project.org/src/contrib/stringi_1.7.4.tar.gz'
Content type 'application/x-gzip' length 7599762 bytes (7.2 MB)
==================================================
downloaded 7.2 MB

trying URL 'https://cran.r-project.org/src/contrib/stringr_1.4.0.tar.gz'
Content type 'application/x-gzip' length 135777 bytes (132 KB)
==================================================
downloaded 132 KB

trying URL 'https://cran.r-project.org/src/contrib/reshape2_1.4.4.tar.gz'
Content type 'application/x-gzip' length 37307 bytes (36 KB)
==================================================
downloaded 36 KB

* installing *source* package ?stringi? ...
** package ?stringi? successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /usr/local/Cellar/r/4.1.1/lib/R
checking for R... /usr/local/Cellar/r/4.1.1/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... icu69/data
checking for gcc... /usr/local/opt/llvm/bin/clang -fopenmp
checking whether the C compiler works... no
configure: error: in `/private/var/folders/97/5377j5_d207fshvjz_pz7szw0000gn/T/RtmpCOKBRx/R.INSTALL64822d9c75a/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/4.1/site-library/stringi?
ERROR: dependency ?stringi? is not available for package ?stringr?
* removing ?/usr/local/lib/R/4.1/site-library/stringr?
ERROR: dependency ?stringr? is not available for package ?reshape2?
* removing ?/usr/local/lib/R/4.1/site-library/reshape2?

The downloaded source packages are in
	?/private/var/folders/97/5377j5_d207fshvjz_pz7szw0000gn/T/RtmpDOExfD/downloaded_packages?
Warning messages:
1: In install.packages("reshape2", repos = "https://cran.r-project.org") :
  installation of package ?stringi? had non-zero exit status
2: In install.packages("reshape2", repos = "https://cran.r-project.org") :
  installation of package ?stringr? had non-zero exit status
3: In install.packages("reshape2", repos = "https://cran.r-project.org") :
  installation of package ?reshape2? had non-zero exit status

My session info:
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin20.5.0 (64-bit)
Running under: macOS Big Sur 11.5.2

Matrix products: default
BLAS/LAPACK: /usr/local/Cellar/openblas/0.3.17/lib/libopenblasp-r0.3.17.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_4.1.1 tools_4.1.1
#
On 06/09/2021 08:43, Naresh Gurbuxani wrote:
You need to look in the config.log file.  The easiest way to make sure 
that is kept is to download the stringi source tarball, unpack it and 
run R CMD INSTALL stringi .

  
    
#
The   C compiler aka clang is not the same as the C++ compiler. 

Why don?t you install the pre-compiled version.

? 
David

Sent from my iPhone
16 days later
#
With some search on the internet, I was able to solve my problem with a small edit in Makevars file. ?When installing data.table, I had added some lines to Makevars file.  These lines were pointing to clang.  The problem was fixed when it was changed to gcc.  

# My Makevars file new
# Successful installation of reshape2 package
VER=-11                                                                            
CC=gcc$(VER)                                                                       
CXX=g++$(VER) 

# My Makevars file old
# These lines were recommended by data.table installation
# Could not install reshape2 package
CC=$(LLVM_LOC)/bin/clang -fopenmp                                                
CXX=$(LLVM_LOC)/bin/clang++ -fopenmp 

Hope this will help some user,
Naresh

From: David Winsemius <dwinsemius at comcast.net>
Sent: Tuesday, September 7, 2021 12:02 AM
To: Naresh Gurbuxani <naresh_gurbuxani at hotmail.com>
Cc: r-sig-mac at r-project.org Mac <r-sig-mac at r-project.org>
Subject: Re: [R-SIG-Mac] checking whether the C compiler works... no 
?
The?? C compiler aka clang is not the same as the C++ compiler. 

Why don?t you install the pre-compiled version.

? 
David

Sent from my iPhone
#
Before anyone actually follows this, the setup below is quite badly broken so this won't work on any normal Mac. Please do NOT set flags you don't understand even if you googled it somewhere. There is no need to modify Makevars (both versions below are bad - one is forcing locally installed clang the other gcc-11 presumably from Homebrew - neither is compatible with R releases). You should NEVER set CC/CXX in package's Makevars since the compilers have to match what R is using and R will automatically provide the correct setting, so overriding it will only break things.

Cheers,
Simon
#
Simon,

Thanks for your warning.  I have commented out all of my Makevars file and my R seems to be working fine.

As I mentioned, I simply followed the advice provide by data.table website.

Naresh