All of lore.kernel.org
 help / color / mirror / Atom feed
* nativesdk-binutils sysroot bug?
@ 2021-01-11 10:47 kenth.eriksson
  2021-03-30 20:41 ` Kenth Eriksson
  0 siblings, 1 reply; 2+ messages in thread
From: kenth.eriksson @ 2021-01-11 10:47 UTC (permalink / raw)
  To: yocto

I have added native gcc support to an ARM Yocto SDK. But the native compiler does not work when passing the sysroot argument to the compiler. 

kenth@se-kenth-lx yocto-xr $ x86_64-xr-linux-gcc test.c
kenth@se-kenth-lx yocto-xr $ x86_64-xr-linux-gcc test.c --sysroot=/opt/infn-xr/1.0/sysroots/x86_64-xr-linux
/opt/infn-xr/1.0/sysroots/x86_64-xr-linux/usr/lib/gcc/x86_64-xr-linux/9.2.0/../../../../x86_64-xr-linux/bin/ld: cannot find /opt/infn-xr/1.0/sysroots/x86_64-xr-linux/lib/libc.so.6 inside /opt/infn-xr/1.0/sysroots/x86_64-xr-linux
/opt/infn-xr/1.0/sysroots/x86_64-xr-linux/usr/lib/gcc/x86_64-xr-linux/9.2.0/../../../../x86_64-xr-linux/bin/ld: cannot find /opt/infn-xr/1.0/sysroots/x86_64-xr-linux/usr/lib/libc_nonshared.a inside /opt/infn-xr/1.0/sysroots/x86_64-xr-linux
/opt/infn-xr/1.0/sysroots/x86_64-xr-linux/usr/lib/gcc/x86_64-xr-linux/9.2.0/../../../../x86_64-xr-linux/bin/ld: cannot find /opt/infn-xr/1.0/sysroots/x86_64-xr-linux/lib/ld-linux-x86-64.so.2 inside /opt/infn-xr/1.0/sysroots/x86_64-xr-linux
collect2: error: ld returned 1 exit status

Error trace seems to incorrectly tell that libc is missing on that path

kenth@se-kenth-lx yocto-xr $ ls -l /opt/infn-xr/1.0/sysroots/x86_64-xr-linux/lib/libc.so.6
lrwxrwxrwx 1 root root 12 Jan 11 10:33 /opt/infn-xr/1.0/sysroots/x86_64-xr-linux/lib/libc.so.6 -> libc-2.30.so*
kenth@se-kenth-lx yocto-xr $

The sysroot argument works when only compiling the source file (no linking)
kenth@se-kenth-lx yocto-xr $ x86_64-xr-linux-gcc -c test.c -o test.o --sysroot=/opt/infn-xr/1.0/sysroots/x86_64-xr-linux

But when gcc invokes binutils with sysroot argument then it fails. Doing a strace on the invocation of gcc with sysroot shows that sometimes the sysroot path is concatenated twice;

[pid  4197] openat(AT_FDCWD, "/opt/infn-xr/1.0/sysroots/x86_64-xr-linux//opt/infn-xr/1.0/sysroots/x86_64-xr-linux/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  4197] write(2, "/opt/infn-xr/1.0/sysroots/x86_64"..., 110) = 110

The arm compiler has a compiled sysroot (as defined in the bb recipe)
kenth@se-kenth-lx yocto-xr $ aarch64-xr-linux-gcc --print-sysroot
/not/exist
kenth@se-kenth-lx yocto-xr $

whereas the native x86 compiler does not have a compiled sysroot

kenth@se-kenth-lx yocto-xr $ x86_64-xr-linux-gcc --print-sysroot
kenth@se-kenth-lx yocto-xr $

If I symlink the path to mitigate the concatenation effect into binutils then it all works. 

Known issue? How to resolve?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: nativesdk-binutils sysroot bug?
  2021-01-11 10:47 nativesdk-binutils sysroot bug? kenth.eriksson
@ 2021-03-30 20:41 ` Kenth Eriksson
  0 siblings, 0 replies; 2+ messages in thread
From: Kenth Eriksson @ 2021-03-30 20:41 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]

No one having problems with sysroot for nativesdk-binutils / nativesdk-gcc?

[-- Attachment #2: Type: text/html, Size: 77 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-30 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 10:47 nativesdk-binutils sysroot bug? kenth.eriksson
2021-03-30 20:41 ` Kenth Eriksson

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.