Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 488176 - app-emulation/virtualbox-4.3.0 fails with ld.gold - ld: internal error in segment_precedes, at /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/gold/layout.cc:3100
Summary: app-emulation/virtualbox-4.3.0 fails with ld.gold - ld: internal error in seg...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-16 07:28 UTC by Justin Lecher (RETIRED)
Modified: 2016-09-02 15:40 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
virtualbox-4.3.0:20131016-063642.log.xz (virtualbox-4.3.0:20131016-063642.log.xz,107.19 KB, text/plain)
2013-10-16 07:29 UTC, Justin Lecher (RETIRED)
Details
virtualbox-4.3.32.ebuild.patch (patch,818 bytes, patch)
2015-11-24 18:03 UTC, Ian Stakenvicius (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2013-10-16 07:28:07 UTC
tualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/transitions/librm.o  
ld: internal error in segment_precedes, at /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/gold/layout.cc:3100
kmk: *** [/var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/iPxeBaseBin] Error 1
kmk: *** Waiting for unfinished jobs....
kmk_builtin_append -n "/var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/VBoxOGLhostcrpacker/gen/VBoxOGLgen/packer.o.dep" "" "/var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/VBoxOGLgen/packer.c:" ""
/var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/filesplitter/filesplitter /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/VBoxAPIWrap/apiwrappers /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/VBoxAPIWrap
filesplitter: Out of 286 files: 0 rewritten, 286 unchanged. (/var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/VBoxAPIWrap)



$ einfo =app-emulation/virtualbox-4.3.0
Portage 2.2.7 (default/linux/amd64/13.0, gcc-4.8.1-asneeded, glibc-2.17, 3.10.16-lh x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.10.16-lh-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16468452 total,    506104 free
KiB Swap:    4000180 total,   3998248 free
Timestamp of tree: Wed, 16 Oct 2013 06:00:01 +0000
ld GNU gold (GNU Binutils 2.23.2) 1.11
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5-r2, 3.2.5-r2
dev-util/ccache:          3.1.9-r2::science
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.2
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.1.2, 4.7.3-r1, 4.8.1-r1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.11 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo sunrise bicatali betagarden dummy Neurogeek science last-hope
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g -Wimplicit-function-declaration"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/eselect/ /usr/share/gnupg/qualified.txt /usr/share/nano/ /var/lib/hsqldb /var/spool/munin-async/.ssh /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g -Wenum-compare"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS=" -vt --keep-going --autounmask-write --autounmask --quiet-build=n"
FCFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g"
FEATURES="assume-digests binpkg-logs buildsyspkg ccache cgroup collision-protect compressdebug distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news noinfo parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g"
GENTOO_MIRRORS=" /mnt/tmpfs/ http://gentoo.j-schmitz.net/mirror/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"
MAKEOPTS="-j4 -l8"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-z -e -9 -v"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--omit-dir-times"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/local/overlays/sunrise-reviewed /local/overlays/bicatali /local/overlays/betagarden /local/overlays/dummy /local/overlays/neurogeek /local/overlays/sci /local/overlays/lh-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 avx bash-completion berkdb branding bzip2 cairo caps cli cracklib crypt cups cxx dbus dri fortran gdbm gif gmp gstreamer gtk iconv icu ipv6 jpeg jpeg2k ldap logrotate mmx mmxext modules mudflap multilib ncurses network-cron nls nptl nsplugin numa opengl openmp pam pcre pgo png pulseaudio qt3support readline session smp sse sse2 sse2_4way sse2check sse3 sse4 sse41 sse4_1 sse4a sse5 ssl ssse3 startup-notification tcpd threads tiff truetype unicode vaapi vdpau xinerama zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="efi-32 efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer pdfimport scripting-javascript wiki-publisher nlpsolver" LINGUAS="en" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi stub_status" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="i386 x86_64 arm armeb" QEMU_USER_TARGETS="i386 x86_64 arm armeb" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, USE_PYTHON
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2013-10-16 07:29:07 UTC
Created attachment 360988 [details]
virtualbox-4.3.0:20131016-063642.log.xz

build.log
Comment 2 Alex Xu (Hello71) 2013-10-20 18:28:03 UTC
upstream bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12898
Comment 3 Alex Xu (Hello71) 2013-11-02 18:42:50 UTC
Reproducible with sys-devel/binutils-2.23.2 and app-emulation/virtualbox-4.3.0-r2.
Comment 4 Paolo Pedroni 2014-07-11 13:00:38 UTC
Reproducible with sys-devel/binutils-2.24-r3 and app-emulation/virtualbox-4.3.12.

BTW, upstream bug is marked as RESOLVED FIXED in 2011. Does anyone know in which version of ld.gold the fixes landed?
Comment 5 Paolo Pedroni 2014-07-11 15:43:54 UTC
BTW, one other problem is that the virtualbox build system, at least at that point, does not respect the LD and/or LDFLAGS environment variables. We can see that the ld command is called directly:

ld               -N --no-check-sections --gc-sections -T /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/src/VBox/Devices/PC/ipxe/src/arch/i386/scripts/i386.lds -u _rom_start  --defsym check__rom_start=_rom_start -u obj_config  --defsym check_obj_config=obj_config --defsym pci_vendor_id=0x8086 --defsym pci_device_id=0x100E -e _rom_start -m elf_i386      -o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/iPxeBaseBin /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/basemem_packet.o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/relocate.o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/timer2.o
[...snip...]

Otherwise one could work around this issue with a file in /etc/portage/env with something like:
LD="/usr/bin/ld.bfd"
CFLAGS="${CFLAGS} -fuse-ld=bfd"
CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd"
LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=bfd"

(as I do for the few packages that have problems with ld.gold)
Comment 6 Alex Xu (Hello71) 2014-07-11 16:54:43 UTC
(In reply to Paolo Pedroni from comment #5)
> BTW, one other problem is that the virtualbox build system, at least at that
> point, does not respect the LD and/or LDFLAGS environment variables. We can
> see that the ld command is called directly:
> 
> ld               -N --no-check-sections --gc-sections -T
> /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/src/
> VBox/Devices/PC/ipxe/src/arch/i386/scripts/i386.lds -u _rom_start  --defsym
> check__rom_start=_rom_start -u obj_config  --defsym
> check_obj_config=obj_config --defsym pci_vendor_id=0x8086 --defsym
> pci_device_id=0x100E -e _rom_start -m elf_i386      -o
> /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/
> linux.amd64/release/obj/iPxeBaseBin/iPxeBaseBin
> /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/
> linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/basemem_packet.o
> /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/
> linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/relocate.o
> /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/
> linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/timer2.o
> [...snip...]
> 
> Otherwise one could work around this issue with a file in /etc/portage/env
> with something like:
> LD="/usr/bin/ld.bfd"
> CFLAGS="${CFLAGS} -fuse-ld=bfd"
> CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd"
> LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=bfd"
> 
> (as I do for the few packages that have problems with ld.gold)

known issue, irrelevant for this bug
Comment 7 Nuno Silva 2015-07-08 06:21:07 UTC
Reproducible with virtualbox-4.3.28, binutils 2.24-r3 (amd64):

ld: internal error in segment_precedes, at /var/tmp/portage/sys-devel/binutils-2.24-r3/work/binutils-2.24/gold/layout.cc:3336
Comment 8 SpanKY gentoo-dev 2015-08-27 17:17:44 UTC
does binutils-2.25.1 work any better ?
Comment 9 Justin Lecher (RETIRED) gentoo-dev 2015-08-28 08:17:36 UTC
(In reply to SpanKY from comment #8)
> does binutils-2.25.1 work any better ?

Still the same.
Comment 10 Ian Stakenvicius (RETIRED) gentoo-dev 2015-11-24 18:03:21 UTC
Created attachment 417764 [details, diff]
virtualbox-4.3.32.ebuild.patch

Regardless of whether or not those patches from upstream fix the bug, it seems that the ipxe/ portion of the build system is hard-coding linker stuff and/or not using the ld and ldflags specified by the configure stage.

Firstly, ipxe has it's own makefile that uses CC, LD, etc directly (with defaults assigned), so we need to tc-export all the usual variables in order for that makefile to not use the generic defaults.

Secondly, ipxe also has a Makefile.kmk that uses a hard-coded 'ld'd) to match ipxe's own makefile.

With these two changes, we can also use 'tc-ld-disable-gold' as a workaround if the patches from upstream don't work.

The attached patch adds these changes to virtualbox-4.3.32.ebuild, which test-builds fine here with gcc-4.9.3 and lg.gold globally selected.
Comment 11 SpanKY gentoo-dev 2015-11-24 18:42:47 UTC
we have a system ipxe already, but if vbox wants to keep its own, disabling gold just for that is reasonable.  the low level/bare metal firmware rarely works with gold and upstream isn't generally interested in adding features to fix it.
Comment 12 Paolo Pedroni 2015-11-30 10:31:04 UTC
(In reply to Ian Stakenvicius from comment #10)
> The attached patch adds these changes to virtualbox-4.3.32.ebuild, which
> test-builds fine here with gcc-4.9.3 and lg.gold globally selected.

This works great, same patch applies to virtualbox-5.0.10.ebuild, please apply it to the tree.
Comment 13 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-07 14:53:26 UTC
commit 82049238b1004c9715b574014e1c257924fe0f72
Author: PPed72 <paolo.pedroni@iol.it>
Date:   Mon Mar 7 14:39:26 2016

    app-emulation/virtualbox: force usage of ld.bfd for virtualbox-5
    
    See Gentoo bug #488176
Comment 14 Ian Stakenvicius (RETIRED) gentoo-dev 2016-09-02 15:40:46 UTC
I've just backported this change to virtualbox-4.3.38 and 4.3.40 as well, as link failures on the current stable package are really annoying.