* [Buildroot] Problem with external toolchain sysroot and eclipse
@ 2013-04-16 7:24 Lars Dunemark
2013-04-16 7:33 ` Thomas Petazzoni
0 siblings, 1 reply; 6+ messages in thread
From: Lars Dunemark @ 2013-04-16 7:24 UTC (permalink / raw)
To: buildroot
Hello
Recently, we discovered that it has become something strange with our external toolchain builds.
We discovered this when we wanted to start using Eclipse integration for buildroot and build applications outside buildroot.
After some investigation we discovered that the ext-toolchain-wrapper had changed and received support for relative paths.
After adding some debug prints:
toolchain/toolchain-external/ext-toolchain-wrapper.c
122 printf("path: %s, sysroot: %s\n", path, sysroot);
I got the the following result:
$ pwd
/media/build/source
$ arm-cortex_a8-linux-gnueabi-gcc
path: /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc, sysroot: /media/usr/arm-buildroot-linux-gnueabi/sysroot
arm-cortex_a8-linux-gnueabi-gcc: no input files
$ ./buildroot/output/host/usr/bin/arm-cortex_a8-linux-gnueabi-gcc
path: /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc, sysroot: /media/build/source/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot
arm-cortex_a8-linux-gnueabi-gcc: no input files
As you can see we get wrong sysroot if we using gcc directly from out PATH.
Our toolchain is located beside buildroot directory:
/buildroot
/toolchain
The only workaround that I have found is to add following patch but I think this will break the purpose with the original patch:
Commit: befb9a3ee0c5994162f527d8ef763d57d68ec48e
Is there any other better solution to this problem?
Best regards
Lars Dunemark
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] Problem with external toolchain sysroot and eclipse
2013-04-16 7:24 [Buildroot] Problem with external toolchain sysroot and eclipse Lars Dunemark
@ 2013-04-16 7:33 ` Thomas Petazzoni
2013-04-16 9:51 ` Lars Dunemark
2013-04-16 11:16 ` Lars Dunemark
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2013-04-16 7:33 UTC (permalink / raw)
To: buildroot
Dear Lars Dunemark,
On Tue, 16 Apr 2013 07:24:51 +0000, Lars Dunemark wrote:
> Recently, we discovered that it has become something strange with our external toolchain builds.
>
> We discovered this when we wanted to start using Eclipse integration for buildroot and build applications outside buildroot.
>
> After some investigation we discovered that the ext-toolchain-wrapper had changed and received support for relative paths.
> After adding some debug prints:
> toolchain/toolchain-external/ext-toolchain-wrapper.c
> 122 printf("path: %s, sysroot: %s\n", path, sysroot);
>
> I got the the following result:
>
> $ pwd
> /media/build/source
> $ arm-cortex_a8-linux-gnueabi-gcc
> path: /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc, sysroot: /media/usr/arm-buildroot-linux-gnueabi/sysroot
> arm-cortex_a8-linux-gnueabi-gcc: no input files
>
>
> $ ./buildroot/output/host/usr/bin/arm-cortex_a8-linux-gnueabi-gcc
> path: /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc, sysroot: /media/build/source/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot
> arm-cortex_a8-linux-gnueabi-gcc: no input files
What is /media/build/source/toolchain/ ? How did you install things in
there ?
The toolchain that you must use with Buildroot is the one in
output/host/usr/bin/. Using something else will most likely not work
properly.
Can you give details about your /media/build/source/toolchain/
directory so that we can understand what is your configuration? It
doesn't look a standard way of using Buildroot.
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] Problem with external toolchain sysroot and eclipse
2013-04-16 7:33 ` Thomas Petazzoni
@ 2013-04-16 9:51 ` Lars Dunemark
2013-04-16 11:16 ` Lars Dunemark
1 sibling, 0 replies; 6+ messages in thread
From: Lars Dunemark @ 2013-04-16 9:51 UTC (permalink / raw)
To: buildroot
Hi Thomas
> Dear Lars Dunemark,
>
> On Tue, 16 Apr 2013 07:24:51 +0000, Lars Dunemark wrote:
>
> > Recently, we discovered that it has become something strange with our
> external toolchain builds.
> >
> > We discovered this when we wanted to start using Eclipse integration for
> buildroot and build applications outside buildroot.
> >
> > After some investigation we discovered that the ext-toolchain-wrapper had
> changed and received support for relative paths.
> > After adding some debug prints:
> > toolchain/toolchain-external/ext-toolchain-wrapper.c
> > 122 printf("path: %s, sysroot: %s\n", path, sysroot);
> >
> > I got the the following result:
> >
> > $ pwd
> > /media/build/source
> > $ arm-cortex_a8-linux-gnueabi-gcc
> > path:
> > /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc,
> > sysroot: /media/usr/arm-buildroot-linux-gnueabi/sysroot
> > arm-cortex_a8-linux-gnueabi-gcc: no input files
> >
> >
> > $ ./buildroot/output/host/usr/bin/arm-cortex_a8-linux-gnueabi-gcc
> > path:
> > /media/build/source/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc,
> > sysroot:
> > /media/build/source/buildroot/output/host/usr/arm-buildroot-linux-gnue
> > abi/sysroot
> > arm-cortex_a8-linux-gnueabi-gcc: no input files
>
> What is /media/build/source/toolchain/ ? How did you install things in there ?
The toolchain I'm using is created with crosstool-ng outside of buildroot.
In buildroot menuconfig I have set
# BR2_TOOLCHAIN_BUILDROOT is not set
BR2_TOOLCHAIN_EXTERNAL=y
# BR2_TOOLCHAIN_CTNG is not set
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
# BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD is not set
BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED=y
BR2_TOOLCHAIN_EXTERNAL_PATH="/media/build/source/toolchain/"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-cortex_a8-linux-gnueabi"
BR2_TOOLCHAIN_EXTERNAL_PREFIX="arm-cortex_a8-linux-gnueabi"
BR2_TOOLCHAIN_EXTERNAL_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC is not set
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS=""
The intention with this is to have one toolchain build as base so we don't need to rebuild it every time.
I attach our config file for ct-ng.
>
> The toolchain that you must use with Buildroot is the one in
> output/host/usr/bin/. Using something else will most likely not work properly.
>
> Can you give details about your /media/build/source/toolchain/ directory so that
> we can understand what is your configuration? It doesn't look a standard way of
> using Buildroot.
>
> Thanks,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux development, consulting, training
> and support.
> http://free-electrons.com
Best regards
Lars Dunemark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolchain.config
Type: application/octet-stream
Size: 10281 bytes
Desc: toolchain.config
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130416/ed521a76/attachment.obj>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] Problem with external toolchain sysroot and eclipse
2013-04-16 7:33 ` Thomas Petazzoni
2013-04-16 9:51 ` Lars Dunemark
@ 2013-04-16 11:16 ` Lars Dunemark
2013-04-16 11:47 ` Greg Beresford
1 sibling, 1 reply; 6+ messages in thread
From: Lars Dunemark @ 2013-04-16 11:16 UTC (permalink / raw)
To: buildroot
> > What is /media/build/source/toolchain/ ? How did you install things in there ?
>
> The toolchain I'm using is created with crosstool-ng outside of buildroot.
I have tried this with
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201203=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_PREFIX="arm-none-linux-gnueabi"
And get same problem with paths.
Eg absolute path works:
$ ./output/host/usr/bin/arm-none-linux-gnueabi-gcc
arm-none-linux-gnueabi-gcc: fatal error: no input files
and using PATH failes:
$ pwd
/media/build/source/buildroot
$ arm-none-linux-gnueabi-gcc
/media/build/opt/ext-toolchain/bin/arm-none-linux-gnueabi-gcc: No such file or directory
Best regards
Lars Dunemark
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] Problem with external toolchain sysroot and eclipse
2013-04-16 11:16 ` Lars Dunemark
@ 2013-04-16 11:47 ` Greg Beresford
2013-04-16 19:02 ` Lars Dunemark
0 siblings, 1 reply; 6+ messages in thread
From: Greg Beresford @ 2013-04-16 11:47 UTC (permalink / raw)
To: buildroot
Dear Lars Dunemark,
On 16 April 2013 12:16, Lars Dunemark wrote:
> Eg absolute path works:
> $ ./output/host/usr/bin/arm-none-linux-gnueabi-gcc
> arm-none-linux-gnueabi-gcc: fatal error: no input files
>
> and using PATH failes:
> $ pwd
> /media/build/source/buildroot
> $ arm-none-linux-gnueabi-gcc
> /media/build/opt/ext-toolchain/bin/arm-none-linux-gnueabi-gcc: No such
> file or directory
It looks like making the external toolchain wrapper relocatable has broken it for use outside of buildroot. If you add the wrapper directory to your path and invoke the wrapper as arm-linux-gcc (for example), execution will enter the 'else' on line 76 of ext-toolchain-wrapper.c. This sets basename to arm-linux-gcc, which is fine, but it also sets absbasedir to whatever $(pwd)/../.. resolves to which then gets used when calculating the sysroot directory, resulting in gcc not having the real sysroot in its search paths.
The above all works fine if the wrapper is invoked with an absolute path. (I've not tried with a relative path with slashes in.)
I've got a patch with a fix which calculates absbasedir from /proc/self/exe. (I don't know of any other way of reliably getting the path to the current executable.) My C is rusty though, so it might need to be fixed up before it's applied. Also, I don't know if there was there a reason for avoiding the basename and dirname functions from libgen.h. I've not sent a properly git formatted patch before, (and I can't send email from my development machine), so it'll be a day or so before I can put a properly formatted patch together, or you can just pull it from the badly formatted patch in this email: http://article.gmane.org/gmane.comp.lib.uclibc.buildroot/54942
Regards
Greg Beresford
Disclaimer: This email contains proprietary information some or all of which may be legally privileged and/or is confidential. It is for the intended recipient only. If an addressing or transmission error has misdirected this email, please notify the author by replying to this email. If you are not the intended recipient, you must not use, disclose, distribute, copy or print this email. Any views expressed in this message are those of the individual sender, except where the message states otherwise. ZBD Displays accepts no responsibility for any computer virus which might be transferred by way of this email. We may monitor all email communication through our networks. If you contact us by email, we may store your name and address to facilitate communication. ZBD Displays Ltd is registered in England and Wales, company registration number: 03929602. Registered Office: Malvern Hills Science Park, Geraldine Road, Malvern, Worcestershire, WR14 3SZ, UK
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] Problem with external toolchain sysroot and eclipse
2013-04-16 11:47 ` Greg Beresford
@ 2013-04-16 19:02 ` Lars Dunemark
0 siblings, 0 replies; 6+ messages in thread
From: Lars Dunemark @ 2013-04-16 19:02 UTC (permalink / raw)
To: buildroot
Hi Greg Beresford,
Thanks for your replay, I have tested your patch and it solves my problem.
Is there anything more that needs to be done with this patch before it can be integrated into master?
> It looks like making the external toolchain wrapper relocatable has broken it for
> use outside of buildroot. If you add the wrapper directory to your path and
> invoke the wrapper as arm-linux-gcc (for example), execution will enter the
> 'else' on line 76 of ext-toolchain-wrapper.c. This sets basename to arm-linux-
> gcc, which is fine, but it also sets absbasedir to whatever $(pwd)/../.. resolves to
> which then gets used when calculating the sysroot directory, resulting in gcc not
> having the real sysroot in its search paths.
>
> The above all works fine if the wrapper is invoked with an absolute path. (I've
> not tried with a relative path with slashes in.)
>
> I've got a patch with a fix which calculates absbasedir from /proc/self/exe. (I
> don't know of any other way of reliably getting the path to the current
> executable.) My C is rusty though, so it might need to be fixed up before it's
> applied. Also, I don't know if there was there a reason for avoiding the
> basename and dirname functions from libgen.h. I've not sent a properly git
> formatted patch before, (and I can't send email from my development
> machine), so it'll be a day or so before I can put a properly formatted patch
> together, or you can just pull it from the badly formatted patch in this email:
> http://article.gmane.org/gmane.comp.lib.uclibc.buildroot/54942
>
Best regards
Lars Dunemark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-16 19:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 7:24 [Buildroot] Problem with external toolchain sysroot and eclipse Lars Dunemark
2013-04-16 7:33 ` Thomas Petazzoni
2013-04-16 9:51 ` Lars Dunemark
2013-04-16 11:16 ` Lars Dunemark
2013-04-16 11:47 ` Greg Beresford
2013-04-16 19:02 ` Lars Dunemark
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.