bnprks / BPCells

Scaling Single Cell Analysis to Millions of Cells
https://bnprks.github.io/BPCells
Other
166 stars 17 forks source link

Installation issue: fatal error: 'hwy/highway.h' file not found #148

Closed korMichi closed 3 weeks ago

korMichi commented 3 weeks ago

Dear @bnprks, Thank you for developing and maintaining BPCells. I would love to use this package but I have run into installation problems on my Mac (MacBook Air M2 Chip, macOS Sequoia v.15.0.1). I have checked the previous issues on ARM and x86 with hdf5 and have followed the outlined steps. However, during installation I receive the following error message:

Details

Using github PAT from envvar GITHUB_PAT. Use `gitcreds::gitcreds_set()` and unset GITHUB_PAT in .Renviron (or elsewhere) if you want to use the more secure git credential store instead. Downloading GitHub repo bnprks/BPCells@HEAD ── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/private/var/folders/7r/0ywp29g16sddjjnpx2z7jcm00000gp/T/RtmpnJCyq6/remotesa87318616258/bnprks-BPCells-334f172/r/DESCRIPTION’ ... ─ preparing ‘BPCells’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts (473ms) ─ checking for empty or unneeded directories ─ building ‘BPCells_0.2.0.tar.gz’ * installing *source* package ‘BPCells’ ... ** using staged installation + ENABLE_INSTALL_COUNTING=yes + '[' -n yes ']' + curl --silent https://plausible.benparks.net/flask-plausible/bpcells-configure ++ /Library/Frameworks/R.framework/Resources/bin/R CMD config CC + CC='clang -arch arm64' ++ /Library/Frameworks/R.framework/Resources/bin/R CMD config CXX + CXX='clang++ -arch arm64 -std=gnu++17' + ENV_CFLAGS=-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include + ENV_LDFLAGS=-L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib ++ /Library/Frameworks/R.framework/Resources/bin/R CMD config CFLAGS + CFLAGS='-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include' ++ /Library/Frameworks/R.framework/Resources/bin/R CMD config CXXFLAGS + CXXFLAGS='-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include' ++ /Library/Frameworks/R.framework/Resources/bin/R CMD config LDFLAGS + LDFLAGS='-L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib' + echo 'Testing hdf5 by compiling example program...' Testing hdf5 by compiling example program... + HDF5_CFLAGS= + HDF5_LIBS=-lhdf5 + HDF5_OK= + clang -arch arm64 tools/h5write.c -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -lhdf5 -o tools/h5write + HDF5_OK=yes + '[' -z yes ']' + '[' -z yes ']' + '[' -z yes ']' + '[' -z yes ']' + echo 'Found working hdf5' Found working hdf5 + echo 'HDF5_CFLAGS='\'''\''' HDF5_CFLAGS='' + echo 'HDF5_LIBS='\''-lhdf5'\''' HDF5_LIBS='-lhdf5' + CXX17_OK= + CXX_FS_FLAG= + printf '\nTesting C++17 filesystem feature support...' Testing C++17 filesystem feature support...+ clang++ -arch arm64 -std=gnu++17 tools/cxx17_filesystem.cc -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -std=c++17 -o tools/cxx17_filesystem + CXX17_OK=yes + '[' -z yes ']' + '[' -z yes ']' + '[' -z yes ']' + printf '\nTesting availability of highway SIMD library...' Testing availability of highway SIMD library...+ HWY_OK= + HWY_CFLAGS=-Ibpcells-cpp + HWY_LIBS=-lhwy + clang++ -arch arm64 -std=gnu++17 tools/hwy-test.cpp -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib tools/hwy-test.cpp:1:10: fatal error: 'hwy/highway.h' file not found #include ^~~~~~~~~~~~~~~ 1 error generated. + '[' -z ']' + '[' '!' -f tools/highway/lib/libhwy.a ']' + printf '\nBuilding highway SIMD library from source\n' Building highway SIMD library from source + CXX='clang++ -arch arm64 -std=gnu++17' + bash src/vendor/highway/manual-build/build_highway.sh src/vendor/highway tools/highway + HWY_OK=yes + HWY_CFLAGS='-Ibpcells-cpp -I../tools/highway/include' + HWY_LIBS='-L../tools/highway/lib -lhwy' + '[' -z yes ']' + sed -e 's|%HDF5_CFLAGS%||g' -e 's|%HDF5_LIBS%|-lhdf5|g' -e 's|%CXX_FS_FLAG%||g' -e 's|%HWY_CFLAGS%|-Ibpcells-cpp -I../tools/highway/include|g' -e 's|%HWY_LIBS%|-L../tools/highway/lib -lhwy|g' -e 's|%ENV_CFLAGS%|-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include|g' -e 's|%ENV_LDFLAGS%|-L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib|g' src/Makevars.in + '[' -n yes ']' + curl --silent https://plausible.benparks.net/flask-plausible/bpcells-configure-success ** libs using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’ using SDK: ‘’ clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include -Ibpcells-cpp -I../tools/highway/include -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -Ivendor -std=c++17 -DRCPP_EIGEN -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -Wno-ignored-attributes -Wno-unknown-pragmas -fPIC -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -c bitpacking_io.cpp -o bitpacking_io.o bitpacking_io.cpp:259:51: error: no matching function for call to 'min' uint64_t loaded = reader.load(output + i, std::min(chunk_size, capacity-i)); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__algorithm/min.h:35:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('uint64_t' (aka 'unsigned long long') vs. 'size_t' (aka 'unsigned long')) min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__algorithm/min.h:43:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'uint64_t' (aka 'unsigned long long') min(initializer_list<_Tp> __t, _Compare __comp) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__algorithm/min.h:48:86: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__algorithm/min.h:29:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { ^ 1 error generated. make: *** [bitpacking_io.o] Error 1 ERROR: compilation failed for package ‘BPCells’ * removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/BPCells’ Warnmeldung: In i.p(...) : Installation des Pakets ‘/var/folders/7r/0ywp29g16sddjjnpx2z7jcm00000gp/T//RtmpnJCyq6/filea873139569df/BPCells_0.2.0.tar.gz’ hatte Exit-Status ungleich 0

