Issue 239035
Summary [openmp] build error: undefined symbols
Labels new issue
Assignees
Reporter peppergrayxyz
    building on Gentoo musl/llvm fails with
```C
[2993/3115] Linking CXX shared library openmp/libompd/src/libompd.so
FAILED: [code=1] openmp/libompd/src/libompd.so
: && llvm-project/build/bin/clang++ --target=aarch64-unknown-linux-musl -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -std=c++11 -O3 -DNDEBUG  -shared  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics -Wl,-soname,libompd.so -o openmp/libompd/src/libompd.so openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o openmp/libompd/src/CMakeFiles/ompd.dir/omp-debug.cpp.o openmp/libompd/src/CMakeFiles/ompd.dir/omp-state.cpp.o openmp/libompd/src/CMakeFiles/ompd.dir/omp-icv.cpp.o   && :
ld.lld: error: undefined symbol: operator new(unsigned long)
>>> referenced by TargetValue.cpp
>>> openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o:(TTypeFactory::getType(_ompd_aspace_cont*, char const*, unsigned long))
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by string.cpp
>>> string.cpp.o:(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init(char const*, unsigned long, unsigned long)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 157 more times

ld.lld: error: undefined symbol: vtable for std::logic_error
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 3 more times
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

ld.lld: error: undefined symbol: std::exception::~exception()
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by memory.cpp
>>> memory.cpp.o:(std::__1::bad_weak_ptr::~bad_weak_ptr()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by stdexcept.cpp
>>> stdexcept.cpp.o:(std::logic_error::logic_error(char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 3 more times

ld.lld: error: undefined symbol: operator delete(void*, unsigned long)
>>> referenced by TargetValue.cpp
>>> openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o:(TType::getSize(unsigned long*))
>>> referenced by TargetValue.cpp
>>> openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o:(TType::getSize(unsigned long*))
>>> referenced by TargetValue.cpp
>>> openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o:(TType::getSize(unsigned long*))
>>> referenced 807 more times

ld.lld: error: undefined symbol: __cxa_uncaught_exceptions
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::uncaught_exception()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::uncaught_exceptions()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: __cxa_decrement_exception_refcount
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::exception_ptr::~exception_ptr()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::exception_ptr::operator=(std::exception_ptr const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: __cxa_increment_exception_refcount
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::exception_ptr::exception_ptr(std::exception_ptr const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::exception_ptr::operator=(std::exception_ptr const&)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::exception_ptr::__from_native_exception_pointer(void*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: __cxa_guard_acquire
>>> referenced by iostream.cpp
>>> iostream.cpp.o:(std::__1::ios_base::Init::Init()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 50 more times

ld.lld: error: undefined symbol: __cxa_guard_release
>>> referenced by iostream.cpp
>>> iostream.cpp.o:(std::__1::ios_base::Init::Init()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 50 more times

ld.lld: error: undefined symbol: __cxa_guard_abort
>>> referenced by iostream.cpp
>>> iostream.cpp.o:(std::__1::ios_base::Init::Init()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by locale.cpp
>>> locale.cpp.o:(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_floating_point[abi:s240000qe26]<double>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, double, char const*) const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 36 more times

ld.lld: error: undefined symbol: __cxa_current_primary_exception
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::nested_exception::nested_exception()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::current_exception()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: std::terminate()
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::nested_exception::rethrow_nested() const) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::rethrow_exception(std::exception_ptr)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by TargetValue.cpp
>>> openmp/libompd/src/CMakeFiles/ompd.dir/TargetValue.cpp.o:(__clang_call_terminate)

ld.lld: error: undefined symbol: __cxa_rethrow_primary_exception
>>> referenced by exception.cpp
>>> exception.cpp.o:(std::rethrow_exception(std::exception_ptr)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: __cxa_allocate_exception
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by ios.cpp
>>> ios.cpp.o:(std::__1::__throw_failure[abi:s240000qe26](char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by string.cpp
>>> string.cpp.o:(std::__1::__throw_length_error[abi:s240000qe26](char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 6 more times

ld.lld: error: undefined symbol: std::bad_alloc::bad_alloc()
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: typeinfo for std::bad_alloc
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: std::bad_alloc::~bad_alloc()
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a

ld.lld: error: undefined symbol: __cxa_throw
>>> referenced by new_helpers.cpp
>>> new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by ios.cpp
>>> ios.cpp.o:(std::__1::__throw_failure[abi:s240000qe26](char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by string.cpp
>>> string.cpp.o:(std::__1::__throw_length_error[abi:s240000qe26](char const*)) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 6 more times

ld.lld: error: undefined symbol: __cxa_pure_virtual
>>> referenced by error_category.cpp
>>> error_category.cpp.o:(vtable for std::__1::error_category) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by error_category.cpp
>>> error_category.cpp.o:(vtable for std::__1::error_category) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by memory.cpp
>>>               memory.cpp.o:(vtable for std::__1::__shared_count) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 3 more times

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__class_type_info
>>> referenced by error_category.cpp
>>> error_category.cpp.o:(typeinfo for std::__1::error_category) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by exception.cpp
>>>               exception.cpp.o:(typeinfo for std::nested_exception) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced by ios.cpp
>>>               ios.cpp.o:(typeinfo for std::__1::ios_base) in archive llvm-project/build/bin/../lib/aarch64-unknown-linux-musl/libc++.a
>>> referenced 18 more times
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

ld.lld: 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)
```
due to `openmp` being linked before its dependecies are built.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to