[yocto] nativesdk-gcc tries to link with host

Khem Raj raj.khem at gmail.com
Wed Aug 22 11:08:46 PDT 2018


On Wed, Aug 22, 2018 at 7:35 AM Paulo Neves <ptsneves at gmail.com> wrote:
>
> Hello,
>
> I am trying to use nativesdk-gcc to have a gcc compiler for my sdk
> machine. Everything looks to work correctly but some code make the
> linker attempt to use host libraries.
>
> This is weird because this only happens when I use libraries that are
> in the ${SDKROOT}/lib and not in ${SDKROOT}/usr/lib. Examples librt or
> libpthread.
>
> An example program[1], build with [2] results in
> //lib64/libpthread.so.0: undefined reference to `h_errno at GLIBC_PRIVATE'
> //lib64/libpthread.so.0: undefined reference to
> `__vdso_clock_gettime at GLIBC_PRIVATE'
> //lib64/libpthread.so.0: undefined reference to
> `__libc_dl_error_tsd at GLIBC_PRIVATE'
>
> One thing I noticed is that the sysroot of this nativesdk-gcc is not
> poisoned. I am not sure if this on purpose or not because gcc-7.3.bb
> requires  gcc-7.3.inc gcc-target.inc in this order. The problem is
> that gcc-7.3.inc poisons the sysroot and gcc-target.inc "unpoisons"
> the sysroot. Basically gcc-target overwrites EXTRA_OECONF_PATHS that
> was set by gcc-7.3.inc.
>

target sysroot poisoning is naturally not needed we could do that but it is
not useful, for nativesdk  it behaves like a native gcc except that it prefers
the libraries from SDK rootfs, now should be limit it to just the
rootfs and blind
it from system rootfs .. may be I dont know if thats useful.

> Let me know if you are aware of what is wrong.
> Paulo Neves
>
> [1] d.c
> #define _GNU_SOURCE
>        #include <sched.h>
>        #include <unistd.h>
>        #include <stdlib.h>
>        #include <stdio.h>
>
>  #ifdef __STDC__
>  # include <limits.h>
>  #else
>  # include <assert.h>
>  #endif
>
>  #undef timer_create
>
>   char timer_create ();
>   int
>  main ()
>  {
>  return timer_create ();
>    ;
>    return 0;
>  }
>
> [2] bash -c "PATH=./buildtools/sysroots/x86_64-pokysdk-linux/usr/bin/
> && gcc -lrt d.c"
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


More information about the yocto mailing list