kogalur / randomForestSRC

DOCUMENTATION:
https://www.randomforestsrc.org/
GNU General Public License v3.0
119 stars 18 forks source link

installation problem with macOS 10.15.3 (Catalina) #66

Closed thierrygosselin closed 4 years ago

thierrygosselin commented 4 years ago

Using R CMD INSTALL --preclean --clean randomForestSRC I get this error:

Error: package or namespace load failed for ‘randomForestSRC’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-randomForestSRC/00new/randomForestSRC/libs/randomForestSRC.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-randomForestSRC/00new/randomForestSRC/libs/randomForestSRC.so, 6): Library not loaded: @rpath/libomp.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-randomForestSRC/00new/randomForestSRC/libs/randomForestSRC.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/randomForestSRC’

Note below that everything else mostly works (it's not the first time I do this, and it use to work before), and openmp is supported:

checking for /usr/local/bin/gcc option to support OpenMP... -fopenmp

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
* installing *source* package ‘randomForestSRC’ ...
** package ‘randomForestSRC’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... /usr/local/bin/gcc
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 /usr/local/bin/gcc accepts -g... yes
checking for /usr/local/bin/gcc option to accept ISO C89... none needed
checking for /usr/local/bin/gcc option to support OpenMP... -fopenmp
configure: creating ./config.status
config.status: creating src/Makevars
** libs
/usr/local/bin/gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c R_init_randomForestSRC.c -o R_init_randomForestSRC.o
/usr/local/bin/gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c randomForestSRC.c -o randomForestSRC.o
randomForestSRC.c: In function 'classificationAreaUnderROCSplit':
randomForestSRC.c:9074:10: warning: 'sLen' may be used uninitialized in this function [-Wmaybe-uninitialized]
 9074 |     uint sLen;
      |          ^~~~
/usr/local/bin/gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c splitCustom.c -o splitCustom.o
/usr/local/bin/gcc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o randomForestSRC.so R_init_randomForestSRC.o randomForestSRC.o splitCustom.o -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-randomForestSRC/00new/randomForestSRC/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location

INFO for reproducibility:

> devtools::session_info()                
 version  R version 3.6.3 (2020-02-29)
 os       macOS Catalina 10.15.3      
 system   x86_64, darwin15.6.0        

gcc version: gcc version 9.2.0 (GCC) Makevars:

CC=/usr/local/bin/gcc
CXX=/usr/local/bin/g++
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
PKG_CFLAGS= -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp
PKG_CXXFLAGS=-fopenmp -std=c++11
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
LDFLAGS=-L/usr/local/lib

Sys.getenv("LD_LIBRARY_PATH")

[1] "/usr/local/lib/"
thierrygosselin commented 4 years ago

Problem was fixed by adding PKG_LIBS = "-liconv" to the ~/.R/Makevars file:

CC=/usr/local/bin/gcc
CXX=/usr/local/bin/g++
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
PKG_CFLAGS= -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp
PKG_CXXFLAGS=-fopenmp -std=c++11
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
LDFLAGS=-L/usr/local/lib
PKG_LIBS = "-liconv"