llvm70 contains OpenMP, and it isn't properly found by find_package(OpenMP). Testcase: In the port math/combblas of rev.487559 remove the line LDFLAGS+=... Build of the port now fails because libomp.so isn't found, see log below. I think this is a regression with llbm70, I don't recall this happening with llvm60. ---log--- && /usr/local/bin/clang++70 -O2 -pipe -fno-omit-frame-pointer -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer -isystem /usr/local/include -O2 -pipe -fno-omit-frame-pointer -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer -isystem /usr/local/include -fstack-protector -L/usr/local/lib ReleaseTests/CMakeFiles/IndexingTest.dir/IndexingTest.cpp.o -o ReleaseTests/IndexingTest -Wl,-rpath,/usr/ports/math/combblas/work/.build:/usr/ports/math/combblas/work/.build/usort:/usr/ports/math/combblas/work/.build/graph500-1.2/generator libCombBLAS.so.1.16.0 -Wl,-rpath=/usr/local/lib/gcc7 -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib/gcc7 /usr/local/lib/libmpicxx.so /usr/local/lib/libmpi.so usort/libUsortlib.so graph500-1.2/generator/libGraphGenlib.so && : ReleaseTests/CMakeFiles/IndexingTest.dir/IndexingTest.cpp.o: In function `.omp_outlined.': IndexingTest.cpp:(.text+0x35d3): undefined reference to `__kmpc_global_thread_num' IndexingTest.cpp:(.text+0x362b): undefined reference to `__kmpc_for_static_init_4'
See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223678
Small correction: cmake says that it has found OpenMP, but it doesn't contain the proper libomp.so anywhere in the resulting cmake variables. Removing OpenMP from devel/llvm70 might be one possible solution. (Why was it added there anyway?)
Hi Yuri, Don't know, if I understand you right. In math/saga[1] I use the following to find libomp.so of clang60: # lines 65-67, and 71-72 CPP= clang-cpp60 CC= clang60 CXX= clang++60 CONFIGURE_ENABLE= openmp LDFLAGS= -L${LOCALBASE}/lib -lm -L${LOCALBASE}/llvm60/lib -lomp This also works also pretty nice for clang70. [1] https://svnweb.freebsd.org/ports/head/math/saga/Makefile?revision=487272&view=markup
Created attachment 200160 [details] testcase-broken-OpenMP-detection.shar (In reply to Rainer Hurling from comment #3) Hi Rainer, I'm attaching the testcase that demonstrates that OpenMP detection is broken with clang70. 1. Extract the attached case: sh testcase-broken-OpenMP-detection.shar 2. cd testcase-broken-OpenMP-detection 3. sh run 4. Observe the failure: helloworld.cpp:(.text+0x2d): undefined reference to `__kmpc_fork_call' It closely follows the recommended way: https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html Yuri
(In reply to Yuri Victorovich from comment #4) Hi Yuri, Sorry for the long delay. You are right, the testcase fails for clang70. But this is also true for clang60 (at least on HEAD), which is only in ports, not in base any more.
Both PR 234050 and PR 223678 need someone to chase what CMake is doing exactly -- you may find the cmake flags --debug-trycompile and --trace useful -- and to propose a patch. This isn't something we have time for right now.
The changes posted in PR 223678 don't help at all with clang++70. I notice that when it links, (e.g. through `make VERBOSE=1`) no openmp flags are passed to the compiler (linker) at all. If I copy the command used and insert `-fopenmp`, then the final link step completes properly. So with clang++70, **something** eats the flags which doesn't happen with base clang (it also happens with clang++60, for instance).
I'm going to merge this one with PR 223678. Over there, I have a patched FindOpenMP (I'll refresh the patches in a moment) that successfully builds (and runs) the test case on 12.0-R with clang60, clang70 and base clang. *** This bug has been marked as a duplicate of bug 223678 ***