Bug 175778

Summary: /usr/obj/usr/src/tmp/usr/lib/libc++.so: undefined reference to `std::bad_alloc::~bad_alloc()'
Product: Base System Reporter: O. Hartmann <ohartmann>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: theraven
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description O. Hartmann 2013-02-02 09:10:00 UTC
Compiling world with option

-stdlib=libc++ -std=c++11

or even only

-stdlib=libc++

fails building world with the below shown error message.

Obviously, libc++ is broken.

Avoiding the option -stdlib=libc++

makes buildworld run cleanly thriugh everything.


[...]
===> libexec/atf/atf-check (all)
c++ -O2 -pipe -O3 -march=native -DHAVE_CONFIG_H -O3 -march=native -pipe -I/usr/src/libexec/atf/atf-check/../../../contrib/atf -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -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 -c /usr/src/libexec/atf/atf-check/../../../contrib/atf/atf-sh/atf-check.cpp
c++ -O2 -pipe -O3 -march=native -DHAVE_CONFIG_H -O3 -march=native -pipe -I/usr/src/libexec/atf/atf-check/../../../contrib/atf -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -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

Stop in /usr/src/libexec/atf/atf-check.
*** [all] Error code 1

Stop in /usr/src/libexec/atf.
*** [all] Error code 1

Stop in /usr/src/libexec.
*** [libexec.all__D] Error code 1

Stop in /usr/src.
*** [everything] Error code 1

Stop in /usr/src.
*** [buildworld] Error code 1

Stop in /usr/src.

Fix: 

Avoid the build with -stdlib=libc++
How-To-Repeat: Build world with CXXFLAGS+= -stdlib=libc++ and WITH_LIBCPLUSPLUS=YES set in /etc/src.conf or /etc/make.conf
Comment 1 David Chisnall freebsd_committer freebsd_triage 2014-06-02 08:08:21 UTC
I believe that this was an error in the version script that is was fixed some time ago.