finding libgcc.a with meta-toolchain-sdk toolchain
Trying to build something like u-boot w/the toolchain produced by meta-toolchain-sdk and get the following:
$ powerpc-poky-linux-gnuspe-ld -g -Ttext 0x40000 -o hello_world -e hello_world hello_world.o libstubs.o -L. -lgcc powerpc-poky-linux-gnuspe-ld: cannot find -lgcc
If I take on a --verbose I get:
attempt to open ./libgcc.so failed
attempt to open ./libgcc.a failed
attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/local/lib/libgcc.so failed attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/local/lib/libgcc.a failed attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/lib/libgcc.so failed attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/lib/libgcc.a failed attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/lib/libgcc.so failed attempt to open /opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/lib/libgcc.a failed
What do we need to tweak so we can find libgcc.a?
- k
Quoted 4 lines · Kumar Gala
Trying to build something like u-boot w/the toolchain produced by meta-toolchain-sdk and get the following:
$ powerpc-poky-linux-gnuspe-ld -g -Ttext 0x40000 -o hello_world -e hello_world hello_world.o libstubs.o -L. -lgcc powerpc-poky-linux-gnuspe-ld: cannot find -lgcc
You are using ld. If you use gcc driver to do the linking it should do better
Quoted 18 lines
If I take on a --verbose I get:
attempt to open ./libgcc.so failed
attempt to open ./libgcc.a failed
attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/local/lib/libgcc.sofailed attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/local/lib/libgcc.afailed attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/lib/libgcc.sofailed attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/lib/libgcc.afailed attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/lib/libgcc.sofailed attempt to open/opt/poky/1.0+snapshot/sysroots/powerpc-poky-linux-gnuspe/usr/lib/libgcc.afailedWhat do we need to tweak so we can find libgcc.a?
- k
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Quoted 8 lines · Kumar Gala
Trying to build something like u-boot w/the toolchain produced by meta-toolchain-sdk and get the following:
$ powerpc-poky-linux-gnuspe-ld -g -Ttext 0x40000 -o hello_world -e hello_world hello_world.o libstubs.o -L. -lgcc powerpc-poky-linux-gnuspe-ld: cannot find -lgcc[...]
What do we need to tweak so we can find libgcc.a?
The best/easiest fix is to link with gcc rather than calling ld directly. You can use -nostartfiles to suppress crt1.o and the like. If you must invoke ld manually for whatever reason then you will have to use something like $(CC) --print-libgcc-file-name to obtain the path to libgcc.
p.
Quoted 8 lines · Phil Blundell
Quoted 7 lines · Kumar Gala
Trying to build something like u-boot w/the toolchain produced by meta-toolchain-sdk and get the following:
$ powerpc-poky-linux-gnuspe-ld -g -Ttext 0x40000 -o hello_world -e hello_world hello_world.o libstubs.o -L. -lgcc powerpc-poky-linux-gnuspe-ld: cannot find -lgcc[...]
Quoted 7 lines
Quoted 1 line
What do we need to tweak so we can find libgcc.a?
The best/easiest fix is to link with gcc rather than calling ld directly. You can use -nostartfiles to suppress crt1.o and the like. If you must invoke ld manually for whatever reason then you will have to use something like
$(CC) --print-libgcc-file-nameto obtain the path to libgcc.
While these are good suggestions, I still think the toolchain is broken as u-boot has been this way for sometime and numerous other cross toolchains work perfectly fine.
- k
Quoted 1 line · Kumar Gala
While these are good suggestions, I still think the toolchain is broken as u-boot has been this way for sometime and numerous other cross toolchains work perfectly fine.
I just tried "ld -lgcc" on my Ubuntu desktop and it didn't work there either. Indeed, there's no way in general for ld to know which libgcc to use since you might have multiple versions of gcc installed on the system.
So, while u-boot might have worked for you before, if it is linking with the command you mentioned (and no extra -L options) then I think it was only working by chance.
p.
RFC 1/1 Fix libgcc nativesdk to install libgcc.a in good location for tools
This fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issue
The previous mv command was failing as the files did not exist and I also rejiggered the packages since I was not sure if gdb-cross-canadian-powerpc-dev was included in my tarball of the toolchain
meta/recipes-devtools/gcc/libgcc_4.6.bb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-devtools/gcc/libgcc_4.6.bb +3 -3
@@ -8,9 +8,8 @@ PACKAGES = "\ ${PN}-dev \ " -FILES_${PN} = "${base_libdir}/libgcc*.so.*" +FILES_${PN} = "${base_libdir}/libgcc*" FILES_${PN}-dev = " \ - ${base_libdir}/libgcc*.so \ ${libdir}/${TARGET_SYS}/${BINV}/crt* \ ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
@@ -29,9 +28,10 @@ do_install () { if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} else - mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true + cp ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc* ${D}${base_libdir} fi + chown -R root:root ${D} chmod +x ${D}${base_libdir}/libgcc_s.so.* }
Signature · 1 line
1.7.6.1
Re: [RFC] Fix libgcc nativesdk to install libgcc.a in good location for tools
Quoted 55 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Matthew McClintock
Sent: Thursday, 27 October 2011 11:07 AM
To: [email protected]
Subject: [OE-core] [RFC] Fix libgcc nativesdk to install libgcc.a in good location for toolsThis fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
Signed-off-by Matthew McClintock <[email protected]>---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issueThe previous mv command was failing as the files did not exist and I also rejiggered the packages since I was not sure if gdb-cross-canadian-powerpc-dev was included in my tarball of the toolchain
meta/recipes-devtools/gcc/libgcc_4.6.bb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)meta/recipes- renamed from meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0devtools/gcc/libgcc_4.6.bb
index 63a46ec..7f3ac55 100644meta/recipes-devtools/gcc/libgcc_4.6.bb +3
-3@@ -8,9 +8,8 @@ PACKAGES = "\ ${PN}-dev \ " -FILES_${PN} = "${base_libdir}/libgcc*.so.*" +FILES_${PN} = "${base_libdir}/libgcc*" FILES_${PN}-dev = " \ - ${base_libdir}/libgcc*.so \ ${libdir}/${TARGET_SYS}/${BINV}/crt* \ ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"@@ -29,9 +28,10 @@ do_install () { if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} else - mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true + cp ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc* ${D}${base_libdir} fi + chown -R root:root ${D} chmod +x ${D}${base_libdir}/libgcc_s.so.*
Quoted 4 lines
}
--
1.7.6.1
Is this perhaps related to the following issue: http://lists.linuxtogo.org/pipermail/openembedded-core/2011-October/011556.html ? Some builds had trouble finding libgcc due to a sysroot misconfiguration, which has since been fixed in master.
James
Re: [RFC] Fix libgcc nativesdk to install libgcc.a in good location for tools
Quoted 52 lines · James Limbouris
Quoted 52 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Matthew McClintock
Sent: Thursday, 27 October 2011 11:07 AM
To: [email protected]
Subject: [OE-core] [RFC] Fix libgcc nativesdk to install libgcc.a in good location for toolsThis fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
Signed-off-by Matthew McClintock <[email protected]>---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issueThe previous mv command was failing as the files did not exist and I also rejiggered the packages since I was not sure if gdb-cross-canadian-powerpc-dev was included in my tarball of the toolchain
meta/recipes-devtools/gcc/libgcc_4.6.bb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)meta/recipes- renamed from meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0devtools/gcc/libgcc_4.6.bb
index 63a46ec..7f3ac55 100644meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0@@ -8,9 +8,8 @@ PACKAGES = "\ ${PN}-dev \"
meta/recipes-devtools/gcc/libgcc_4.6.bb +1
-1-FILES_${PN} = "${base_libdir}/libgcc*.so.*" +FILES_${PN} = "${base_libdir}/libgcc*"FILES_${PN}-dev = " \
- ${base_libdir}/libgcc*.so \
${libdir}/${TARGET_SYS}/${BINV}/crt* \
${libdir}/${TARGET_SYS}/${BINV}/libgcc*"meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0@@ -29,9 +28,10 @@ do_install () {if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} else
- mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
+ cp ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc* ${D}${base_libdir}
fi
Quoted 10 lines
Quoted 7 lines
+
chown -R root:root ${D}
chmod +x ${D}${base_libdir}/libgcc_s.so.*
}
--
1.7.6.1Is this perhaps related to the following issue: http://lists.linuxtogo.org/pipermail/openembedded-core/2011-October/011556.html ? Some builds had trouble finding libgcc due to a sysroot misconfiguration, which has since been fixed in master.
I applied this patch first. It did not fix my toolchain.
The recipe above still is looking for this file '${D}${libdir}/libgcc*' before my patch - when that folder does not even exist and it's actually '${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc*'. It's worth noting that FILES_${PN} is referencing the path where a file actually exists, which makes me wonder why they are different, esp. since these two lines were added in the same patch.
-M
-M
Re: [RFC] Fix libgcc nativesdk to install libgcc.a in good location for tools
In reply to Matthew McClintockQuoted 9 lines · Matthew McClintock
This fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
Signed-off-by Matthew McClintock <[email protected]>---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issue
This patch looks very very confused to me. Firstly your subject summary talks about libgcc-nativesdk. This is the compiler used to generate binaries for SDKMACHINE so I seriously doubt you're using nativesdk to build uboot.
Quoted 13 lines
The previous mv command was failing as the files did not exist and I also rejiggered the packages since I was not sure if gdb-cross-canadian-powerpc-dev was included in my tarball of the toolchain
meta/recipes-devtools/gcc/libgcc_4.6.bb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0
meta/recipes-devtools/gcc/libgcc_4.6.bb PACKAGES = "\ · line 11
Quoted 5 lines
meta/recipes-devtools/gcc/libgcc_4.6.bb +1
-1@@ -8,9 +8,8 @@ PACKAGES = "\ ${PN}-dev \ " -FILES_${PN} = "${base_libdir}/libgcc*.so.*" +FILES_${PN} = "${base_libdir}/libgcc*"
This is changing the packging of libgcc too, not just libgcc-nativesdk. It is not correct to be putting the dynamic linking symlinks in anything but the -dev package so the above and the line below are therefore wrong too.
meta/recipes-devtools/gcc/libgcc_4.6.bb do_install () { · line 32
Quoted 12 lines
meta/recipes-devtools/gcc/libgcc_4.6.bb +1
-2FILES_${PN}-dev = " \ - ${base_libdir}/libgcc*.so \ ${libdir}/${TARGET_SYS}/${BINV}/crt* \ ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"@@ -29,9 +28,10 @@ do_install () { if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} else - mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true + cp ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc* ${D}${base_libdir} fi
Equally, you're moving a static library from the -dev package into the main package which is wrong, you only need that if you're doing development.
Are you sure your problem is not that you didn't have the libgcc-dev package installed?
Cheers,
Richard
Re: [RFC] Fix libgcc nativesdk to install libgcc.a in good location for tools
Quoted 57 lines · Richard Purdie
Quoted 9 lines · Matthew McClintock
This fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
Signed-off-by Matthew McClintock <[email protected]>---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issueThis patch looks very very confused to me. Firstly your subject summary talks about libgcc-nativesdk. This is the compiler used to generate binaries for SDKMACHINE so I seriously doubt you're using nativesdk to build uboot.
Quoted 16 lines
The previous mv command was failing as the files did not exist and I also rejiggered the packages since I was not sure if gdb-cross-canadian-powerpc-dev was included in my tarball of the toolchain
meta/recipes-devtools/gcc/libgcc_4.6.bb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0@@ -8,9 +8,8 @@ PACKAGES = "\ ${PN}-dev \"
meta/recipes-devtools/gcc/libgcc_4.6.bb PACKAGES = "\ · line 11
Quoted 2 lines
meta/recipes-devtools/gcc/libgcc_4.6.bb +1
-1-FILES_${PN} = "${base_libdir}/libgcc*.so.*" +FILES_${PN} = "${base_libdir}/libgcc*"This is changing the packging of libgcc too, not just libgcc-nativesdk. It is not correct to be putting the dynamic linking symlinks in anything but the -dev package so the above and the line below are therefore wrong too.
Quoted 6 lines
FILES_${PN}-dev = " \
- ${base_libdir}/libgcc*.so \
${libdir}/${TARGET_SYS}/${BINV}/crt* \
${libdir}/${TARGET_SYS}/${BINV}/libgcc*"meta/recipes-devtools/gcc/libgcc_4.6.bb +0
-0@@ -29,9 +28,10 @@ do_install () {Quoted 6 lines
if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
else
- mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
+ cp ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc* ${D}${base_libdir} fiEqually, you're moving a static library from the -dev package into the main package which is wrong, you only need that if you're doing development.
Quoted 2 lines
Are you sure your problem is not that you didn't have the libgcc-dev package installed?
Yes, it turns out I was having some build issues with my environment. I changed branches in the middle of a build inadvertently and it screwed everything up.
After a clean build, the toolchain finds libgcc.a if I apply this patch to the edison branch:
commit f8b94b106f93d33d6ca1a87ac14d710772d77c67
Author: Khem Raj <[email protected]> Date: Thu Oct 20 22:28:42 2011 -0700
gcc-configure-sdk: Point sysroot to correct location
(From OE-Core rev: c9883733fed9267b1a936c08500a4caf8dc52d3d)
Sorry for the noise. Please ignore this.
-M
Re: [RFC] Fix libgcc nativesdk to install libgcc.a in good location for tools
In reply to Richard PurdieQuoted 11 lines · Richard Purdie
Quoted 9 lines · Matthew McClintock
This fixes an issue where we cannot find -lgcc when linking. We update the path to libgcc.a so the library can be installed correctly
Signed-off-by Matthew McClintock <[email protected]>---
I really doubt this is the correct fix and I'm no expert but it's here for comments. This fixes a real u-boot cross compile build issue
Quoted 4 lines
This patch looks very very confused to me. Firstly your subject summary talks about libgcc-nativesdk. This is the compiler used to generate binaries for SDKMACHINE so I seriously doubt you're using nativesdk to build uboot.
Was referring to building a standalone u-boot with a toolchain generated by poky.
-M