Modify

Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#10587 closed defect (fixed)

Toolchain building process with latest gcc is broken due to DSO linking policy changes

Reported by: Cheer Xiao <xiaqqaix@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: toolchain Version: Trunk
Keywords: Cc:

Description

Running an up-to-date Archlinux I wasn't able to compile the toolchain. I'm using OpenWrt trunk. The error message is attached. The build process failed at "kernel-headers compile", which is shown below:

~/src/openwrt% make -j8

make[1] world
make[2] toolchain/install
make[3] -C toolchain/binutils prepare
make[3] -C toolchain/kernel-headers prepare
make[3] -C toolchain/gcc/minimal prepare
make[3] -C toolchain/binutils compile
make[3] -C toolchain/gcc/initial prepare
make[3] -C toolchain/gcc/final prepare
make[3] -C toolchain/binutils install
make[3] -C toolchain/gcc/minimal compile
make[3] -C toolchain/kernel-headers compile

make -r world: build failed. Please re-run make with V=99 to see what's going on
make: * [world] Error 1

Searching on the web, I found out that some other Archlinux user just encountered the same problem with me, when building another program [1]. The solution was to add -lstdc++ when calling gcc. As a quick and dirty fix, I appended "-lstdc++" the LIBS argument of /home/xiaq/src/openwrt/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal/gcc/Makefile

After that the building process proceeded:

~/src/openwrt% make

make[1] world
make[2] toolchain/install
make[3] -C toolchain/binutils prepare
make[3] -C toolchain/binutils compile
make[3] -C toolchain/binutils install
make[3] -C toolchain/gcc/minimal prepare
make[3] -C toolchain/gcc/minimal compile
make[3] -C toolchain/gcc/minimal install
make[3] -C toolchain/kernel-headers prepare
make[3] -C toolchain/kernel-headers compile
make[3] -C toolchain/kernel-headers install
make[3] -C toolchain/uClibc prepare
make[3] -C toolchain/gcc/initial prepare
make[3] -C toolchain/gcc/initial compile

where it fails at "toolchain/gcc/initial compile". Examining the debug output of "make V=99" revealed an identical bug.

I'm not really into autotools, so I'm expecting someone else to fix this.

Attachments (1)

openwrt.log (9.0 KB) - added by Cheer Xiao <xiaqqaix@…> 6 years ago.

Download all attachments as: .zip

Change History (15)

Changed 6 years ago by Cheer Xiao <xiaqqaix@…>

comment:1 Changed 6 years ago by Cheer Xiao <xiaqqaix@…>

Oops. Here is a version of my message with fixed markup.

Running an up-to-date Archlinux I wasn't able to compile the toolchain. I'm using OpenWrt trunk. The error message is attached. The build process failed at "kernel-headers compile", which is shown below:

~/src/openwrt% make -j8
 make[1] world
 make[2] toolchain/install
 make[3] -C toolchain/binutils prepare
 make[3] -C toolchain/kernel-headers prepare
 make[3] -C toolchain/gcc/minimal prepare
 make[3] -C toolchain/binutils compile
 make[3] -C toolchain/gcc/initial prepare
 make[3] -C toolchain/gcc/final prepare
 make[3] -C toolchain/binutils install
 make[3] -C toolchain/gcc/minimal compile
 make[3] -C toolchain/kernel-headers compile
make -r world: build failed. Please re-run make with V=99 to see what's going on
make: *** [world] Error 1

Searching on the web, I found out that some other Archlinux user just encountered the same problem with me, when building another program [1]. The solution was to add -lstdc++ when calling gcc. As a quick and dirty fix, I appended "-lstdc++" the LIBS argument of /home/xiaq/src/openwrt/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal/gcc/Makefile

After that the building process proceeded:

~/src/openwrt% make
 make[1] world
 make[2] toolchain/install
 make[3] -C toolchain/binutils prepare
 make[3] -C toolchain/binutils compile
 make[3] -C toolchain/binutils install
 make[3] -C toolchain/gcc/minimal prepare
 make[3] -C toolchain/gcc/minimal compile
 make[3] -C toolchain/gcc/minimal install
 make[3] -C toolchain/kernel-headers prepare
 make[3] -C toolchain/kernel-headers compile
 make[3] -C toolchain/kernel-headers install
 make[3] -C toolchain/uClibc prepare
 make[3] -C toolchain/gcc/initial prepare
 make[3] -C toolchain/gcc/initial compile

where it fails at "toolchain/gcc/initial compile". Examining the debug output of "make V=99" revealed an identical bug.

I'm not really into autotools, so I'm expecting someone else to fix this.

comment:2 Changed 6 years ago by anonymous

Same issue, Archlinux x86_64, r29607.

comment:3 follow-up: Changed 6 years ago by crow

Now when you post about Archlinux i also tried it on it, and I am also facing build image error on Archlinux (x86_64) its up to date with writing this mail. Compiling the toolchain went fine "make tools/{clean,compile,install}" no error are reported or what so ever.
Building as in seen in log for an wndr3700v2 (default config no extra stuff selected).

[@ wndr3700v2]$ uname -r
3.1.5-1-ARCH
[@ wndr3700v2]$  gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.6-20111125/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --disable-multilib --disable-libssp --disable-libstdcxx-pch --enable-checking=release
Thread model: posix
gcc version 4.6.2 20111125 (prerelease) (GCC)
[@ wndr3700v2]$ 


