[yocto] nativesdk-gcc tries to link with host
Paulo Neves
ptsneves at gmail.com
Wed Aug 22 07:32:15 PDT 2018
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.
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"
More information about the yocto
mailing list