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

Error in Installing Harmony in Rstudio #113

Open
aimer-entropy opened this issue Dec 2, 2020 · 9 comments
Open

Error in Installing Harmony in Rstudio #113

aimer-entropy opened this issue Dec 2, 2020 · 9 comments

Comments

@aimer-entropy
Copy link

Hello, I'm trying to install harmony through these two ways:
library(devtools)
install_github("immunogenomics/harmony")
install_local('mypathway/harmony-master.zip')
While all these two way to install this package failed.
I'm using Rstuidio 4.0.2 on maxOS Catalina Version 10.15.

Here's the information when I failed to install.

  • installing source package ‘harmony’ ...
    ** using staged installation
    ** libs
    clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppProgress/include' -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
    In file included from RcppExports.cpp:4:
    In file included from ./harmony_types.h:1:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo:21:
    /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_check.hpp:50:4: error: "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo"
    #error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo"
    ^
    In file included from RcppExports.cpp:4:
    In file included from ./harmony_types.h:1:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49:
    In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo:85:
    /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:149:12: error: unknown type name 'constexpr'
    static constexpr bool is_row = false;
    ^
    /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:149:22: error: expected member name or ';' after declaration specifiers
    static constexpr bool is_row = false;

/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:150:12: error: unknown type name 'constexpr'
static constexpr bool is_col = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:150:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_col = false;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:151:12: error: unknown type name 'constexpr'
static constexpr bool is_xvec = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:151:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_xvec = false;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:161:12: error: unknown type name 'constexpr'
static constexpr bool is_row = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:161:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_row = false;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:162:12: error: unknown type name 'constexpr'
static constexpr bool is_col = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:162:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_col = false;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:163:12: error: unknown type name 'constexpr'
static constexpr bool is_xvec = true;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:163:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_xvec = true;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:173:12: error: unknown type name 'constexpr'
static constexpr bool is_row = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:173:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_row = false;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:174:12: error: unknown type name 'constexpr'
static constexpr bool is_col = true;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:174:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_col = true;
~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:175:12: error: unknown type name 'constexpr'
static constexpr bool is_xvec = false;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:175:22: error: expected member name or ';' after declaration specifiers
static constexpr bool is_xvec = false;
~~~~~~~~~~~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘harmony’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/harmony’
    Error: Failed to install 'harmony-master.zip' from local:
    (converted from warning) installation of package ‘/var/folders/vh/npjhcwzj3hq7jbl_7xl382jh0000gn/T//RtmpAGjRdD/remotes6190459000ff/harmony-master’ had non-zero exit status
@julia-kraus
Copy link

I have the same problem installing the forecast package on MacOs Big Sur.

@dannyconrad
Copy link

dannyconrad commented Dec 16, 2020

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using
RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

@Yunxiu123
Copy link

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using
RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

Thanks a lot. This works fine to me with the same installation problems.

@kengel001
Copy link

@aimer-entropy @julia-kraus

I had the exact same issue that the above install of an older RcppArmadillo corrected. However, I'll add a nuance here. I tried the default harmony install on two separate machines. They both had RcppArmadillo 10.1.2, it worked on one and not on the other. They both have the same version of gcc, but I suspect that there was an issue with the one it did not work on with the correct compiler being defaulted to by R. Or perhaps it's a clang version issue?

And yes, defaulting back to the updated version of RccpArmadillo after install worked just fine.

@JarvanDi
Copy link

JarvanDi commented Mar 1, 2021

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using
RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

Thanks,it really works.

@ostkampp
Copy link

I had a similar Issue on macOS 11.1 Big Sur and couldn't get the Armadillo downgrade working. I then followed the error code which tells you to enable C++11 compiling mode. Following this tutorials https://gallery.rcpp.org/articles/first-steps-with-C++11/ first line of code did the trick for me:

Sys.setenv("PKG_CXXFLAGS"="-std=c++11")

@elva0328
Copy link

@pseudonym2 thank you so much, your advice did works.

@dportelacassab
Copy link

I get this problem after trying to compile a simple method including RcppArmadillo.h
I'm on a mac os Big sure, any help, please.

In file included from trying.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
SEXP data = Parent::get__();
^
1 warning generated.
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_24.so] Error 1
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include" -I"/Applications/Diego Alejandro/2021-2 (Internship)/c++Projects/src1" -I/usr/local/include -std=c++11 -fPIC -Wall -g -O2 -c trying.cpp -o trying.o
clang++ -mmacosx-version-min=10.13 -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 sourceCpp_24.so trying.o -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-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in Rcpp::sourceCpp("/Applications/Diego Alejandro/2021-2 (Internship)/c++Projects/src1/trying.cpp") :
Error 1 occurred building shared library.

@ilyakorsunsky
Copy link
Collaborator

Dear all,

Harmony is now available on CRAN! Please try to install through install.packages("harmony"). I hope this makes the process more painless and you can get back to your analyses faster.

Cheers,
Ilya

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

10 participants