svn commit: trunk/buildroot/package
Author: laird
Date: 2008-11-06 04:54:29 -0800 (Thu, 06 Nov 2008) New Revision: 23943
Log:
package/Makefile.in: rpath setup for toolchains.
Apply the patch I posted some time ago that fixes rpath issues with external toolchains.
Has been tested by users of buildroot and feedback looks good.
Modified:
trunk/buildroot/package/Makefile.in
Changeset:
Modified: trunk/buildroot/package/Makefile.in
===================================================================
buildroot/package/Makefile.in +4 -3
@@ -39,7 +39,7 @@ ifeq ($(BR2_TOOLCHAIN_SOURCE),y) TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) \ -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib +TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/usr/lib ifeq ($(BR2_TOOLCHAIN_SYSROOT),y) TARGET_CFLAGS+= $(BR2_SYSROOT) $(BR2_ISYSROOT) TARGET_LDFLAGS+= $(BR2_SYSROOT)
@@ -91,7 +91,7 @@ else TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include TARGET_CXXFLAGS=$(TARGET_CFLAGS) -TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib +TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/usr/lib endif ######################################################################### #ifeq ($(BR2_ROOTFS_SUFFIX),)
@@ -196,7 +196,8 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ AR="$(TARGET_AR)" \ AS="$(TARGET_AS)" \ - LD="$(TARGET_LD) $(TARGET_LDFLAGS)" \ + LD="$(TARGET_LD)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ NM="$(TARGET_NM)" \ CC="$(TARGET_CC) $(TARGET_CFLAGS)" \ GCC="$(TARGET_CC) $(TARGET_CFLAGS)" \
Quoted 10 lines · laird at uclibc.org
Author: laird
Date: 2008-11-06 04:54:29 -0800 (Thu, 06 Nov 2008) New Revision: 23943Log:
package/Makefile.in: rpath setup for toolchains.Apply the patch I posted some time ago that fixes rpath issues with external toolchains.
Has been tested by users of buildroot and feedback looks good.
Quoted 7 lines
Signed-off-by Thomas PetazzoniSigned-off-by Daniel Laird <[email protected]>Modified:
trunk/buildroot/package/Makefile.in
Just updated to revision 23943. The patch looked liked it would fix the issues I have with compiling mtd. But, no good I still get errors.
.../usr/local/arm/4.1.1-920t/bin/arm-linux-gcc -o /home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2 /home/bigguiness/buildroot/build_arm/mtd_orig/crc32.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_rtime.o /home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_zlib.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_lzo.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr.o -lz -llzo2 /usr/local/arm/4.1.1-920t/lib/gcc/arm-linux-uclibc/4.1.1/../../../../arm -linux-uclibc/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[1]: *** [/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2] Error 1
...
In order to get mtd to build correctly I have to patch mtd.mk as follows:
$(MTD_BUILD_TARGETS): $(MTD_DIR)/.unpacked
mkdir -p $(TARGET_DIR)/usr/sbin $(MAKE) CFLAGS="-I. -I./include -I$(LINUX_HEADERS_DIR)/include -I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ BUILDDIR=$(MTD_DIR) \ CROSS=$(TARGET_CROSS) CC=$(TARGET_CC)
LINUXDIR=$(LINUX26_DIR) WITHOUT_XATTR=1 -C $(MTD_DIR)
With the patch above the compile output is:
.../usr/local/arm/4.1.1-920t/bin/arm-linux-gcc -L/home/bigguiness/buildroot/build_arm/staging_dir/lib -L/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -o /home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2 /home/bigguiness/buildroot/build_arm/mtd_orig/crc32.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_rtime.o /home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_zlib.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr_lzo.o /home/bigguiness/buildroot/build_arm/mtd_orig/compr.o -lz -llzo2
...
It appears mtd is using gcc to link the objects and not ld so the correct flags are not getting passed.
Hartley
Le Thu, 6 Nov 2008 10:54:56 -0500, "hartleys" <[email protected]> a ?crit :
Quoted 13 lines
Just updated to revision 23943. The patch looked liked it would fix the issues I have with compiling mtd. But, no good I still get errors.
In order to get mtd to build correctly I have to patch mtd.mk as follows:
$(MTD_BUILD_TARGETS): $(MTD_DIR)/.unpacked
mkdir -p $(TARGET_DIR)/usr/sbin $(MAKE) CFLAGS="-I. -I./include -I$(LINUX_HEADERS_DIR)/include(quoted diff) +1
-1-I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \BUILDDIR=$(MTD_DIR) \ CROSS=$(TARGET_CROSS) CC=$(TARGET_CC)
Quoted 1 line
LINUXDIR=$(LINUX26_DIR) WITHOUT_XATTR=1 -C $(MTD_DIR)
The modification made by Daniel Laird concerns TARGET_CONFIGURE_OPTS, a variable used in *.mk files of packages relying on the classical ./configure machinery.
For mtd, there's no such ./configure machinery, so adaptations to make the package buildable with an external toolchain must be made directly to the .mk file, with a patch like the one you proposed.
Sincerly,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com
My change will not have quite made it there due to MTD using its own variables.
I think I have a local change much like the one you have indicated. I wonder if mtd 1.2 etc can be autotool'ed?
I am just putting the finishing touches to the patch I spoke about which allows
use of a config.cache file (configurable)
It is throwing up the occasional dependency that is not correct at the moment.
Hopefully once in configuring will be faster and better than it is right now.....
Cheers
Dan Laird
--------------------------------------------------
From: "hartleys" <[email protected]>
Sent: Thursday, November 06, 2008 3:54 PM
To: <[email protected]>
Subject: Re: [Buildroot] svn commit: trunk/buildroot/package
Quoted 78 lines · laird at uclibc.org
Quoted 10 lines
Author: laird
Date: 2008-11-06 04:54:29 -0800 (Thu, 06 Nov 2008) New Revision: 23943Log:
package/Makefile.in: rpath setup for toolchains.Apply the patch I posted some time ago that fixes rpath issues with external toolchains.
Has been tested by users of buildroot and feedback looks good.Quoted 7 lines
Signed-off-by Thomas PetazzoniSigned-off-by Daniel Laird <[email protected]>Modified:
trunk/buildroot/package/Makefile.inJust updated to revision 23943. The patch looked liked it would fix the issues I have with compiling mtd. But, no good I still get errors.
...
/usr/local/arm/4.1.1-920t/bin/arm-linux-gcc-o/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2/home/bigguiness/buildroot/build_arm/mtd_orig/crc32.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_rtime.o/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_zlib.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_lzo.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr.o-lz -llzo2/usr/local/arm/4.1.1-920t/lib/gcc/arm-linux-uclibc/4.1.1/../../../../arm-linux-uclibc/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[1]: *** [/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2] Error 1
...In order to get mtd to build correctly I have to patch mtd.mk as follows:
$(MTD_BUILD_TARGETS): $(MTD_DIR)/.unpacked
mkdir -p $(TARGET_DIR)/usr/sbin
$(MAKE) CFLAGS="-I. -I./include -I$(LINUX_HEADERS_DIR)/include -I$(STAGING_DIR)/usr/include $(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)" \
BUILDDIR=$(MTD_DIR) \
CROSS=$(TARGET_CROSS) CC=$(TARGET_CC) LINUXDIR=$(LINUX26_DIR) WITHOUT_XATTR=1 -C $(MTD_DIR)With the patch above the compile output is:
...
/usr/local/arm/4.1.1-920t/bin/arm-linux-gcc(quoted diff) +0
-6-L/home/bigguiness/buildroot/build_arm/staging_dir/lib -L/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -o
/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2/home/bigguiness/buildroot/build_arm/mtd_orig/crc32.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_rtime.o/home/bigguiness/buildroot/build_arm/mtd_orig/mkfs.jffs2.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_zlib.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr_lzo.o/home/bigguiness/buildroot/build_arm/mtd_orig/compr.o-lz -llzo2
...It appears mtd is using gcc to link the objects and not ld so the correct flags are not getting passed.
Hartley
_______________________________________________
buildroot mailing list
buildroot at uclibc.org
http://busybox.net/mailman/listinfo/buildroot
Quoted 5 lines · Dan Laird
My change will not have quite made it there due to MTD using its own variables.
I think I have a local change much like the one you have indicated. I wonder if mtd 1.2 etc can be autotool'ed?
Not sure about 1.2, currently ./package/mtd/mtd-utils/mtd.mk fetches 1.1.0 which just has a Makefile build.
Quoted 3 lines
I am just putting the finishing touches to the patch I spoke about which allows use of a config.cache file (configurable) It is throwing up the occasional dependency that is not correct at the
moment.
Quoted 1 line
Hopefully once in configuring will be faster and better than it is
right
Quoted 1 line
now.....
Just ran into another problem with the patch.
I deleted my generated root filesystem and kernel to make sure everything still works. I'm not sure of the "correct" way to do this so I just deleted the following:
./binaries/*/*
./project_build_arm/*/autotools-stamps/*
./project_build_arm/*/root
./project_build_arm/*/.root
I have done this before and it worked then.
When I try a make with you patch I get an error right after the external toolchain libraries have been copied to the filesystem.
I think the next step is when buildroot tries to build the kernel modules. This is the error message:
rm -rf /home/bigguiness/buildroot/project_build_arm/ep9307/root/lib/modules/2.6 .27.4
rm -f /home/bigguiness/buildroot/project_build_arm/ep9307/root/sbin/cardmgr /usr/bin/make -j1 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=arm CFLAGS_KERNEL="-Os -I/home/bigguiness/buildroot/build_arm/staging_dir/include -I/home/bigguiness/buildroot/build_arm/staging_dir/usr/include -I/usr/local/arm/4.1.1-920t/arm-linux/include" INSTALL_MOD_PATH=/home/bigguiness/buildroot/project_build_arm/ep9307/roo t CROSS_COMPILE=/usr/local/arm/4.1.1-920t/bin/arm-linux- LDFLAGS="-L/home/bigguiness/buildroot/build_arm/staging_dir/lib -L/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib" LZMA="/home/bigguiness/buildroot/toolchain_build_arm/bin/lzma" -C /home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4 modules
make[1]: Entering directory `/home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4'
CHK include/linux/version.h
make[2]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented <stdin>:1265:2: warning: #warning syscall migrate_pages not implemented <stdin>:1321:2: warning: #warning syscall pselect6 not implemented <stdin>:1325:2: warning: #warning syscall ppoll not implemented <stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
Building modules, stage 2.
MODPOST 1 modules
LD [M] drivers/scsi/scsi_wait_scan.ko/usr/local/arm/4.1.1-920t/bin/arm-linux-ld: unrecognized option '-Wl,--rpath-link' /usr/local/arm/4.1.1-920t/bin/arm-linux-ld: use the --help option for usage information
make[2]: *** [drivers/scsi/scsi_wait_scan.ko] Error 1 make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4'
make: *** [/home/bigguiness/buildroot/project_build_arm/ep9307/root/lib/modules/2. 6.27.4/modules.dep] Error 2
Removing the -Wl,--rpath-link -Wl,$(STAGING_DIR)/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/usr/lib stuff makes everything work again.
Hartley
i will pull it again!
And see if I can rework it. I do not build the kernel in buildroot so had not seen this issue.
I am a little confused of how to solve this issue as this patch fixes other bugs.
But lets pull it ASAP and see if i can generate a better patch!
I will be posting my patch here first again(before commiting), if you would be prepared to try it so that I can get a check before I commit that would be really helpful
Cheers and sorry for the hassle
Daniel Laird
--------------------------------------------------
From: "hartleys" <[email protected]>
Sent: Thursday, November 06, 2008 6:11 PM
To: <[email protected]>; <[email protected]>
Subject: RE: [Buildroot] svn commit: trunk/buildroot/package
Quoted 89 lines · Dan Laird
Quoted 5 lines
My change will not have quite made it there due to MTD using its own variables.
I think I have a local change much like the one you have indicated. I wonder if mtd 1.2 etc can be autotool'ed?
Not sure about 1.2, currently
./package/mtd/mtd-utils/mtd.mkfetches 1.1.0 which just has aMakefilebuild.Quoted 3 lines
I am just putting the finishing touches to the patch I spoke about which allows use of a config.cache file (configurable) It is throwing up the occasional dependency that is not correct at the
moment.
Quoted 1 line
Hopefully once in configuring will be faster and better than it is
right
Quoted 1 line
now.....
Just ran into another problem with the patch.
I deleted my generated root filesystem and kernel to make sure everything still works. I'm not sure of the "correct" way to do this so I just deleted the following:
./binaries/*/*
./project_build_arm/*/autotools-stamps/*
./project_build_arm/*/root
./project_build_arm/*/.rootI have done this before and it worked then.
When I try a make with you patch I get an error right after the external toolchain libraries have been copied to the filesystem.
I think the next step is when buildroot tries to build the kernel modules. This is the error message:
rm -rf
/home/bigguiness/buildroot/project_build_arm/ep9307/root/lib/modules/2.6.27.4
rm -f/home/bigguiness/buildroot/project_build_arm/ep9307/root/sbin/cardmgr/usr/bin/make-j1 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=arm CFLAGS_KERNEL="-Os(quoted diff) +0
-3-I/home/bigguiness/buildroot/build_arm/staging_dir/include -I/home/bigguiness/buildroot/build_arm/staging_dir/usr/include -I/usr/local/arm/4.1.1-920t/arm-linux/include"INSTALL_MOD_PATH=/home/bigguiness/buildroot/project_build_arm/ep9307/roo t CROSS_COMPILE=/usr/local/arm/4.1.1-920t/bin/arm-linux- LDFLAGS="-L/home/bigguiness/buildroot/build_arm/staging_dir/lib
(quoted diff) +0
-5-L/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/lib -Wl,--rpath-link -Wl,/home/bigguiness/buildroot/build_arm/staging_dir/usr/lib"LZMA="/home/bigguiness/buildroot/toolchain_build_arm/bin/lzma" -C
/home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4modules
make[1]: Entering directory `/home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4'
CHKinclude/linux/version.h
make[2]: `include/asm-arm/mach-types.h' is up to date.
CHKinclude/linux/utsrelease.h
CALLscripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented <stdin>:1265:2: warning: #warning syscallmigrate_pagesnot implemented <stdin>:1321:2: warning: #warning syscall pselect6 not implemented <stdin>:1325:2: warning: #warning syscall ppoll not implemented <stdin>:1365:2: warning: #warning syscallepoll_pwaitnot implemented
Building modules, stage 2.
MODPOST 1 modules
LD [M]drivers/scsi/scsi_wait_scan.ko/usr/local/arm/4.1.1-920t/bin/arm-linux-ld: unrecognized option '-Wl,--rpath-link'/usr/local/arm/4.1.1-920t/bin/arm-linux-ld: use the --help option for usage information
make[2]: *** [drivers/scsi/scsi_wait_scan.ko] Error 1 make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/bigguiness/buildroot/project_build_arm/ep9307/linux-2.6.27.4'
make: *** [/home/bigguiness/buildroot/project_build_arm/ep9307/root/lib/modules/2. 6.27.4/modules.dep] Error 2Removing the -Wl,--rpath-link -Wl,$(STAGING_DIR)/lib -Wl,--rpath-link -Wl,$(STAGING_DIR)/usr/lib stuff makes everything work again.
Hartley
Le Thu, 6 Nov 2008 13:11:01 -0500, "hartleys" <[email protected]> a ?crit :
Quoted 5 lines
LD [M]
drivers/scsi/scsi_wait_scan.ko/usr/local/arm/4.1.1-920t/bin/arm-linux-ld: unrecognized option '-Wl,--rpath-link'/usr/local/arm/4.1.1-920t/bin/arm-linux-ld: use the --help option for usage information
Hum. -Wl,--rpath-link is supposed to be passed to the C compiler, the -Wl prefix telling the compiler to pass the option to the linker. But here -Wl,--rpath-link is passed to the linker directly, which obviously doesn't work. (See
http://lists.openmoko.org/pipermail/openmoko-kernel/2008-May/002772.html
for people having the same kind of issue).
*However*, I'm not sure having -Wl,--rpath-link when building the kernel is necessary. But because the kernel Makefile does LDFLAGS="$(TARGET_LDFLAGS)", and the TARGET_LDFLAGS variable is modified by Daniel's patch, that's why you hit this problem now.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com