Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 475210

Summary: dev-lang/fpc-2.6.2 with ld.gold fails in make -C fastcgi all (fpc-3.2.2: ld: error: ./link178.res:292:8: syntax error, unexpected STRING)
Product: Gentoo Linux Reporter: Maks Verver <maksverver>
Component: Current packagesAssignee: Amy Liffey <amynka>
Status: RESOLVED OBSOLETE    
Severity: normal CC: esigra, gmt, iade.gesso, ionen, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard: [ignore-for-stabilization]
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 269315    
Attachments: build.log
0001-dev-lang-fpc-never-link-with-gcc-s-ld.gold.patch
3.2.2 .ebulid avoiding the use of GOLD linker silently

Description Maks Verver 2013-06-29 12:32:31 UTC
Free Pascal doesn't compile correctly when linking with GNU gold, but since the error doesn't appear at link time, this creates a rather obscure build failure (a segfault in fpmake).

A workaround is to switch back to the libbfd-based linker temporarily, but since that can't be done automatically from the ebuild, it would be helpful if the ebuild would detect when Gold is being used, and print an error message (like is done for the grub-2 ebuilds, for example).  That could save users a lot of time hunting down the cause of the build failure.

Reproducible: Always

Steps to Reproduce:
binutils-config --linker ld.gold
emerge dev-lang/fpc
Actual Results:  
Build fails invoking fpmake (see attached build.log)


Expected Results:  
Build succeeds.

Portage 2.1.12.10 (default/linux/amd64/13.0/desktop, gcc-4.7.3, glibc-2.17, 3.8.13-gentoo x86_64)
=================================================================
System uname: Linux-3.8.13-gentoo-x86_64-AMD_Athlon-tm-_64_Processor_3000+-with-gentoo-2.2
KiB Mem:     2054640 total,     80516 free
KiB Swap:     522076 total,    233076 free
Timestamp of tree: Fri, 28 Jun 2013 20:15:01 +0000
ld GNU gold (GNU Binutils 2.23.1) 1.11
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5, 3.3.2
dev-util/cmake:           2.8.11.1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8::pentoo
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.14
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.7.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo x-portage-crossdev spring gentoo-haskell sunrise java-overlay pentoo local
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Q3AEULA RTCW-ETEULA dlj-1.1 Oracle-BCLA-JavaSE skype-4.0.0.7-copyright AdobeFlash-11.x"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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="/usr/local/portage-crossdev /var/lib/layman/Spring /var/lib/layman/haskell /var/lib/layman/sunrise /var/lib/layman/java-overlay /var/lib/layman/pentoo /usr/local/portage"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 apng audioscrobbler berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups curl cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran ftp gdbm gif glut gnutls gpm gtk iconv imap ipod ipv6 jabber jpeg jpeg2k kpathsea lame latex lcms libnotify lm_sensors mad matroska mmx mmxext mng mod modplug modules mp3 mp4 mpeg mplayer mudflap multilib musepack musicbrainz ncurses network nls nptl nsplugin ogg openal opengl openmp pam pango pcre pdf perl pic png policykit ppds python qt3support qt4 readline samba sdl session sndfile spell sqlite sse sse2 ssl startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower usb v4l2 vorbis win32codecs wxwidgets x264 xcb xine xinerama xml xv xvid zlib" ABI_X86="32 64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" 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" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" 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, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Maks Verver 2013-06-29 12:33:36 UTC
Created attachment 352234 [details]
build.log
Comment 2 Julian Ospald 2013-07-29 19:56:42 UTC
is 2.6.2 affected?
Comment 3 Julian Ospald 2013-07-29 20:14:08 UTC
+  29 Jul 2013; Julian Ospald <hasufell@gentoo.org> fpc-2.6.2.ebuild:
+  die hard on gnu gold linker wrt #475210


THIS IS NOT A FIX, SO KEEP THIS BUG OPEN
Comment 4 Greg Turner 2015-09-26 05:46:53 UTC
Created attachment 412928 [details, diff]
0001-dev-lang-fpc-never-link-with-gcc-s-ld.gold.patch