R session info:

Details

R version 4.4.1 (2024-06-14) Platform: aarch64-apple-darwin20 Running under: macOS 15.0.1 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0 locale: [1] C/UTF-8/C/C/C/C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] processx_3.8.4 compiler_4.4.1 R6_2.5.1 cli_3.6.3 tools_4.4.1 [6] curl_5.2.3 remotes_2.5.0 desc_1.4.3 callr_3.7.6 ps_1.7.7 [11] pkgbuild_1.4.4

Makevars:

Details

CFLAGS=-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include CXXFLAGS=-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include LDFLAGS = -L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib

It seems that hdf5 is found however highway is not. I have tried installing highway through homebrew but I still get the error. I do not know how to change the Makevars File to point to highway. I would really appreciate your help. Thank you for your time! Best wishes

bnprks commented 3 weeks ago

Hi @korMichi, I think this is actually a duplicate of issue #140. We have a fix in pull request #141, which is not yet merged into main but as a workaround you can run remotes::install_github("bnprks/BPCells/r", ref="bp/mac-build-fix"). It will hopefully be merged in soon so you won't need the ref argument.

The highway error you see is just a test compilation and the BPCells install will build a copy of highway from source if its first attempt fails. I think the relevant error here is the line error: no matching function for call to 'min'.

korMichi commented 3 weeks ago

Running it with the suggest command fixed the issue for me. Thank you so much for your quick help!

bnprks commented 3 weeks ago

Just a quick update #141 is merged into main, so future installs shouldn't need the ref="bp/mac-build-fix"