ROCm: Missing cmath/libcxx in ROCm 5.3.0
From the HIP examples repo
Machine is a zen2 Ryzen 7 4800H, 64 GB ram, running Linux Mint (Ubuntu derivative).
joe@zap:~/build/HIP-Examples$ ./test_all.sh
==== vectorAdd ====
rm -f ./vectoradd_hip.exe
rm -f vectoradd_hip.o
rm -f /opt/rocm-5.3.0//hip/src/*.o
/opt/rocm-5.3.0//hip/bin/hipcc -g -c -o vectoradd_hip.o vectoradd_hip.cpp
In file included from <built-in>:1:
/opt/rocm-5.3.0/llvm/lib/clang/15.0.0/include/__clang_hip_runtime_wrapper.h:50:10: fatal error: 'cmath' file not found
#include <cmath>
^~~~~~~
1 error generated when compiling for gfx90c.
make: *** [<builtin>: vectoradd_hip.o] Error 1
...
Seems to be missing cmath which is usually in a clang libcxx/include directory. I copied the missing headers to a local path, pointed added an include path, and then it complains about a configuration file missing.
rm -f ./vectoradd_hip.exe
rm -f vectoradd_hip.o
rm -f /opt/rocm-5.3.0//hip/src/*.o
joe@zap:~/build/HIP-Examples/vectorAdd$ make
/opt/rocm-5.3.0//hip/bin/hipcc -g -I/home/joe/nlytiq/dev/nlytiq-base/llvm-project-15.0.3.src/libcxx/include -c -o vectoradd_hip.o vectoradd_hip.cpp
In file included from <built-in>:1:
In file included from /opt/rocm-5.3.0/llvm/lib/clang/15.0.0/include/__clang_hip_runtime_wrapper.h:50:
In file included from /home/joe/nlytiq/dev/nlytiq-base/llvm-project-15.0.3.src/libcxx/include/cmath:307:
In file included from /home/joe/nlytiq/dev/nlytiq-base/llvm-project-15.0.3.src/libcxx/include/__assert:13:
/home/joe/nlytiq/dev/nlytiq-base/llvm-project-15.0.3.src/libcxx/include/__config:13:10: fatal error: '__config_site' file not found
#include <__config_site>
^~~~~~~~~~~~~~~
1 error generated when compiling for gfx90c.
make: *** [<builtin>: vectoradd_hip.o] Error 1
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16
I did but I found a better way. Installing libstdc+±12-dev fixes the issue on 22.04.1 with 5.4 without requiring llvm.
Ran into the same issue when I upgraded my Ubuntu 20.04 to 22.04, system information:
hipcc information:
The above fix of
sudo apt-get install libstdc++-12-devworked for me as well. The error initially showed up as “Failed to find a default HIP architecture”, so that might be related. Now it finds the correct architecture being compiled for and not thegfx000.It’s insane that to get ROCm compilation working you need a secret incantation from a random github issue… but thanks!
Fixed it for me too, thanks @elbriggs!
Compared my initial fix (building with llvm) with the packages and saw the discrepancy.