llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.61k stars 11.83k forks source link

Is -DLIBOMP_USE_VERSION_SYMBOLS=ON build broken? #43466

Open LebedevRI opened 4 years ago

LebedevRI commented 4 years ago
Bugzilla Link 44121
Version unspecified
OS Linux
CC @alexey-bataev,@AndreyChurbanov,@hahnjo,@jdoerfert,@jpeyton52,@JonChesterfield,@jprotze,@sylvestre

Extended Description

I was seeing that for some time now, but only now did i take a detailed look. With -DLIBOMP_USE_VERSION_SYMBOLS=OFF ninja libomp.so passes. But with -DLIBOMP_USE_VERSION_SYMBOLS=ON i get:

[33/33] Linking C shared library lib/libomp.so FAILED: lib/libomp.so : && /usr/bin/clang-9 -fPIC -O2 -march=native -g -ggdb -DDEBUG -UNDEBUG -gz -fPIC -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -O2 -march=native -g -ggdb -DDEBUG -UNDEBUG -gz -Wl,--compress-debug-sections=zlib -Wl,--gdb-index -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics -shared -Wl,-soname,libomp.so -o lib/libomp.so projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_atomic.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_itt.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_environment.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_error.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_global.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_i18n.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_io.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_settings.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_str.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_threadprivate.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_utility.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_sched.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_version.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/ompt-general.cpp.o projects/openmp/runtime/src/CMakeFiles/omp.dir/z_Linux_asm.S.o -lpthread -ldl && cd /builddirs/llvm-project/build-Clang9-unknown/lib && /usr/bin/cmake -E create_symlink libomp.so libgomp.so && /usr/bin/cmake -E create_symlink libomp.so libiomp5.so && cd /builddirs/llvm-project/build-Clang9-unknown/projects/openmp/runtime/src && /usr/bin/cmake -E make_directory /repositories/llvm-project/openmp/runtime/exports/common.ompt.optional/include && /usr/bin/cmake -E copy omp.h /repositories/llvm-project/openmp/runtime/exports/common.ompt.optional/include && cd /builddirs/llvm-project/build-Clang9-unknown/projects/openmp/runtime/src && /usr/bin/cmake -E copy omp-tools.h /repositories/llvm-project/openmp/runtime/exports/common.ompt.optional/include && cd /builddirs/llvm-project/build-Clang9-unknown/projects/openmp/runtime/src && /usr/bin/cmake -E make_directory /repositories/llvm-project/openmp/runtime/exports/lin_32e.ompt.optional/lib && /usr/bin/cmake -E copy /builddirs/llvm-project/build-Clang9-unknown/lib/libomp.so /repositories/llvm-project/openmp/runtime/exports/lin_32e.ompt.optional/lib ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_atomic_end@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_atomic_end@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_atomic_start@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_atomic_start@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_barrier@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_barrier@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_barrier_cancel@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_barrier_cancel@GOMP_4.0 has undefined version GOMP_4.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_cancel@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_cancel@GOMP_4.0 has undefined version GOMP_4.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_cancellation_point@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_cancellation_point@GOMP_4.0 has undefined version GOMP_4.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_end@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_end@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_name_end@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_name_end@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_name_start@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_name_start@GOMP_1.0 has undefined version GOMP_1.0 ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_start@@VERSION has undefined version VERSION ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: symbol GOMP_critical_start@GOMP_1.0 has undefined version GOMP_1.0 ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) clang: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.

I did not bisect it yet.

LebedevRI commented 3 years ago

Can you look at the CMake output for the LIBOMP_HAVE_VERSION_SCRIPT_FLAG feature (shown below). I'm assuming LIBOMP_HAVE_VERSION_SCRIPT_FLAG is false since I don't see "-Wl,--version-script=..." in the link command. If that is the case, maybe we should unconditionally add it to the linker flags on Linux instead of testing for it. Especially if the test is faulty in some way.

-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG -- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG - ??

Ok, i finally looked into this. libomp_check_linker_flag() is, uhm, not very smart. In particular, it will fail if the path to the build dir contains "unknown"

jpeyton52 commented 4 years ago

Can you look at the CMake output for the LIBOMP_HAVE_VERSION_SCRIPT_FLAG feature (shown below). I'm assuming LIBOMP_HAVE_VERSION_SCRIPT_FLAG is false since I don't see "-Wl,--version-script=..." in the link command. If that is the case, maybe we should unconditionally add it to the linker flags on Linux instead of testing for it. Especially if the test is faulty in some way.

-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG -- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG - ??