ROCm / HIP-Examples

Examples for HIP
194 stars 86 forks source link

Unknown argument '-hc' found while linking to hip::device #27

Closed alephpiece closed 3 years ago

alephpiece commented 3 years ago

I was trying to run the example openmp-helloworld with HIP 3.9.1 and an error occurred.

The compiler I was using is not in the default installation path /opt/rocm so I commented out the compiler setting statements in the original CMakeLists.txt. It seems like the target hip::device cmake found is still from the default installation of ROCm. This target comes with a flag -hc which breaks the build.

$ cmake -S . -B build -DCMAKE_C_COMPILER=hipcc -DCMAKE_CXX_COMPILER=hipcc && cmake --build build -v

[ 50%] Building CXX object CMakeFiles/test_openmp_helloworld.dir/openmp_helloworld.cpp.o                                                                    
/public/software/compiler/rocm/rocm-3.9.1/bin/hipcc   -isystem /opt/rocm/hip/include -isystem /opt/rocm/hsa/include  -O3 -DNDEBUG   -fopenmp=libomp -hc -fPIC -o CMakeFiles/test_openmp_helloworld.dir/openmp_helloworld.cpp.o -c /**/openmp-helloworld/openmp_helloworld.cpp          
clang-12: error: unknown argument: '-hc'