Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'check-cxx' fails with undefined reference errors when assertions are enabled #49878

Closed
bryanpkc opened this issue May 30, 2021 · 5 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ Bugs in the libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@bryanpkc
Copy link
Collaborator

bryanpkc commented May 30, 2021

Bugzilla Link 50534
Resolution FIXED
Resolved on Jun 29, 2021 18:04
Version unspecified
OS Linux
CC @ldionne,@mclow
Fixed by commit(s) b648c61

Extended Description

Starting with commit 31e8203, building libc++ with -DLIBCXX_ENABLE_ASSERTIONS=on no longer works. ninja check-cxx fails with 1000+ errors:

Failed Tests (1207):
libc++ :: libcxx/containers/sequences/vector/asan_throw.pass.cpp
libc++ :: libcxx/containers/sequences/vector/const_value_type.pass.cpp
libc++ :: libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp
libc++ :: libcxx/containers/sequences/vector/robust_against_adl.pass.cpp
libc++ :: libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
libc++ :: libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
libc++ :: libcxx/fuzzing/make_heap.pass.cpp
libc++ :: libcxx/fuzzing/nth_element.pass.cpp
libc++ :: libcxx/fuzzing/partial_sort.pass.cpp
libc++ :: libcxx/fuzzing/partial_sort_copy.pass.cpp
libc++ :: libcxx/fuzzing/partition.pass.cpp
libc++ :: libcxx/fuzzing/partition_copy.pass.cpp
.
.
libc++ :: std/utilities/template.bitset/bitset.members/test.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.members/to_string.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp
libc++ :: std/utilities/template.bitset/bitset.operators/stream_out.pass.cpp
libc++ :: std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
libc++ :: std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp
libc++ :: std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
libc++ :: std/utilities/utility/exchange/exchange.pass.cpp
libc++ :: std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
libc++ :: std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
libc++ :: support/test.support/make_string_header.pass.cpp

Testing Time: 225.48s
Unsupported : 214
Passed : 5175
Expectedly Failed: 49
Failed : 1207
FAILED: projects/libcxx/test/CMakeFiles/check-cxx

The failures are caused by link-time undefined reference errors like this one:

"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/bryanpkc/llvm/main/build/projects/libcxx/projects/libcxx/test/std/utilities/variant/variant.variant/variant.assign/Output/copy.pass.cpp.dir/t.tmp.exe /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o -L/home/bryanpkc/llvm/main/build/projects/libcxx/./lib -L/home/bryanpkc/llvm/main/build/projects/libcxx/./lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/home/bryanpkc/llvm/main/install/bin/../lib -L/lib -L/usr/lib /tmp/copy-35c74a.o -lc++experimental -rpath /home/bryanpkc/llvm/main/build/projects/libcxx/./lib -rpath /home/bryanpkc/llvm/main/build/projects/libcxx/./lib -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o
/tmp/copy-35c74a.o: In function void std::__1::__variant_detail::__assignment<std::__1::__variant_detail::__traits<int, MakeEmptyT, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__assign_alt<2ul, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::__variant_detail::__alt<2ul, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)': copy.pass.cpp:(.text._ZNSt3__116__variant_detail12__assignmentINS0_8__traitsIJi10MakeEmptyTNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEEE12__assign_altILm2ES9_RKS9_EEvRNS0_5__altIXT_ET0_EEOT1_[_ZNSt3__116__variant_detail12__assignmentINS0_8__traitsIJi10MakeEmptyTNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEEE12__assign_altILm2ES9_RKS9_EEvRNS0_5__altIXT_ET0_EEOT1_]+0x3c): undefined reference to std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::operator=(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)'

I can reproduce this on x86_64 Ubuntu 18.04 as well as aarch64 CentOS 7.7.

@bryanpkc
Copy link
Collaborator Author

bryanpkc commented May 30, 2021

assigned to @ldionne

@bryanpkc
Copy link
Collaborator Author

bryanpkc commented May 30, 2021

Configuring libcxx with -DLIBCXX_ENABLE_ASSERTIONS=off works around this problem.

@ldionne
Copy link
Member

ldionne commented Jun 8, 2021

I can reproduce it locally, I'm looking into this now.

@ldionne
Copy link
Member

ldionne commented Jun 9, 2021

Attempt to fix this: https://reviews.llvm.org/D103964

@ldionne
Copy link
Member

ldionne commented Jun 9, 2021

commit b648c61
Author: Louis Dionne ldionne.2@gmail.com
Date: Wed Jun 9 09:41:27 2021 -0400

[libc++] Fix libc++ build with assertions enabled

This fixes llvm/llvm-project#49878 . This is another take on D103960
which is less disruptive.

Differential Revision: https://reviews.llvm.org/D103964

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ Bugs in the libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants