Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation issue: ld: library not found for -lquadmath #262

Closed
angieshen6 opened this issue Jul 16, 2019 · 19 comments
Closed

installation issue: ld: library not found for -lquadmath #262

angieshen6 opened this issue Jul 16, 2019 · 19 comments

Comments

@angieshen6
Copy link

After downloading R.3.6.1, I can no longer install RcppArmadillo. I have Mac OS X El Capitan 10.11.5. I downloaded gfortran 6.1, clang-7 and Xcode following the instructions on here [(https://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-macos/)] but received the following messages:

`=================================================
downloaded 1.3 MB

  • installing source package ‘RcppArmadillo’ ...
    ** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
    ** using staged installation
    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++ -std=gnu++11 accepts -g... yes
    checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
    checking whether we are using the GNU C++ compiler... (cached) yes
    checking whether clang++ -std=gnu++11 accepts -g... (cached) yes
    checking whether g++ version is sufficient... almost
    configure: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++.
    checking for macOS... found
    checking for macOS Apple compiler... not found
    checking for clang compiler... found
    checking for OpenMP compatible version of clang... found and suitable
    checking LAPACK_LIBS... R-supplied partial LAPACK found
    configure: WARNING: Some complex-valued LAPACK functions may not be available
    checking for OpenMP... found and suitable
    configure: creating ./config.status
    config.status: creating inst/include/RcppArmadilloConfigGenerated.h
    config.status: creating src/Makevars
    ** libs
    clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC -Wall -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o
    clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
    clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC -Wall -g -O2 -c fastLm.cpp -o fastLm.o
    clang++ -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/usr/local/lib -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
    ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
    ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
    ld: library not found for -lquadmath
    clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [RcppArmadillo.so] Error 1
    ERROR: compilation failed for package ‘RcppArmadillo’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo’
    Warning in install.packages :
    installation of package ‘RcppArmadillo’ had non-zero exit status`
@coatless
Copy link
Contributor

coatless commented Jul 16, 2019

Type in R:

Sys.getenv("PATH")

Place the results in this issue.

I don't think that the gfortran binary was correctly installed.

@angieshen6
Copy link
Author

Sys.getenv("PATH")
[1] "/usr/local/clang7/bin:/usr/local/clang7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin"

@coatless
Copy link
Contributor

Can you try installing the gfortran 6.1 binary again?

https://cran.r-project.org/bin/macosx/tools/gfortran-6.1.pkg

@angieshen6
Copy link
Author

Received these messages after reinstallation:

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++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether clang++ -std=gnu++11 accepts -g... (cached) yes
checking whether g++ version is sufficient... almost
configure: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++.
checking for macOS... found
checking for macOS Apple compiler... not found
checking for clang compiler... found
checking for OpenMP compatible version of clang... found and suitable
checking LAPACK_LIBS... R-supplied partial LAPACK found
configure: WARNING: Some complex-valued LAPACK functions may not be available
checking for OpenMP... found and suitable
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloConfigGenerated.h
config.status: creating src/Makevars
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC  -Wall -g -O2  -c RcppArmadillo.cpp -o RcppArmadillo.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I../inst/include -fopenmp -fPIC  -Wall -g -O2  -c fastLm.cpp -o fastLm.o
clang++ -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/usr/local/lib -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: ___cxa_uncaught_exceptions
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘RcppArmadillo’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo’
Warning in install.packages :
  installation of package ‘RcppArmadillo’ had non-zero exit status

@eddelbuettel
Copy link
Member

So that addressed the 'missing Fortran library' but now it looks like a possible mismatch. Does the rest of your clang toolchain come from the same directory, ie https://cran.r-project.org/bin/macosx/tools/ ?

@eddelbuettel
Copy link
Member

FWIW CRAN still builds them fine https://cloud.r-project.org/web/checks/check_results_RcppArmadillo.html but has not yet gotten to the very fresh (uploaded yesterday) 0.9.600.4.0 release.

@dselivanov
Copy link

I think I run into similar issue yesterday when I was digging about rcnst issues in my rsparse pkg. I pulled rocker/drd and installed RcppArmadillo 0.9.600.4.0.

I got following error:

* installing *source* package ‘RcppArmadillo’ ...
** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
** using staged installation
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 g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ -std=gnu++11 accepts -g... (cached) yes
checking whether g++ version is sufficient... yes, with OpenMP as version 8.3.0
checking for macOS... checking LAPACK_LIBS... system LAPACK found
checking for OpenMP... found and suitable
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloConfigGenerated.h
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"  -I../inst/include -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppArmadillo.cpp -o RcppArmadillo.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"  -I../inst/include -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"  -I../inst/include -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c fastLm.cpp -o fastLm.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:6: RcppArmadillo.so] Error 1
ERROR: compilation failed for package ‘RcppArmadillo’
* removing ‘/usr/local/lib/R/site-library/RcppArmadillo’

The downloaded source packages are in
	‘/tmp/RtmpxJFa0T/downloaded_packages’
Warning message:
In install.packages("RcppArmadillo") :
  installation of package ‘RcppArmadillo’ had non-zero exit status

I didn't have time to debug, so I installed libopenblas-dev and issue gone. But I think problem remains (and just reproduced it locally)

@eddelbuettel
Copy link
Member

@dselivanov I am not sure how relevant that is. You are on a different operating system where we always needed BLAS because we have

edd@rob:~$ grep PKG_LIBS git/rcpparmadillo/src/Makevars.in 
PKG_LIBS= @OPENMP_FLAG@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
edd@rob:~$ 

But what does have to do with the OP's problem on macOS?

@dselivanov
Copy link

dselivanov commented Jul 16, 2019 via email

@angieshen6
Copy link
Author

@eddelbuettel I reinstalled clang-7 from that site and received the same error messages.

@eddelbuettel
Copy link
Member

@angieshen6 Beats me. I don't use or support macOS besides what CRAN requires. Plead with @coatless to help you or try the r-sig-mac mailing list.

@eddelbuettel
Copy link
Member

@dselivanov I still don't understand what that has to do with this issue ticket. Maybe you documented that rocker/drd is not RcppArmadillo ready because it is narrower but there is no bug in the RcppArmadillo package I can discern in your messages. It's early, and I only had four coffees so far so I may be missing something obvious though....

@dselivanov
Copy link

You are right, nothing to do with rcpparmadillo. False alarm

@eddelbuettel
Copy link
Member

No worries. Life is about trading off true and false positives :)

@coatless
Copy link
Contributor

@angieshen6

You might need to do a full reinstall once the correct toolchain is in use.

Try:

install.packages("RcppArmadillo", 
                 dependencies=TRUE,
                 repos="https://cloud.r-project.org")

@Fredo-XVII
Copy link

I was getting an error when installing the 'fable' package. But @coatless install code above did the trick to get 'RcppAmrmadillo' installed. Thanks!

@eddelbuettel
Copy link
Member

Closing this. Please tell the macOS maintainer for R to streamline his process. The package can only work when components are in places, and besides the package-level Depends:/Imports:/... we have no control over where and when. Hence also no ability to affect it.

@barracuda156
Copy link

I am getting the same error:

ld: warning: directory not found for option '-L/opt/local/Library/Frameworks/R.framework/Resources/libppc'
ld: library not found for -lquadmath

Is there a solution?

@eddelbuettel
Copy link
Member

@barracuda156 This is, I think, the third repo I see you use for your questions about your (if I dare say, somewhat non-standard) setup. Can you maybe get some help from people using the os and hardware combination, maybe via the r-sig-mac list? We don't use it -- and the software we provide works everywhere else (where we can test it too) so we cannot help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants