Skip to contentSkip to conversation

Using Buildroot tool chain as external Toolchain

Buildroot john 2 participants 6 messages May 14, 2013

lore
Share & tools
lore

john

author
#0 lore raw

Hi,

I have been following various archived mails on this issue in an effort to get this working. The most useful was
http://buildroot-busybox.2317881.n4.nabble.com/Can-I-use-the-toolchain-build-with-buildroot-as-an-external-toolchain-td26855.html

I followed this process:
1. I downloaded a copy of buildroot-2012.05
2. Configured it and built it for my system
3. Confirmed that everything built and ran sucessfully
4. Copied the contents of buildroot-2012.05/output/host/usr to /apps/buildroot_toolchain/usr
5. In toolchain->options I set type to external toolchain
6. Selected toolchain-> custom toolchain
7. Set Toolchain path to /apps/buildroot_toolchain/usr
8. Set prefix to $(ARCH)-unknown-linux-uclibcgnueabi
9. Ensured that the options largefile support,RPC,WCHAR etc all matched my previous settings when building the original toolchain
10. Saved my config and ran make clean

But after following this process I have a problem, after doing a make clean I get:

checking whether build environment is sane... yes
checking for
arm-linux-strip... /home/xxx/xxx/xxx/buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-strip checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for
arm-linux-gcc... /home/xxx/xxx/xxx/buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc checking whether the C compiler works... no
configure: error: in
`/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: ***
[/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25/.stamp_configured]
Error 77

Should the above process work? Is it a possible permissions issue, I have tried changing the permissions on /apps/buildroot_toolchain/usr but to no avail.
In the link I posted above Thomas has suggested that the tool chain location be initially configured for In Build options, set the host dir to /opt/your-toolchain-name etc
Is this necessary to make this work or should the process I use also work?

#1 lore raw

Dear john,

Quoted 6 lines · john

I followed this process:
1. I downloaded a copy of buildroot-2012.05
2. Configured it and built it for my system
3. Confirmed that everything built and ran sucessfully
4. Copied the contents of buildroot-2012.05/output/host/usr to /apps/buildroot_toolchain/usr

This doesn't work. By default, gcc is linked dynamically against mpc, mpfr and al, and that doesn't work nicely if you move things around.

Two choices:

*) Build mpc and mpfr statically, so that gcc is linked statically
against them. Ideally, we should allow them to be built dynamically, but gcc/binutils have binaries in multiple locations in the tree, so we can't use the $ORIGIN/../lib trick to support a relocatable rpath.

*) Set BR2_HOST_DIR directly to /apps/buildroot_toolchain/ so that
your toolchain gets built and installed directly in this location.

Quoted 9 lines

arm-linux-gcc... /home/xxx/xxx/xxx/buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc checking whether the C compiler works... no
configure: error: in
`/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25/.stamp_configured]
Error 77

See output/build/alsa-lib-1.0.25/config.log for the details of the error; Would be useful to have this information to confirm that my analysis above is correct.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#2 lore raw

Hi Thomas,

Thank you for the reply.
I have attached the config.log

Quoted 35 lines · Thomas Petazzoni

Dear john,

Quoted 6 lines · john

I followed this process:
1. I downloaded a copy of buildroot-2012.05
2. Configured it and built it for my system
3. Confirmed that everything built and ran sucessfully
4. Copied the contents of buildroot-2012.05/output/host/usr to /apps/buildroot_toolchain/usr

This doesn't work. By default, gcc is linked dynamically against mpc, mpfr and al, and that doesn't work nicely if you move things around.

Two choices:

*) Build mpc and mpfr statically, so that gcc is linked statically
against them. Ideally, we should allow them to be built dynamically, but gcc/binutils have binaries in multiple locations in the tree, so we can't use the $ORIGIN/../lib trick to support a relocatable rpath.

*) Set BR2_HOST_DIR directly to /apps/buildroot_toolchain/ so that
your toolchain gets built and installed directly in this location.

Quoted 9 lines

arm-linux-gcc... /home/xxx/xxx/xxx/buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc checking whether the C compiler works... no
configure: error: in
`/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [/home/xxx/xxx/xxx/buildroot-2012.05/output/build/alsa-lib-1.0.25/.stamp_configured]
Error 77

Quoted 7 lines

See output/build/alsa-lib-1.0.25/config.log for the details of the error; Would be useful to have this information to confirm that my analysis above is correct.

Thanks,

Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: text/x-log
Size: 14572 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130514/14e14f5b/attachment.bin>

#3 lore raw

Dear john,

Quoted 4 lines · john

Hi Thomas,

Thank you for the reply.
I have attached the config.log

So indeed the problem is:

/apps/buildroot_toolchain/usr/bin/../libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.5.3/cc1:
error while loading shared libraries: libmpc.so.2: cannot open shared
object file: No such file or directory

Which is what I was referring to.

You can apply the below patch as a workaround:

commit b18bb4667fa5773c55e084c8b2d2df68735d3130

Author: Thomas Petazzoni <[email protected]>
Date:   Fri Aug 24 20:39:52 2012 +0000

mpc, mpfr, gmp: build statically for the host

package/gmp/gmp.mk +2 -0
index 5bcc6c1..9746150 100644
@@ -14,5 +14,7 @@ ifeq ($(ARCH),arm)
 GMP_MAKE_OPT += CFLAGS="$(TARGET_CFLAGS) -marm"
 endif
 
+HOST_GMP_CONF_OPT += --enable-static --disable-shared
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
package/mpc/mpc.mk +1 -0
index a366db7..4723220 100644
@@ -12,6 +12,7 @@ MPC_INSTALL_STAGING = YES
 MPC_DEPENDENCIES = gmp mpfr
 MPC_AUTORECONF = YES
 HOST_MPC_AUTORECONF = YES
+HOST_MPC_CONF_OPT += --disable-shared --enable-static
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
package/mpfr/mpfr.mk +2 -0
index 9caf3ac..fd8ff08 100644
@@ -11,5 +11,7 @@ MPFR_INSTALL_STAGING = YES
 MPFR_DEPENDENCIES = gmp
 MPFR_MAKE_OPT = RANLIB=$(TARGET_RANLIB)
 
+HOST_MPFR_CONF_OPT += --enable-static --disable-shared
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#4 lore raw

Thanks Thomas,

That fixed my problem, I appreciate your help

Quoted 64 lines · Thomas Petazzoni

Dear john,

Quoted 4 lines · john

Hi Thomas,

Thank you for the reply.
I have attached the config.log

So indeed the problem is:

/apps/buildroot_toolchain/usr/bin/../libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.5.3/cc1:
error while loading shared libraries: libmpc.so.2: cannot open shared
object file: No such file or directory

Which is what I was referring to.

You can apply the below patch as a workaround:

commit b18bb4667fa5773c55e084c8b2d2df68735d3130

Author: Thomas Petazzoni <[email protected]>
Date:   Fri Aug 24 20:39:52 2012 +0000

mpc, mpfr, gmp: build statically for the host

package/gmp/gmp.mk +2 -0
index 5bcc6c1..9746150 100644
@@ -14,5 +14,7 @@ ifeq ($(ARCH),arm)
 GMP_MAKE_OPT += CFLAGS="$(TARGET_CFLAGS) -marm"
 endif
 
+HOST_GMP_CONF_OPT += --enable-static --disable-shared
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
package/mpc/mpc.mk +1 -0
index a366db7..4723220 100644
@@ -12,6 +12,7 @@ MPC_INSTALL_STAGING = YES
 MPC_DEPENDENCIES = gmp mpfr
 MPC_AUTORECONF = YES
 HOST_MPC_AUTORECONF = YES
+HOST_MPC_CONF_OPT += --disable-shared --enable-static
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
package/mpfr/mpfr.mk +2 -0
index 9caf3ac..fd8ff08 100644
@@ -11,5 +11,7 @@ MPFR_INSTALL_STAGING = YES
 MPFR_DEPENDENCIES = gmp
 MPFR_MAKE_OPT = RANLIB=$(TARGET_RANLIB)
 
+HOST_MPFR_CONF_OPT += --enable-static --disable-shared
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))

Thomas

#5 lore raw

Dear john,

Quoted 3 lines · john

Thanks Thomas,

That fixed my problem, I appreciate your help

Ok, good.

Perhaps I should submit this patch. I don't think there's any other solution than this one, since the $ORIGIN/../lib trick cannot work.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com