<div dir="ltr"><div>Hi,</div><div><br></div><div>I just compiled LLVM and enable NVPTX by -DLLVM_TARGETS_TO_BUILD="X86;NVPTX". But when I compiled my code using the below command:</div><div><br></div><div>clang++ main.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o a_gpu.exe</div><div><br></div><div>I got the below error:</div><div><br></div><div>/usr/lib64/gcc/x86_64-pc-linux-gnu/9.2.1/../../../../include/c++/9.2.1/bits/std_abs.h:75:3: error: declaration conflicts with target of using declaration already in scope<br>  abs(float __x)</div><div><br></div><div>I think the reason is I am using GCC-9. I did a bit search and someone said using libc++ can address this. So I compiled libcxx and libcxxabi, and used the below command to compile my code again:</div><div><br></div><div>clang++ stdlib=libc++  main.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o a_gpu.exe</div><div><br></div><div>I got different errors:</div><div><br></div><div>nvlink error   : Undefined reference to '_ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv' in '/tmp/main-42e0a6.cubin'<br>nvlink error   : Undefined reference to 'abort' in '/tmp/main-42e0a6.cubin'</div><div><br></div><div>I think the reason here is nvlink don't know we should link libc++ with those cubin files together. But I don't know how to solve this.</div><div><br></div><div>Any one know a workaround to this?</div><div><br></div><div>Thanks!<br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>