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

Compilation error on install for Mac #16

Open
geotheory opened this issue Mar 22, 2019 · 5 comments
Open

Compilation error on install for Mac #16

geotheory opened this issue Mar 22, 2019 · 5 comments

Comments

@geotheory
Copy link

Are you aware of this compile error for Mac users?

> devtools::install_github('dselivanov/LSHR', upgrade_dependencies = FALSE)
Downloading GitHub repo dselivanov/LSHR@master
from URL https://api.github.com/repos/dselivanov/LSHR/zipball/master
Installing LSHR
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore  \
  --quiet CMD INSTALL  \
  '/private/var/folders/_3/b8whcf8d1bb8w_lr2rrscb5m0000gp/T/RtmpFvV8j6/devtools80bc1545917a/dselivanov-LSHR-3231ad6'  \
  --library='/Library/Frameworks/R.framework/Versions/3.5/Resources/library' --install-tests 

* installing *source* package ‘LSHR’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -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.5/Resources/library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -Wall -g -O2 -c hash.cpp -o hash.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -Wall -g -O2 -c lsh.cpp -o lsh.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -Wall -g -O2 -c random_projection.cpp -o random_projection.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/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -o LSHR.so RcppExports.o hash.o lsh.o random_projection.o -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang: error: unsupported option '-fopenmp'
make: *** [LSHR.so] Error 1
ERROR: compilation failed for package ‘LSHR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/LSHR’
Installation failed: Command failed (1)

I'm running R 3.5.3 on macOS Movave 10.14.3. Can provide more env info if it helps. I ran brew upgrade llvm to v8.0.0 but no effect.

@dselivanov
Copy link
Owner

you need to install official R clang toolchain - https://cran.r-project.org/bin/macosx/tools/ and specify compiler in your ~/.R/Makevars. Something like CXX11=/usr/local/opt/llvm/bin/clang++ (change path to your clang)

Or clone repo and remove these lines from src/Makevars

PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_CXX11FLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)

@geotheory
Copy link
Author

That solved it, thanks :)

@tamerbio
Copy link

hi dselivanov
i could not find ~/.R/Makevars on my mac! is the name correct?
thanks much

@dselivanov
Copy link
Owner

dselivanov commented Mar 23, 2022 via email

@tamerbio
Copy link

I am trying to install Shaman package from the source using:
install_local("~/Desktop/shaman-master.zip")
but getting this error:

* installing *source* package ‘shaman’ ...
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c ContactShuffler.cpp -o ContactShuffler.o
ContactShuffler.cpp:34:4: warning: field 'm_decay_smooth' will be initialized after field 'm_regularization' [-Wreorder-ctor]
   m_decay_smooth(decay_smooth),
   ^
1 warning generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c GenomeGridLog.cpp -o GenomeGridLog.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c Parser.cpp -o Parser.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c Random.cpp -o Random.o
In file included from Random.cpp:1:
./Random.h:17:16: error: unknown type name 'uint'; did you mean 'int'?
        static uint bits_data;
               ^~~~
               int
./Random.h:22:16: error: unknown type name 'uint'; did you mean 'int'?
        static uint bits();
               ^~~~
               int
./Random.h:23:16: error: unknown type name 'uint'; did you mean 'int'?
        static uint bits(int num);
               ^~~~
               int
./Random.h:32:8: error: unknown type name 'uint'; did you mean 'int'?
inline uint Random::bits() {
       ^~~~
       int
./Random.h:33:9: error: use of undeclared identifier 'uint'; did you mean 'int'?
        uint raw = mrand48();
        ^~~~
        int
Random.cpp:5:14: error: redefinition of 'bits_data' with a different type: 'uint' (aka 'unsigned int') vs 'int'
uint Random::bits_data = 0;
             ^
./Random.h:17:21: note: previous declaration is here
        static uint bits_data;
                    ^
Random.cpp:88:14: error: return type of out-of-line definition of 'Random::bits' differs from that in the declaration
uint Random::bits(int num) {
~~~~         ^
./Random.h:23:21: note: previous declaration is here
        static uint bits(int num);
               ~~~~ ^
7 errors generated.
make: *** [Random.o] Error 1
ERROR: compilation failed for package ‘shaman’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/shaman’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/tz/vb7vv98d2_bfq_t4zbrypvl40000gn/T//RtmpZUUjvc/remotes119d76ed0b5/shaman-master’ had non-zero exit status

could you may be help!
many many thanks

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

3 participants