bnprks / BPCells

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

error install BPCells, no matching function for call to 'min' #140

Closed hpsunlearning closed 3 weeks ago

hpsunlearning commented 1 month ago

I am trying to install BPCells on a Mac M1, and I figured out how to fix the hdf5 issue but another error popped out. has anyone encountered the same issue?

bitpacking_io.cpp:259:51: error: no matching function for call to 'min' 259 | uint64_t loaded = reader.load(output + i, std::min(chunk_size, capacity-i));

error output > remotes::install_github("bnprks/BPCells/r") Downloading GitHub repo bnprks/BPCells@HEAD ── R CMD build─────────────────────────────────────────────────── ✔ checking for file ‘/private/var/folders/cs/lcn8f90s0jg124ff3y1twlkr0000gn/T/Rtmpr2SRhI/remotes117b9e6a9c9/bnprks-BPCells-fd72cb1/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 ─ checking for empty or unneeded directories ─ building ‘BPCells_0.2.0.tar.gz’ * installing *source* package ‘BPCells’ ... ** using staged installation Testing hdf5 by compiling example program... Retrying with pkg-config flags... Found working hdf5 HDF5_CFLAGS='-I/opt/homebrew/Cellar/hdf5/1.14.4.3/include' HDF5_LIBS='-L/opt/homebrew/Cellar/hdf5/1.14.4.3/lib -lhdf5' Testing C++17 filesystem feature support... Testing availability of highway SIMD library... Building highway SIMD library from source ** libs using C++ compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.3)’ using SDK: ‘MacOSX15.0.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 -I/opt/homebrew/Cellar/hdf5/1.14.4.3/include -Ibpcells-cpp -I../tools/highway/include -I/opt/homebrew/Cellar/hdf5/1.14.4/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/include -c bitpacking_io.cpp -o bitpacking_io.o bitpacking_io.cpp:259:51: error: no matching function for call to 'min' 259 | uint64_t loaded = reader.load(output + i, std::min(chunk_size, capacity-i)); | ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX.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')) 35 | min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.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') 43 | min(initializer_list<_Tp> __t, _Compare __comp) { | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.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 48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) { | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/min.h:29:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided 29 | 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’
bnprks commented 1 month ago

Hi @hpsunlearning, I just became aware of this issue yesterday. It looks like a recent change I pushed broke installation on Macs for a boring C++ reason (size_t and uint64_t are different types on Mac OS but the same type on linux/windows).

I should have a fix created later today, and I'll also try setting up some github actions automation to avoid accidentally breaking Mac builds in the future.

bnprks commented 3 weeks ago

Just a quick update here: We have a fix in pull request https://github.com/bnprks/BPCells/pull/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")

bnprks commented 3 weeks ago

141 is now merged, so I believe this issue should be fixed with a normal BPCells install from github. Please comment and @ mention me if there's still something wrong.

hpsunlearning commented 3 weeks ago

Thanks. Now I can install it without issue.

Tfirulli commented 2 weeks ago

Hi I just wanted to add that I was having problems loading BPCells and the solution was rather than adding the install code through R-studio terminal, I used my MAC terminal program running an R shell. It is not clear to me as to why this worked but the errors I was getting though RS (missing hdf5r.h file) was resolved.