dselivanov / LSHR

Locality Sensitive Hashing In R
Other
41 stars 13 forks source link

Compilation error on install for Mac #16

Open geotheory opened 5 years ago

geotheory commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

That solved it, thanks :)

tamerbio commented 2 years ago

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

dselivanov commented 2 years ago

You might need to create it

On Wed, 23 Mar 2022, 13:14 tamerbio, @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/dselivanov/LSHR/issues/16#issuecomment-1076129762, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHC5XPQ73JX3Y4CGTC7FZDVBLOIJANCNFSM4HAOHD6Q . You are receiving this because you commented.Message ID: @.***>

tamerbio commented 2 years ago

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