make[5]: Entering directory `/home/openwrt/wndr3700v2/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal/gcc'
x86_64-unknown-linux-gnu-gcc   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H  -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o  c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o \
  dummy-checksum.o main.o  libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lppl_c -lppl -lgmpxx -L/home/openwrt/wndr3700v2/staging_dir/host/lib -L/home/crow/openwrt/wndr3700v2/staging_dir/host/lib -L/home/openwrt/wndr3700v2/staging_dir/host/lib -lmpc -lmpfr -lgmp -rdynamic -ldl  -L../zlib -lz
/usr/bin/ld: /home/openwrt/wndr3700v2/staging_dir/host/lib/libgmpxx.a(ismpznw.o): undefined reference to symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)@@GLIBCXX_3.4'
/usr/bin/ld: note: 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)@@GLIBCXX_3.4' is defined in DSO /usr/lib/libstdc++.so.6 so try adding it to the linker command line
/usr/lib/libstdc++.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[5]: *** [cc1-dummy] Error 1
make[5]: Leaving directory `/home/openwrt/wndr3700v2/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal/gcc'
make[4]: *** [all-gcc] Error 2
make[4]: Leaving directory `/home/openwrt/wndr3700v2/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal'
make[3]: *** [/home/openwrt/wndr3700v2/build_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/gcc-linaro-4.5-2011.08-minimal/.built] Error 2
make[3]: Leaving directory `/home/openwrt/wndr3700v2/toolchain/gcc/minimal'
make[2]: *** [toolchain/gcc/minimal/compile] Error 2
make[2]: Leaving directory `/home/openwrt/wndr3700v2'
make[1]: *** [/home/openwrt/wndr3700v2/staging_dir/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32/stamp/.toolchain_install] Error 2
make[1]: Leaving directory `/home/openwrt/wndr3700v2'
make: *** [world] Error 2
[@ wndr3700v2]$}}}

comment:4 follow-up: Changed 6 years ago by Peter

It seems that the problem is archlinux-specific. I couldn't build it on my machine running arch-current, but on my brother's computer on debian everything went fine.

comment:5 in reply to: ↑ 3 Changed 6 years ago by CheerXiao <xiaqqaix@…>

Replying to crow:

Now when you post about Archlinux i also tried it on it, and I am also facing build image error on Archlinux (x86_64) its up to date with writing this mail. Compiling the toolchain went fine "make tools/{clean,compile,install}" no error are reported or what so ever.
Building as in seen in log for an wndr3700v2 (default config no extra stuff selected).
[snip]

You reproduced this bug precisely.

comment:6 in reply to: ↑ 4 Changed 6 years ago by CheerXiao <xiaqqaix@…>

Replying to Peter:

It seems that the problem is archlinux-specific. I couldn't build it on my machine running arch-current, but on my brother's computer on debian everything went fine.

No, it's specific to the latest ld (GNU linker). I suppose building on Debian Sid or other distros with latest ld would.

(Seems Trac has eaten the link I posted...) The change of linking policy was acknowledged upstream: http://fedoraproject.org/wiki/UnderstandingDSOLinkChange

comment:7 Changed 6 years ago by CheerXiao <xiaqqaix@…>

The markup in my original post was totally messed up... worse than I thought. Could the admin help clean up the it? The original post should be replaced by my first reply; and the link in my first reply should be http://fedoraproject.org/wiki/UnderstandingDSOLinkChange instead of "[1]".

comment:8 Changed 6 years ago by danitool <dgcbueu@…>

Running Archlinux, I've donwgraded binutils to version 2.21.1, and problem solved.

comment:9 Changed 6 years ago by Foks

Confirm. Downgrading binutils solves the problem.

Running Archlinux too.

comment:10 Changed 6 years ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

fix committed in r29721

comment:11 Changed 6 years ago by jeff@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

I am still getting this on ArchLinux x64. My install is fully up to date.

I have binutils-multilib 2.22-4.1 installed.

My sources include the patch linked in r29721:

$ ack "with-host-libstdcxx=-lstdc++" toolchain/
toolchain/gcc/common.mk
110:		$(if $(CONFIG_GCC_USE_GRAPHITE),--with-host-libstdcxx=-lstdc++) \

This is the backtrace from make V=99:

x86_64-unknown-linux-gnu-gcc   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H  -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o  c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o \
  dummy-checksum.o main.o  libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lppl_c -lppl -lgmpxx -L/home/jeff/dev/openwrt/trunk/staging_dir/host/lib -L/home/jeff/dev/openwrt/trunk/staging_dir/host/lib -L/home/jeff/dev/openwrt/trunk/staging_dir/host/lib -lmpc -lmpfr -lgmp -rdynamic -ldl  -L../zlib -lz -lelf
/usr/bin/ld: /home/jeff/dev/openwrt/trunk/staging_dir/host/lib/libgmpxx.a(ismpznw.o): undefined reference to symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)@@GLIBCXX_3.4'
/usr/bin/ld: note: 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)@@GLIBCXX_3.4' is defined in DSO /usr/lib/libstdc++.so.6 so try adding it to the linker command line
/usr/lib/libstdc++.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[5]: *** [cc1-dummy] Error 1

Anyone know what's wrong here?

comment:12 Changed 6 years ago by jeff@…

Derp, I should have paid more attention, sorry. That line I show on ack is NOT the line shown in r29721. My sources haven't completely updated even though I did a make clean. I will probably just delete the whole directory and start over. Sorry for the trouble, I was *this* close to leaving the bug closed. Please reclose.

comment:13 Changed 6 years ago by nbd

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:14 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.