1

I have been trying to install the harmony package for R, but cannot. Here are the errors:

> install. Packages("harmony")

  There is a binary version available but the source version is later:
        binary source needs_compilation
harmony  0.1.0  0.1.1              TRUE


Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes


installing the source package ‘harmony’

trying URL 'https://cran.rstudio.com/src/contrib/harmony_0.1.1.tar.gz'
Content type 'application/x-gzip' length 1351250 bytes (1.3 MB)
==================================================

downloaded 1.3 MB


* installing *source* package ‘harmony’ ...
** package ‘harmony’ successfully unpacked and MD5 sums checked
** using staged installation
** libs

clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppProgress/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -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.2-arm64/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include/RcppCommon.h:168:
/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include/Rcpp/internal/r_coerce.h:255:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    ::sprintf(buff, "%02x", from);
      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 warning generated.
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppProgress/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c harmony.cpp -o harmony.o
In file included from harmony.cpp:1:
In file included from ./harmony.h:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include/RcppCommon.h:168:
/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include/Rcpp/internal/r_coerce.h:255:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    ::sprintf(buff, "%02x", from);
      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 warning generated.
clang++ -arch arm64 -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/opt/R/arm64/lib -o harmony.so RcppExports.o harmony.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lquadmath -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [harmony.so] Error 1
ERROR: compilation failed for package ‘harmony’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/harmony’
Warning in install.packages :
  installation of package ‘harmony’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/vv/kfqy3z8d70z_7w2t399bt80w0000gn/T/RtmpzuHWlG/downloaded_packages’

I have also tried to install from other source here: Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no

I also tried to manually download the package from the archive and install it, but that did not work.

But no success.

If anyone can help, please :)

Isaiah
  • 2,091
  • 3
  • 19
  • 28
Sinatra
  • 11
  • 1
  • 1
    The error says you don't have the `gfortran` library, suggesting you don't have Fortran installed, not installed _correctly_, or something else about it is broken. I suggest you look at https://cran.r-project.org/bin/macosx/tools/ (and/or https://mac.r-project.org/tools/) and make sure that it is installed correctly. (Disclaimer: I don't have a mac, and I'm no expert in Fortran.) – r2evans Nov 18 '22 at 12:57
  • Thanks for the comment ! The gfortran is also installed and updated, but this specific package is not being installed. – Sinatra Nov 18 '22 at 13:13
  • It maybe that you need to reinstall xcode. I've seen a couple resolved by this recently. – Isaiah Nov 18 '22 at 13:14
  • I don't know what to say. The warnings/errors clearly say `warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'` and `library not found for -lgfortran`, which means they are not installed, not found, or broken. – r2evans Nov 18 '22 at 13:17
  • Best to assume `gfortran` not installed, and at worst, if installed and broken, will be overwritten by newer version, possibly. And mine not mac either. – Chris Nov 18 '22 at 13:29
  • 1
    You can try installing the binary rather than trying to build from source: `install.packages("harmony", type="binary")` – MrFlick Nov 18 '22 at 14:38
  • I tried reinstalling Xcode and gfortran, no success. I also tried install.packages("harmony", type="binary"), didn't work: > install.packages("harmony", type="binary") ********** Warning in install.packages : cannot open URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.2/harmony_0.1.0.tgz': HTTP status was '404 Not Found' Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.2/harmony_0.1.0.tgz' Warning in install.packages : download of package ‘harmony’ failed – Sinatra Nov 18 '22 at 14:58
  • maybe the package is removed from cran – Sinatra Nov 18 '22 at 14:58
  • But I downloaded the package from archive and did not work either – Sinatra Nov 18 '22 at 14:59
  • nope, it's [on CRAN](https://cran.r-project.org/web/packages/harmony/index.html); a possible workaround is to use Posit's binary-package repository, see https://packagemanager.rstudio.com/client/#/repos/2/packages/harmony (and the neighboring docs for how to use that in place of CRAN for your package repo). (Note the "distribution" selector in the top-right of the web page that lets you define your OS, "macOS" is an option.) – r2evans Nov 18 '22 at 15:00
  • I also tried Posit's binary-package, but exactly same error. – Sinatra Nov 18 '22 at 15:18
  • Did you try @MrFlick's suggestion, or answering "no" when asked if you want to install from source? – Ben Bolker Nov 18 '22 at 16:01
  • 1
    Yes, I tried that one also and did not work. – Sinatra Nov 19 '22 at 09:20

0 Answers0