grimbough / Rhdf5lib

Distribution of the HDF5 library in an R package
https://bioconductor.org/packages/Rhdf5lib/
6 stars 14 forks source link

Rhdf5lib failed to install on M1 Mac OS X #45

Closed lijinbio closed 1 year ago

lijinbio commented 2 years ago

Hi all,

I tried to install Rhdf5lib on M1 Mac OS X, but failed with the below error message. Could you please help suggest how could I install Rhdf5lib on M1? My Mac OS version is 12.3.1. Thanks.

> BiocManager::install("Rhdf5lib")
Bioconductor version 3.15 (BiocManager 1.30.17), R 4.2.0 (2022-04-22)
Installing package(s) 'Rhdf5lib'
trying URL 'https://bioconductor.org/packages/3.15/bioc/src/contrib/Rhdf5lib_1.18.0.tar.gz'
Content type 'application/x-gzip' length 14649340 bytes (14.0 MB)
==================================================
downloaded 14.0 MB

* installing *source* package ‘Rhdf5lib’ ...
** using staged installation
checking for gcc... clang
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 accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++14 accepts -g... yes
COMPILER = clang
checking whether C compiler accepts -w... yes
checking whether to use -Wl,-rpath setting... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /opt/homebrew/opt/grep/libexec/gnubin/grep
checking for egrep... /opt/homebrew/opt/grep/libexec/gnubin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for zlib.h... yes
checking szlib.h usability... yes
checking szlib.h presence... yes
checking for szlib.h... yes
checking libaec.h usability... yes
checking libaec.h presence... yes
checking for libaec.h... yes
checking for SZ_BufftoBuffCompress in -lsz... yes
checking for aec_buffer_encode in -lsz... yes
checking curl/curl.h usability... yes
checking curl/curl.h presence... yes
checking for curl/curl.h... yes
checking openssl/evp.h usability... no
checking openssl/evp.h presence... no
checking for openssl/evp.h... no
checking openssl/hmac.h usability... no
checking openssl/hmac.h presence... no
checking for openssl/hmac.h... no
checking openssl/sha.h usability... no
checking openssl/sha.h presence... no
checking for openssl/sha.h... no
S3_VFD=--enable-ros3-vfd=no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gunzip -dc hdf5small_cxx_hl_1.10.7.tar.gz | tar xf -;
cd hdf5; \
    ./configure --with-pic --enable-shared=no --enable-cxx --enable-hl \
    --enable-tests=no --enable-tools=no \
    --with-szlib=yes --with-zlib=yes \
    --enable-ros3-vfd=no \
    --enable-sharedlib-rpath \
    CC='clang' CXX='clang++ -std=gnu++14' \
    CPPFLAGS='-I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include' \
    CFLAGS='-Wno-implicit-function-declaration -w -fPIC' \
    CXXFLAGS='-w -g -O2 -fPIC'; \
    make lib
checking for a BSD-compatible install... /opt/homebrew/opt/coreutils/libexec/gnubin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/homebrew/opt/coreutils/libexec/gnubin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... Invalid configuration `arm64-apple-darwin21.4.0': machine `arm64-apple' not recognized
configure: error: /bin/sh bin/config.sub arm64-apple-darwin21.4.0 failed
sh configure
checking for a BSD-compatible install... /opt/homebrew/opt/coreutils/libexec/gnubin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/homebrew/opt/coreutils/libexec/gnubin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... Invalid configuration `arm64-apple-darwin21.4.0': machine `arm64-apple' not recognized
configure: error: /bin/sh bin/config.sub arm64-apple-darwin21.4.0 failed
make[1]: *** [_config] Error 1
make: *** [build-hdf5] Error 2
ERROR: compilation failed for package ‘Rhdf5lib’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/Rhdf5lib’
grimbough commented 2 years ago

This message is coming from the HDF5 librariy's own configure script, which I suspect means this version of the library is incompatible with M1 mac for the moment.

I'd suggest continuing using the Intel version of R and running with Rosetta. As far as I understand there's very little performance difference between the two, and you'll also be able to use the binary version of Bioconductor packages which should make installation much quicker and easier.

akhst7 commented 2 years ago

This issue has not been solved as of today. HDF5 lib is complied in M1/arm64 Mac by brew as follows;

brew list hdf5                                                             
/opt/homebrew/Cellar/hdf5/1.12.2/bin/gif2h5
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h52gif
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5c++
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5cc
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5clear
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5copy
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5debug
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5diff
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5dump
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5fc
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5format_convert
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5import
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5jam
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5ls
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5mkgrp
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5perf_serial
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5redeploy
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5repack
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5repart
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5stat
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5unjam
/opt/homebrew/Cellar/hdf5/1.12.2/bin/h5watch
/opt/homebrew/Cellar/hdf5/1.12.2/include/ (119 files)
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5_cpp.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5_fortran.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5_hl.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5_hl_cpp.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/libhdf5hl_fortran.200.dylib
/opt/homebrew/Cellar/hdf5/1.12.2/lib/ (13 other files)
/opt/homebrew/Cellar/hdf5/1.12.2/share/hdf5/libhdf5.settings
/opt/homebrew/Cellar/hdf5/1.12.2/share/hdf5_examples/ (108 files)

and a path to HDF5 lib is set;

echo $HDF5_DIR                                                                                        
/opt/homebrew/opt/hdf5

but I still get a configure error as follows;

configure: error: in `/private/var/folders/sl/253njlzx5797z3x9nlhrs79m0000gn/T/RtmpJBlBhW/R.INSTALL90fb5668ab60/Rhdf5lib/src/hdf5':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** [_config] Error 77
make: *** [build-hdf5] Error 2

This is mostlikely due to the fact that hdf5 in Rhdf5lib is not written for arm64e but x86_64 ? Is it possible to compile Rhdf5lib with the preinstall hdf5 lib rather than Rhdf5lib's install script tries to install hdf5 lib that comes with it ?

Rhdf5lib is such an important dependency for dozens of Bioc packages, and without it I can't install them. I would really appreciate if you could look into this ?

Thanks.

hsiaoyi0504 commented 2 years ago

@grimbough I have the same question ....

grimbough commented 2 years ago

Can you use the pre-built M1 binary now provided by Bioconductor? The are only available for Bioconductor 3.16 for now (https://bioconductor.org/packages/devel/bioc/html/Rhdf5lib.html) so you might need to force installation if you're not using the developmental version of Bioconductor. I think you should be able to do that with:

install.packages('https://bioconductor.org/packages/devel/bioc/bin/macosx/big-sur-arm64/contrib/4.2/Rhdf5lib_1.19.2.tgz', repos = NULL)
akhst7 commented 1 year ago

A binary version is working.

Thanks.