Open
Description
Clang / LLVM / lld / libc++ / compiler-rt 13.0.0.
Trying to figure out why some C++ code is not building on OpenBSD/amd64.
Trying to build fmt 9.0.0 one of the tests is failing like so...
[55/68] : && /home/ports/pobj/fmt-9.0.0/bin/c++ -O2 -pipe -DNDEBUG test/CMakeFiles/format-test.dir/format-test.cc.o -o bin/format-test -Wl,-z,origin,-rpath,/home/ports/pobj/fmt-9.0.0/build-amd64 test/libtest-main.a libfmt.so.1.1 -Wl,--as-needed test/gtest/libgtest.a -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
FAILED: bin/format-test
: && /home/ports/pobj/fmt-9.0.0/bin/c++ -O2 -pipe -DNDEBUG test/CMakeFiles/format-test.dir/format-test.cc.o -o bin/format-test -Wl,-z,origin,-rpath,/home/ports/pobj/fmt-9.0.0/build-amd64 test/libtest-main.a libfmt.so.1.1 -Wl,--as-needed test/gtest/libgtest.a -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
ld: error: undefined symbol: __eqtf2
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > fmt::v9::detail::write<char, std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, 0>(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, fmt::v9::basic_format_specs<char>, fmt::v9::detail::locale_ref))
>>> did you mean: __eqdf2
>>> defined in: /usr/lib/libcompiler_rt.a
ld: error: undefined symbol: __unordtf2
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > fmt::v9::detail::write<char, std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, 0>(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, fmt::v9::basic_format_specs<char>, fmt::v9::detail::locale_ref))
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > fmt::v9::detail::write<char, std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, 0>(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, fmt::v9::basic_format_specs<char>, fmt::v9::detail::locale_ref))
>>> did you mean: __unorddf2
>>> defined in: /usr/lib/libcompiler_rt.a
ld: error: undefined symbol: __netf2
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > fmt::v9::detail::write<char, std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, 0>(std::__1::back_insert_iterator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, __float128, fmt::v9::basic_format_specs<char>, fmt::v9::detail::locale_ref))
ld: error: undefined symbol: __letf2
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(int fmt::v9::detail::format_float<__float128>(__float128, int, fmt::v9::detail::float_specs, fmt::v9::detail::buffer<char>&))
ld: error: undefined symbol: __trunctfsf2
>>> referenced by format-test.cc
>>> test/CMakeFiles/format-test.dir/format-test.cc.o:(int fmt::v9::detail::format_float<__float128>(__float128, int, fmt::v9::detail::float_specs, fmt::v9::detail::buffer<char>&))
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
The functions in compiler-rt come from comparetf2.c
and trunctfsf2.c
.
They're built if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
.
I see CRT_HAS_128BIT
is defined. CRT_LDBL_128BIT
is not defined.
fp_lib.h
checks __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__)
.
$ clang -dM -E - < /dev/null | grep __LDBL_MANT_DIG__
#define __LDBL_MANT_DIG__ 64
$ clang -dM -E - < /dev/null | grep __SIZEOF_INT128__
#define __SIZEOF_INT128__ 16
test/Preprocessor/init-x86.c
seems to show that 64 is the expected value for __LDBL_MANT_DIG__
on amd64.