C++ link failure on ARM

Bug #686381 reported by Jani Monoses
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Invalid
Undecided
Unassigned
luatex (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.5

The package luatex FTBFS on armel

./CXXLD.sh: g++ -Wall -Wunused -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wshadow -g -O2 -Wl,-Bsymbolic-functions -o luatex luatex-luatex.o -Wl,--export-dynamic libluatex.a libff.a libluamisc.a libluasocket.a liblua51.a /home/jani/ftbfs/luate/luatex-0.60.2/build/libs/zziplib/libzzip.a -lpng -lz -lpoppler /home/jani/ftbfs/luate/luatex-0.60.2/build/libs/obsdcompat/libopenbsd-compat.a libmd5.a libmplib.a lib/lib.a /home/jani/ftbfs/luate/luatex-0.60.2/build/texk/kpathsea/.libs/libkpathsea.a -ldl -lm -nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm -lgcc_eh -lgcc -lc -lgcc_eh -lgcc
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/libgcc_eh.a(unwind-arm.o): undefined reference to symbol '__exidx_end'
/usr/bin/ld: note: '__exidx_end' is defined in DSO /usr/lib/liblcms.so.1 so try adding it to the linker command line
/usr/lib/liblcms.so.1: could not read symbols: Invalid operation

If I rerun the same command line with g++-4.4 it links.

Complete build log
http://launchpadlibrarian.net/58040388/buildlog_ubuntu-natty-armel.luatex_0.60.2-1_FAILEDTOBUILD.txt.gz

Tags: armel
Revision history for this message
Matthias Klose (doko) wrote :

maybe not Linaro related, but please could you have look at it?

tags: added: armel
Changed in gcc-4.5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Michael Hope (michaelh1) wrote :

Compiling luatex_0.60.1-1build2 under Maverick with gcc-linaro-4.5-2010.11-1 succeeds:

libtool: link: ./CXXLD.sh -Wall -Wunused -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wshadow -g -O2 -Wl,-Bsymbolic-functions -o luatex luatex-luatex.o -Wl,--export-dynamic libluatex.a libff.a libluamisc.a libluasocket.a liblua51.a /home/michaelh/linaro/packages/luatex-0.60.1/build/libs/zziplib/libzzip.a -lpng -lz -lpoppler /home/michaelh/linaro/packages/luatex-0.60.1/build/libs/obsdcompat/libopenbsd-compat.a libmd5.a libmplib.a lib/lib.a /home/michaelh/linaro/packages/luatex-0.60.1/build/texk/kpathsea/.libs/libkpathsea.a -ldl -lm
./CXXLD.sh: g++-linaro -Wall -Wunused -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wshadow -g -O2 -Wl,-Bsymbolic-functions -o luatex luatex-luatex.o -Wl,--export-dynamic libluatex.a libff.a libluamisc.a libluasocket.a liblua51.a /home/michaelh/linaro/packages/luatex-0.60.1/build/libs/zziplib/libzzip.a -lpng -lz -lpoppler /home/michaelh/linaro/packages/luatex-0.60.1/build/libs/obsdcompat/libopenbsd-compat.a libmd5.a libmplib.a lib/lib.a /home/michaelh/linaro/packages/luatex-0.60.1/build/texk/kpathsea/.libs/libkpathsea.a -ldl -lm -nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm -lgcc_eh -lgcc -lc -lgcc_eh -lgcc
make[6]: Leaving directory `/home/michaelh/linaro/packages/luatex-0.60.1/build/texk/web2c'

The 'libgcc_eh.a' reference is interesting. The command line includes a '-Bstatic libstdc++' followed by a '-Bdynamic -lm -lgcc_eh' etc. I wonder why libgcc_eh.a is being referenced instead of libgcc_eh.so

Revision history for this message
Michael Hope (michaelh1) wrote :

Compiling luatex_0.60.2-1 under Natty with gcc-linaro-4.5.2010.11-1 succeeds.

Revision history for this message
Jani Monoses (jani) wrote :

This is the version of the failing gcc
g++ (Ubuntu/Linaro 4.5.1-10ubuntu3)
FWIW I see no libgcc_eh.so installed on the system (neither on ARM nor x86 natty) only the static lib.

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

I can reproduce the failure under a Natty chroot.

The missing symbol, "__exidx_end", is defined by the linker script (see /usr/lib/ldscripts/armelf_linux_eabi.x), so I can't see why it isn't defined, but that's just a symptom of the real problem.

For whatever reason, this package is setup to link libstdc++ statically, not dynamically, and this means manually specifying all the hidden libraries, but they have been done incorrectly. If the command is truncated before the "-nodefaultlibs" option, thus allowing the compile driver to do a normal link, it does not use libgcc_eh at all, but uses libgcc_s.so instead, and the link is successful.

The following link line works correctly with this compiler:

g++ -Wall -Wunused -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wshadow -g -O2 -Wl,-Bsymbolic-functions -o luatex luatex-luatex.o -Wl,--export-dynamic libluatex.a libff.a libluamisc.a libluasocket.a liblua51.a /home/ams/lp686381/luatex-0.60.2/build/libs/zziplib/libzzip.a -lpng -lz -lpoppler /home/ams/lp686381/luatex-0.60.2/build/libs/obsdcompat/libopenbsd-compat.a libmd5.a libmplib.a lib/lib.a /home/ams/lp686381/luatex-0.60.2/build/texk/kpathsea/.libs/libkpathsea.a -ldl -lm -nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc

Changed in gcc-linaro:
status: New → Triaged
Revision history for this message
Jani Monoses (jani) wrote :

so is this a packaging bug? In that case it should be reassigned to luatex.

Revision history for this message
Jani Monoses (jani) wrote :

This is the automake macro that creates the explicit library order and call to the linker, it is used by various latex-related packages apparently

http://www.tex.ac.uk/tex-archive/systems/luatex/source/m4/kpse-cxx-hack.m4

Jani Monoses (jani)
Changed in gcc-linaro:
status: Triaged → Invalid
affects: gcc-4.5 (Ubuntu) → luatex (Ubuntu)
Jani Monoses (jani)
Changed in luatex (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.