<div dir="ltr">Joachim, Jonas,<div><br></div><div>I ended up setting KMP_DYNAMIC_LIB to 0 so I don't get</div><div>the error, but is this the right approach for producing statically</div><div>linked applications?</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 1, 2018 at 4:53 PM Jonas Hahnfeld <<a href="mailto:hahnjo@hahnjo.de">hahnjo@hahnjo.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2018-10-01 09:37, Itaru Kitayama via Openmp-dev wrote:<br>
> Hi,<br>
> <br>
> I'm trying to link my app statically with the upstream LLVM/Clang, but<br>
> I get this at the last stage:<br>
> <br>
> [100%] Linking CXX executable nest<br>
> /usr/lib/gcc/aarch64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o):<br>
> In function `sem_open':<br>
> (.text+0x7810): warning: the use of `mktemp' is dangerous, better use<br>
> `mkstemp'<br>
> /home/itaru/opt/llvm+clang-upstream/bin/../lib/libomp.a(ompt-general.cpp.o):<br>
> In function `ompt_start_tool':<br>
> /home/itaru/projects/llvm/projects/openmp/runtime/src/ompt-general.cpp:144:<br>
> undefined reference to `dlsym'<br>
> /home/itaru/opt/llvm+clang-upstream/bin/../lib/libomp.a(ompt-general.cpp.o):<br>
> In function `ompt_try_start_tool(unsigned int, char const*)':<br>
> ompt-general.cpp:(.text+0xf00): undefined reference to `dlopen'<br>
> ompt-general.cpp:(.text+0xf20): undefined reference to `dlsym'<br>
<br>
These symbols are in libdl.so which you probably need to add manually <br>
when linking statically.<br>
<br>
> clang-8: error: linker command failed with exit code 1 (use -v to see<br>
> invocation)<br>
> make[3]: *** [nest/CMakeFiles/nest.dir/build.make:135: nest/nest]<br>
> Error 1<br>
> make[2]: *** [CMakeFiles/Makefile2:735: nest/CMakeFiles/nest.dir/all]<br>
> Error 2<br>
> make[1]: *** [CMakeFiles/Makefile2:747: nest/CMakeFiles/nest.dir/rule]<br>
> Error 2<br>
> make: *** [Makefile:364: nest] Error 2<br>
> <br>
> I'm building a tool placing openmp and clang under projects and tools<br>
> respectively under the top llvm directory. Any way to disable the OMPT<br>
> completely as currently it is underdevelopment and have no interest in<br>
> using it at the moment.<br>
<br>
When building the OpenMP runtime you can add -DLIBOMP_OMPT_SUPPORT=OFF <br>
to CMake. This should disable support for OMPT and hence the references <br>
to dl* should go away.<br>
<br>
Cheers,<br>
Jonas<br>
</blockquote></div>