Summary: | sys-apps/busybox: Linker failure during crosscompile (ld called directly) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Thomas Sachau <tommy> |
Component: | New packages | Assignee: | Embedded Gentoo Team <embedded> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | binki, esigra |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 306835 | ||
Attachments: |
build.log for busybox-1.17.4
build.log busybox-1.18.1-ldflags.patch busybox-1.18.1-ldflags.patch busybox-1.18.3.ebuild-kill-ld.patch |
Description
Thomas Sachau
2010-11-27 13:04:54 UTC
Created attachment 255577 [details]
build.log for busybox-1.17.4
I now found the var to make the output verbose, which tells me, that the compile calls do just call "gcc" instead of using full gcc name and those calls dont include $CFLAGS, so they create 64bit output. The following linker call then fails due to mixing 64bit/32bit during the attempt to crosscompile busybox. I will attach a new build.log which shows this issue. Created attachment 257776 [details]
build.log
Created attachment 258280 [details]
busybox-1.18.1-ldflags.patch
Replaces calls to ld with calls to $(CC). Gets rid of the code which filters out -Wl flags from LDFLAGS.
I think that this bug may be a blocker for bug 331933 because busybox's original Makefiles filter out any LDFLAGS arguments which start with -Wl . Regarding comment 2 , tommy[d] was wrong. The applets/usage binary is used during compiletime. Therefore, CC, CFLAGS, and LDFLAGS should not be respected when compiling a compilation-time binary such as applets/usage. Instead, the problem is that "ld" is being called directly. Instead, the compiler driver (gcc) should be called as discussed in bug 308373. Created attachment 258476 [details, diff]
busybox-1.18.1-ldflags.patch
This version fixes new calls to $(CC) which were missing $(CFLAGS).
Created attachment 267327 [details, diff]
busybox-1.18.3.ebuild-kill-ld.patch
Sorry, I feel like I've been blind because I didn't see this simple fix.
The busybox package itself sets
LD = $(CC) -nostdlib
in its Makefile. This gets overwritten by
-e "/^LD\>/s:=.*:= $(tc-getLD):"
in busybox-*.ebuild. So for a month or so I've been attacking the busybox mailing list with patches which replace $(LD) in busybox's Makefiles with $(CC) which solves a problem created by Gentoo's ebuilds :-/.
This patch does the right thing in the right place. Since busybox-*.ebuild already overrides the
CC = $(CROSS_COMPILE)gcc
line with -e "/^CC\>/s:=.*:= $(tc-getCC):", the existing busybox LD variable should pick up this LD=$(CC) setting properly and real cross-compilation should still work.
I've tested that this produces a functional 32-bit busybox executable (which actually normally isn't installed) using portage-multilib and that normal compilation works.
that was set because people were complaining about the LD env var not being respected :P but i dont care http://sources.gentoo.org/sys-apps/busybox/busybox-1.18.3.ebuild?r1=1.1&r2=1.2 |