This is a good-enough solution for now imo.  But see the attachment: I think we should really fix by adding similar to toolchain-functions.eclass (actually it already has the code to do it; it just rarely runs, plus, when it does run, it doesn't finish the job by modifying and exporting PATH).
Comment 5 Pacho Ramos gentoo-dev 2019-12-13 16:07:57 UTC
is 3.0.4 able to get built with gold?
Comment 6 Sergey Torokhov 2021-06-13 19:22:23 UTC
(In reply to Pacho Ramos from comment #5)
> is 3.0.4 able to get built with gold?

Rebuild binutils[gold,default-gold] and then try build fpc. Error is presented:

...
make cycleclean compiler
make[4]: Entering directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler'
/bin/rm -f pp pp.o libppp.a libimppp.a
/bin/rm -rf units
/bin/rm -rf bin
/bin/rm -f *.o *.ppu *.rst *.s *.a *.so *.ppl
/bin/rm -rf *.sl
/bin/rm -f fpcmade.* Package.fpc ./ppas.sh script.res link.res  
/bin/rm -f *_ppas.sh ppas.sh ppaslink.sh
make -C utils cleanall
make[5]: Entering directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler/utils'
/bin/rm -f fpc ppufiles ppudump ppumove mka64ins mkarmins mkx86ins fpc.o ppufiles.o ppudump.o ppumove.o mka64ins.o mkarmins.o mkx86ins.o libpfpc.a libpppufiles.a libpppudump.a libpppumove.a libpmka64ins.a libpmkarmins.a libpmkx86ins.a libimpfpc.a libimpppufiles.a libimpppudump.a libimpppumove.a libimpmka64ins.a libimpmkarmins.a libimpmkx86ins.a
/bin/rm -f units/x86_64-linux/ppu.ppu units/x86_64-linux/crc.ppu
/bin/rm -rf units
/bin/rm -rf bin
/bin/rm -f *.o *.ppu *.rst *.s *.a *.so *.ppl
/bin/rm -rf *.sl
/bin/rm -f fpcmade.* Package.fpc ./ppas.sh script.res link.res  
/bin/rm -f *_ppas.sh ppas.sh ppaslink.sh
make[5]: Leaving directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler/utils'
/bin/rm -rf x86_64/units
/bin/rm -rf x86_64/bin
/bin/rm -f x86_64/*.o x86_64/*.ppu x86_64/*.rst x86_64/*.s x86_64/*.a x86_64/*.so x86_64/*.ppl
/bin/rm -f x86_64/ppc386 x86_64/ppc68k x86_64/ppcppc x86_64/ppcsparc x86_64/ppcarm x86_64/ppcarmeb x86_64/ppcx64 x86_64/ppcppc64 x86_64/ppcmips x86_64/ppcmipsel x86_64/ppcavr x86_64/ppcjvm x86_64/ppc8086 x86_64/ppca64 x86_64/ppcsparc64
/bin/rm -f ppcx64
/bin/mkdir -p x86_64/units/x86_64-linux
/var/tmp/portage/dev-lang/fpc-3.2.2/work/lib/fpc/3.2.2/ppcx64 -Ur -O2 -n -Fux86_64 -Fusystems -Fu/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/rtl/units/x86_64-linux -Fix86_64 -FE. -FUx86_64/units/x86_64-linux -Cg -dRELEASE -dx86_64 -dGDB -dBROWSERLOG -Fux86 pp.pas
/usr/bin/ld: error: ./link179.res:292:8: syntax error, unexpected STRING
/usr/bin/ld: fatal error: unable to parse script file ./link179.res
pp.pas(266,1) Error: Error while linking
pp.pas(266,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[4]: *** [Makefile:4283: ppcx64] Error 1
make[4]: Leaving directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler'
make[3]: *** [Makefile:4331: next] Error 2
make[3]: Leaving directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler'
make[2]: *** [Makefile:4335: ppc1] Error 2
make[2]: Leaving directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler'
make[1]: *** [Makefile:4347: cycle] Error 2
make[1]: Leaving directory '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc/compiler'
make: *** [Makefile:2800: compiler_cycle] Error 2
 * ERROR: dev-lang/fpc-3.2.2::local failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/fpc-3.2.2::local'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/fpc-3.2.2::local'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/fpc-3.2.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/fpc-3.2.2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc'
 * S: '/var/tmp/portage/dev-lang/fpc-3.2.2/work/fpcbuild-3.2.2/fpcsrc'
Comment 7 Ionen Wolkens gentoo-dev 2021-06-30 19:30:15 UTC
*** Bug 798921 has been marked as a duplicate of this bug. ***
Comment 8 Ionen Wolkens gentoo-dev 2021-06-30 19:36:53 UTC
Errors have changed but this indeed still fails with gold.

Given binutils-config no longer allow to select ld.bfd, it led to a mistaken change of the gold check (see duplicate bug #798921)

So "solutions" would range from:
1. re-add old check but tell users to disable USE=default-gold instead
2. depend on binutils[-default-gold] (I wish this flag didn't even exist)
3. run tc-ld-force-bfd and use the exported value to either create a shell wrapper or a symlink in PATH (this would also "fix" calling ld directly)
4. try to figure out how to fix this properly if someone is willing

#3 is similar to what comment #4 proposed, although by using tc-* it'd be simplified.

Not familiar with fpc but, considering it's a compiler, does this matter at runtime as well? If so, may be better off with #2 if going for a quick fix.
Comment 9 Larry the Git Cow gentoo-dev 2021-06-30 21:56:28 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f82b9b107ec751c104024e0c0080c1a52868ba8

commit 0f82b9b107ec751c104024e0c0080c1a52868ba8
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2021-06-30 21:30:03 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2021-06-30 21:55:45 +0000

    dev-lang/fpc: re-add old-style gold check with updated message
    
    The previous check would ask to use binutils-config which is no
    longer possible, and tc-ld-disable-gold is not sufficient.
    
    Re-adding is only a temporary solution, this needs a proper look
    into making it respect $LD (emake LD=.. is not enough).
    
    Also revert Makefile sed style to how it was formerly suggested
    by Sergey Torokhov in previous bump, devmanual's old suggestion
    isn't useful here (this bit Acked-by David Seifert).
    
    Bug: https://bugs.gentoo.org/475210
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 dev-lang/fpc/fpc-3.2.2.ebuild | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
Comment 10 Iade Gesso 2021-07-03 14:42:36 UTC
I manually patched the .ebuild file for version 3.2.2 and it worked! :) See in the attachments.


Iade
Comment 11 Iade Gesso 2021-07-03 14:43:47 UTC
Created attachment 721261 [details]
3.2.2 .ebulid avoiding the use of GOLD linker silently
Comment 12 Amy Liffey gentoo-dev 2022-02-02 14:59:54 UTC
Seems to be resolved in new version.