Re: r246057: buildworld fails with: /usr/obj/usr/src/tmp/usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()'

From: Jan Beich <jbeich_at_tormail.org>
Date: Thu, 31 Jan 2013 11:43:09 +1200
"O. Hartmann" <ohartman_at_zedat.fu-berlin.de> writes:

> c++ -O3 -pipe -fno-strict-aliasing -march=native -march=native
> -DHAVE_CONFIG_H -I/usr/src/libexec/atf/atf-check/../../../contrib/atf
> -Qunused-arguments -fstack-protector -Wsystem-headers -Wall
> -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith
> -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int
> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
> -Wno-unused-function -Wno-conversion -stdlib=libc++ -std=c++11
> -L/usr/obj/usr/src/libexec/atf/atf-check/../../../lib/atf/libatf-c++
> -L/usr/obj/usr/src/libexec/atf/atf-check/../../../lib/atf/libatf-c -o
> atf-check atf-check.o -latf-c++ -latf-c
> /usr/obj/usr/src/tmp/usr/lib/libc++.so: undefined reference to
> `std::bad_alloc::~bad_alloc()'
> /usr/obj/usr/src/libexec/atf/atf-check/../../../lib/atf/libatf-c++/libatf-c++.so:
> undefined reference to `std::bad_alloc::bad_alloc()'
> /usr/obj/usr/src/libexec/atf/atf-check/../../../lib/atf/libatf-c++/libatf-c++.so:
> undefined reference to `std::bad_alloc::~bad_alloc()'
> /usr/obj/usr/src/tmp/usr/lib/libc++.so: undefined reference to
> `std::bad_alloc::bad_alloc()'
> c++: error: linker command failed with exit code 1 (use -v to see
> invocation)
> *** [atf-check] Error code 1

Try stage binaries built with default CXXFLAGS from allbsd.org snapshot.
With them installed do you see smth like the following?

  $ clang++ -stdlib=libc++ foo.c
  clang++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::bad_alloc()'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::bad_alloc()'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)

It's different from the error when you build libc++ before libcxxrt.

  $ clang++ -stdlib=libc++ foo.c
  clang++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
  /usr/lib/libc++.so: undefined reference to `std::uncaught_exception()_at_CXXABI_1.3'
  /usr/lib/libc++.so: undefined reference to `std::exception::~exception()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `typeinfo for std::exception_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::bad_alloc()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `typeinfo for std::bad_cast_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::bad_cast::~bad_cast()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `typeinfo for std::bad_alloc_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::bad_alloc::bad_alloc()_at_CXXRT_1.0'
  /usr/lib/libc++.so: undefined reference to `std::terminate()_at_CXXABI_1.3'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)

--
#! /bin/sh
# fetch/install stage binaries from allbsd.org snapshots

TARGET=amd64
TARGET_ARCH=amd64
BRANCH=10.0-HEAD
#REVISION=r245980 # works fine
REVISION=r246034 # doesn't work
LIBS="lib/libcxxrt/libcxxrt.so.1:/lib \
      lib/libc++/libc++.so.1:/usr/lib \
      gnu/lib/libsupc++/libsupc++.so.1:/usr/lib"

for f in $LIBS; do
#    chflags 0 $dir/${file##*/}
    fetch -o ${f#*:} https://pub.allbsd.org/FreeBSD-snapshots/${TARGET}-${TARGET_ARCH}/${BRANCH}-${REVISION}-JPSNAP/stage/usr/obj/usr/src/${f%:*}
done
Received on Wed Jan 30 2013 - 22:46:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:34 UTC