[Openmp-dev] libomp linking issue

Ye Luo via Openmp-dev openmp-dev at lists.llvm.org
Thu Dec 5 15:37:18 PST 2019


Hi all,
Today I hit an issue and took me quite a while to find out what the problem
was.
Even though now I understand the problem, I don't know which piece should
be fixed.

My workstation has ubuntu 18.04 and libomp from package manager is
installed on the machine.
Thus I got libomp.so and libomp.so.5 under /usr/lib/x86_64-linux-gnu/.
I need the dev llvm and thus build my own llvm with libomp and libomptarget
enabled.
When I compile and link a simple main.
clang++ -fopenmp main.cpp # using my clang build.
ldd a.out
libomp.so.5 => /usr/lib/x86_64-linux-gnu/libomp.so.5 (0x00007fdf0701f000)
The OS version gets picked up.
Even I put my clang lib on the LD_LIBRARY_PATH. libomp.so doesn't get
picked up due to ".5" expected by a.out.
Q1. why clang doesn't put -L lib_of_my_clang_build by default?
Now I compile with offload flag
clang++ -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda main.cpp # using my
clang build.
I got segfault when my build libomptarget tries to talk to libomp from the
OS.
Q2, is there no check of consistency between libomp and libomptarget?

I can put -L lib_of_my_clang_build as a workaround but this is ugly.
Need more experienced people to find a clean solution.

Best,
Ye
===================
Ye Luo, Ph.D.
Computational Science Division & Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20191205/5a747945/attachment.html>


More information about the Openmp-dev mailing list