All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Beckerus <hans.beckerus@gmail.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: Problem finding -lgcc when using SDK toolchain
Date: Tue, 01 Oct 2013 20:03:02 +0200	[thread overview]
Message-ID: <524B0E56.3040903@gmail.com> (raw)
In-Reply-To: <DFDCC371-D349-41A8-BE06-CDD2F7996BDF@gmail.com>

On 2013-10-01 7:35, Khem Raj wrote:
> On Oct 1, 2013, at 6:16 AM, Hans Beckérus <hans.beckerus@gmail.com> wrote:
>
>> Hello. We have stumbled into a problem when using ld directly instead
>> of going through the gcc frontend.
>> A simple operation like this fails:
>>
>>> ${CC} -c hello_world.c
>>> ${LD} hello_world.o -lgcc
>> arm-poky-linux-gnueabi-ld: cannot find -lgcc
>>
>> And yes, I know -lgcc is not required in this case to compile this
>> one, but this is only a simple reproducer.
>> The real issue was discovered when trying to build U-Boot from the SDK.
>>
>> To resolve this problem we are forced to provide
>> -L<sysroot>/usr/lib/arm-poky-linux-gnueabi/4.7.2 to LDFLAGS.
>> But that should not be needed, should it? Anyone else bumped into this
>> problem? Are there any "real" solutions.
>> I am starting to think it has to do with the hardcoded installation
>> path in the binaries maybe?
> I doubt that infact we try hard to keep it relocatable. The problem is you are interpreting
> --sysroot option to do more than what its supposed to do. when linking it only affects INPUT,  GROUP
> and SEARCH_DIR linker script variables and if you look at the linker script path to libgcc is not
> specified in SEARCH_DIR, thats where gcc driver comes handy in figuring out where the right libgcc is installed
> and sometimes when you have complex multilib environments thats very handy. linker does not know
> anything about libgcc its just another library for it.
Hi Khem, thanks for your time. I am sure I put too much value into --sysroot, but what still strikes me a bit odd is why the simple reproducer I showed before works just fine using the local host gcc and ld? It seems to have no issues in finding libgcc.a?
So what you are saying is that it is actually expected that U-Boot build will fail when compiled through the SDK toolchain directly without adding additional options to the linker? Is that also what the u-boot recipe is doing? After all, it works fine to bitbake u-boot.

> however you could do  something like
>
> ${CC} -print-libgcc-file-name or ${CC} -print-file-name=libgcc.a
>
> to get to the library
>
> and specify that in your linker cmdline
Ok, guess it will simply give me the same path as we are currently hardcoding, but if the toolchain moves your solution is definitely to prefer.
Thanks for the tip. Did only not know about the --print-sysroot command until now.
> -Khem



  reply	other threads:[~2013-10-01 18:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 13:16 Problem finding -lgcc when using SDK toolchain Hans Beckérus
2013-10-01 17:35 ` Khem Raj
2013-10-01 18:03   ` Hans Beckerus [this message]
2013-10-02  6:13     ` Khem Raj
2013-10-02  8:21       ` Hans Beckérus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524B0E56.3040903@gmail.com \
    --to=hans.beckerus@gmail.com \
    --cc=raj.khem@gmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.