jinworks/CellChat

fail to install cellChat with install_github() and error: didn't find libc++ <stddef.h> header

Closed this issue · 1 comments

Hello,

I met a problem when I install cellChat,

The command and error says:

> devtools::install_github("jinworks/CellChat", auth_token ="my_token")
Downloading GitHub repo jinworks/CellChat@HEAD
Skipping 3 packages not available: Biobase, BiocNeighbors, BiocGenerics
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/sz/11cq81sn0fz63sx0cyn6k3kc0000gn/T/Rtmpqr6OqF/remotes40cc372d5308/jinworks-CellChat-f6aa85d/DESCRIPTION’ ...
─  preparing ‘CellChat’:
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘CellChat_2.1.2.tar.gz’

* installing *source* package ‘CellChat’ ...
** using staged installation
** 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    -fPIC  -falign-functions=64 -Wall -g -O2   -c CellChat_Rcpp.cpp -o CellChat_Rcpp.o

In file included from CellChat_Rcpp.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigenForward.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/iterator:679:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/access.h:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstddef:46:5: error: <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
#   error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header. \
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstddef:59:9: error: no member named 'nullptr_t' in the global namespace
using ::nullptr_t;
      ~~^
In file included from CellChat_Rcpp.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigenForward.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/iterator:680:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/advance.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/concepts.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__concepts/constructible.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__concepts/destructible.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_nothrow_destructible.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_scalar.h:17:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:26:28: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:26:28: error: template argument for template type parameter must be a type
struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                           ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:23:17: note: template parameter is declared here
template <class _Tp>
                ^
In file included from CellChat_Rcpp.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigen.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/RcppEigen/include/RcppEigenForward.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/iterator:680:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/advance.h:26:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/limits:827:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/type_traits:508:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/is_trivially_copyable.h:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstdint:149:5: error: <cstdint> tried including <stdint.h> but didn't find libc++'s <stdint.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
#   error <cstdint> tried including <stdint.h> but didn't find libc++'s <stdint.h> header. \
    ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [CellChat_Rcpp.o] Error 1
ERROR: compilation failed for package ‘CellChat’
* removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/CellChat’

Warning message:
In i.p(...) :
  installation of package ‘/var/folders/sz/11cq81sn0fz63sx0cyn6k3kc0000gn/T//RtmpyrrtHw/file6bde760d9a97/CellChat_2.1.2.tar.gz’ had non-zero exit status

Please see above! have confirmed that I am using an M2 MacOS chip and R 4.4.1 [arm]
Anyone knows why it happens?
Thanks a lot!

I finally figured out the problem, my MacBook there were multiple versions of this SDK installed (MacOSX13.3, MacOSX13, MacOSX14, MacOSX14.5)

#search used version of sdk
xcrun --show-sdk-path

#cd to SDK file for listing all I have version
cd /Library/Developer/CommandLineTools/SDKs

#delete no used version
sudo rm -rf {MacOSXxxxx.sdk}

I ended up sudo rm -rf'ing all but the 14.5 directory, and now g++ (and clang++) no longer complains.