Bug 58763 - 4.8.x won't build for x86_64-linux-uclibc: undefined reference to 'operator new(unsigned long)'
Summary: 4.8.x won't build for x86_64-linux-uclibc: undefined reference to 'operator n...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-17 01:51 UTC by Jody Lee Bruchon
Modified: 2013-10-17 02:58 UTC (History)
0 users

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-linux-uclibc
Build: x86_64-unknown-linux-gnu
Known to work: 4.7.3
Known to fail: 4.8.1
Last reconfirmed: 2013-10-17 00:00:00


Attachments
uClibc x86_64 configuration file (1.93 KB, text/plain)
2013-10-17 01:51 UTC, Jody Lee Bruchon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jody Lee Bruchon 2013-10-17 01:51:47 UTC
Created attachment 31022 [details]
uClibc x86_64 configuration file

I built a fresh x86_64-unknown-linux-gnu environment with binutils-2.23.2, gcc-4.8.1, headers_install from linux-3.10, and glibc-2.17, and built that environment again within itself. Using this clean build environment, I attempted to bootstrap a uClibc toolchain (x86_64-linux-uclibc) and gcc-4.8.1 fails to bootstrap.

I built and installed the cross-compiler targeted binutils-2.23.2, uClibc-20131017, linux-3.10 headers (in /usr/x86_64-linux-uclibc/). Building the initial gcc fails as follows (but this failure does not occur with gcc-4.7.3 or lower):

../gcc-4.8.1/configure --prefix=/usr --target=x86_64-unknown-linux-uclibc --enable-languages=c --disable-nls --disable-multilib

make -j12 all-gcc

[...lots of build stuff...]

make[1]: Entering directory `/usr/src/build-gcc/gcc'
g++   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o i386-c.o glibc-c.o \
  cc1-checksum.o libbackend.a main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lmpc -lmpfr -lgmp -rdynamic -ldl  -L../zlib -lz
libbackend.a(sel-sched-ir.o): In function `vec_free<basic_block_def*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1329: undefined reference to `operator delete(void*)'
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1329: undefined reference to `operator delete(void*)'
libbackend.a(sel-sched-ir.o): In function `vec_alloc<basic_block_def*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1303: undefined reference to `operator new(unsigned long)'
libbackend.a(sel-sched-ir.o): In function `vec_free<basic_block_def*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1329: undefined reference to `operator delete(void*)'
libbackend.a(tree-ssa-sccvn.o): In function `vn_reference_lookup_3':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/tree-ssa-sccvn.c:1455: undefined reference to `__cxa_guard_acquire'
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/tree-ssa-sccvn.c:1455: undefined reference to `__cxa_guard_release'
libbackend.a(tree-sra.o): In function `vec_free<access*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1329: undefined reference to `operator delete(void*)'
libbackend.a(tree-sra.o): In function `vec_alloc<access*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1303: undefined reference to `operator new(unsigned long)'
libcommon-target.a(opts.o): In function `vec_alloc<char*>':
/usr/src/build-gcc/gcc/../../gcc-4.8.1/gcc/vec.h:1303: undefined reference to `operator new(unsigned long)'
collect2: error: ld returned 1 exit status
make[1]: *** [cc1] Error 1
make[1]: Leaving directory `/usr/src/build-gcc/gcc'
make: *** [all-gcc] Error 2

My "gcc -v" output:
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure --prefix=/usr --mandir=/usr/man --libexecdir=/usr/lib --enable-languages=c,c++,objc --enable-threads=posix --enable-clocale=gnu --enable-shared --disable-nls --with-x=no --with-system-zlib --disable-multilib --enable-lto --disable-bootstrap
Thread model: posix
gcc version 4.8.1 (GCC)

It should also be noted that when I performed the same procedure with the x86_64 toolchain included with CRUX 2.8 64-bit (gcc-4.7.2, binutils-2.22, glibc-2.16), "make all-gcc" worked, so I guess it has something to do with the change to C++ in the 4.8 series.
Comment 1 Andrew Pinski 2013-10-17 02:09:13 UTC
This sounds like a bug in your host compiler and your host libstdc++.  Those symbols are all in libstdc++.
Comment 2 Jody Lee Bruchon 2013-10-17 02:58:54 UTC
As suggested, a standalone rebuild and reinstall of gcc-4.8.1/libstdc++-v3 inside the clean build environment fixed the problem. At least the problem will now be on record in case anyone else runs into this issue! Thanks for your help!