Bug 242593

Summary: [PowerPC64] lang/gcc8: error: cp/cxx-pretty-print.o: ELF section name out of range (on FreeBSD 12.1-RELEASE)
Product: Ports & Packages Reporter: canardo <canardo909>
Component: Individual Port(s)Assignee: Gerald Pfeifer <gerald>
Status: Closed Not A Bug    
Severity: Affects Some People CC: gerald, pkubaj, powerpc
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: merge-quarterly?
Hardware: powerpc   
OS: Any   
Description Flags
poudriere log none

Description canardo 2019-12-12 08:38:02 UTC
Problem found when compiling gcc8 on FreeBSD 12.1

# cd /usr/ports/lang/gcc8
# make install clean
gmake[5]: Entering directory '/usr/ports/lang/gcc8/work/.build/libdecnumber'
gmake[5]: Nothing to be done for 'all'.
gmake[5]: Leaving directory '/usr/ports/lang/gcc8/work/.build/libdecnumber'
gmake[5]: Entering directory '/usr/ports/lang/gcc8/work/.build/gcc'
/usr/ports/lang/gcc8/work/.build/./prev-gcc/xg++ -B/usr/ports/lang/gcc8/work/.build/./prev-gcc/ -B/usr/local/powerpc64-portbld-freebsd12.1/bin/ -nostdinc++ -B/usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/src/.libs -B/usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/libsupc++/.libs  -isystem /usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/include/powerpc64-portbld-freebsd12.1  -isystem /usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/include  -isystem /usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/libsupc++ -L/usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/src/.libs -L/usr/ports/lang/gcc8/work/.build/prev-powerpc64-portbld-freebsd12.1/libstdc++-v3/libsupc++/.libs -no-pie   -O1 -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o cc1plus \
      cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/method.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/repo.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.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-indentation.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 c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o default-c.o rs6000-c.o cc1plus-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   -L/usr/local/lib -lmpc -lmpfr -lgmp -rdynamic  -lz
/usr/local/bin/ld: warning: cp/cxx-pretty-print.o has a corrupt string table index - ignoring
/usr/local/bin/ld: error: cp/cxx-pretty-print.o: ELF section name out of range
collect2: error: ld returned 1 exit status
gmake[5]: *** [/usr/ports/lang/gcc8/work/gcc-8.3.0/gcc/cp/Make-lang.in:120: cc1plus] Error 1
gmake[5]: Leaving directory '/usr/ports/lang/gcc8/work/.build/gcc'
gmake[4]: *** [Makefile:4652: all-stage2-gcc] Error 2
gmake[4]: Leaving directory '/usr/ports/lang/gcc8/work/.build'
gmake[3]: *** [Makefile:22550: stage2-bubble] Error 2
gmake[3]: Leaving directory '/usr/ports/lang/gcc8/work/.build'
gmake[2]: *** [Makefile:22765: bootstrap-lean] Error 2
gmake[2]: Leaving directory '/usr/ports/lang/gcc8/work/.build'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

make[1]: stopped in /usr/ports/lang/gcc8
*** Error code 1


It runs on an emulated version of FreeBSD

Host is Ubuntu 18.04 LTS 64bits (with 8GB ram)

Qemu version :
QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.21)

Command line to run FreeBSD
sudo qemu-system-ppc64 -M pseries-2.12-sxxm -smp 2 -drive file=qfreebsdppc64.qcow -m 3G -machine cap-sbbc=broken,cap-ibs=broken -net user,hostfwd=tcp::10022-:22 -net nic

Installed FreeBSD version
# uname -mrs
FreeBSD 12.1-RELEASE powerpc

I don't have PowerPC64 hardware, so I can't test if it is purely on Qemu, or if it also occurs on ppc64 hardware.
Comment 1 Piotr Kubaj freebsd_committer 2019-12-14 17:09:59 UTC
Created attachment 209945 [details]
poudriere log

It's probably your setup. I built gcc8 recently on 12.1-RELEASE.
Comment 2 canardo 2019-12-17 10:21:04 UTC
I'm using default values to compile, but I noticed the Qemu version pacakaged in Ubuntu by default in an old version (2.11.1) while a newer version 4.2 is available on Qemu website.

I'll try to update my Qemu version and see if I still have this problem.
Comment 3 canardo 2019-12-21 12:28:26 UTC
Qemu version now updated to version 4.2.0 (still running on Ubuntu 18.04 LTS), launch with
sudo qemu-system-ppc64 -M pseries-2.12-sxxm -smp 2 -drive file=qfreebsdppc64.qcow -m 6G -net user,hostfwd=tcp::10022-:22 -net nic

With FreeBSD ports updated today, still the same error than described above:

/usr/local/bin/ld: warning: cp/cxx-pretty-print.o has a corrupt string table index - ignoring
/usr/local/bin/ld: error: cp/cxx-pretty-print.o: ELF section name out of range

Setup and config are the default ones (except if I change something by mistake, but I didn't tweak my config).

Any ideas what I can check/test/run to investigate ?
Comment 4 Piotr Kubaj freebsd_committer 2019-12-21 14:44:42 UTC
(In reply to canardo from comment #3)
Could you try building in Poudriere?
GCC8 builds also on pylon, which builds official FreeBSD/powerpc64 packages:
Comment 5 canardo 2019-12-24 08:41:14 UTC
(In reply to Piotr Kubaj from comment #4)

Strange thing happens.
After cleaning the build cache (for the first time after migration to qemu 4.2.0), GCC8 build was successful.

My guest is Qemu 2.11 is too old, and had rotten the build cache.

So this ticket can, I guess, be closed. 
And we should keep in mind to not use an old version of Qemu to avoid problems.
Comment 6 Gerald Pfeifer freebsd_committer 2019-12-24 11:20:51 UTC
Thanks for following up.

(In general I don't recommend reporting issues happening with FreeBSD
running on qemu running on a different operating system, that's just 
quite a lot of variables/indirections.)
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2019-12-25 01:56:17 UTC
^Triage: Assign to committer that resolved