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

Bug 526348

Summary: sys-boot/grub-0.97-r14 with <sys-devel/gcc-4.8 configure: x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-fuse-ld=bfd'
Product: Gentoo Linux Reporter: Jouni Rinne <l33tmmx>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: axs, dschridde+gentoobugs, floppym
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=439082
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
config.log
emerge --info

Description Jouni Rinne 2014-10-21 18:57:56 UTC
Created attachment 387152 [details]
build.log

Sys-boot/grub-0.97-r14 does not compile on amd64:

checking for i686-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc -m32
checking for i686-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc -m32
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/sys-boot/grub-0.97-r14/work/grub-0.97':
configure: error: C compiler cannot create executables
Comment 1 Jouni Rinne 2014-10-21 18:59:51 UTC
Created attachment 387154 [details]
config.log
Comment 2 Jouni Rinne 2014-10-21 19:00:23 UTC
Created attachment 387156 [details]
emerge --info
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-21 19:52:29 UTC
Confirmed with GCC 4.8.3.
Comment 4 Anthony Basile gentoo-dev 2014-10-21 19:56:22 UTC
(In reply to Jeroen Roovers from comment #3)
> Confirmed with GCC 4.8.3.

is this only on i686?  also does it work with gcc 4.7?
Comment 5 Mike Gilbert gentoo-dev 2014-10-21 20:13:30 UTC
The -fuse-ld option was added in gcc-4.8. It generates an error with gcc-4.7.
Comment 6 Mike Gilbert gentoo-dev 2014-10-21 20:16:16 UTC
Also, have a look at sys-boot/grub:2 for a more compatible solution. Snippets below.

pkg_pretend() {
    if [[ ${MERGE_TYPE} != binary ]]; then
        # Bug 439082
        if ! version_is_at_least 4.8 "$(gcc-version)" &&
            $(tc-getLD) --version | grep -q "GNU gold"; then
            eerror "GRUB does not function correctly when built with the gold linker."
            eerror "Please select the bfd linker with binutils-config."
            die "GNU gold detected"
        fi
    fi
}


src_configure() {
...
    if version_is_at_least 4.8 "$(gcc-version)"; then
        export TARGET_LDFLAGS+=" -fuse-ld=bfd"
    fi
...
}
Comment 7 Ian Stakenvicius (RETIRED) gentoo-dev 2014-10-22 17:00:42 UTC
Apologies -- next time I try and fix a system package I will do a lot more testing (including more than one toolchain version) before committing.

@@ -4,0 +5,4 @@
+  22 Oct 2014; Ian Stakenvicius (_AxS_) <axs@gentoo.org> grub-0.97-r14.ebuild:
+  grub:0 - Only apply -fuse-ld=bfd when gcc is new enough to support it, bug
+  526348
+
Comment 8 SpanKY gentoo-dev 2014-10-22 20:47:19 UTC
you shouldn't test gcc versions.  this is why we have test-flags-CC.
 append-ldflags $(test-flags-CC -fuse-ld=bfd)
Comment 9 Mike Gilbert gentoo-dev 2014-10-22 21:03:15 UTC
+  22 Oct 2014; Mike Gilbert <floppym@gentoo.org> grub-2.02_beta2-r2.ebuild,
+  grub-9999-r1.ebuild:
+  Use test-flags-CC instead of gcc-version check, thanks to vapier.
Comment 10 Ian Stakenvicius (RETIRED) gentoo-dev 2014-10-22 21:46:04 UTC
+  22 Oct 2014; Ian Stakenvicius (_AxS_) <axs@gentoo.org>
+  -files/grub-0.97-force-ld.bfd.patch, grub-0.97-r14.ebuild:
+  grub:0 - undid the ugly patch-based hacks for forcing ld.bfd, thanks to vapier
+  and floppym