Building nspr-native, there is a point where it links -lpthread and requires rt components, however it pulls in the host version of librt. gcc exit.o -Xlinker -L../../dist/lib -lplc4 -L../../dist/lib -lnspr4 -lpthread -o exit /home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/../../../../x86_64-pokysdk-linux/bin/ld: /lib64/librt.so.1: undefined reference to `__clock_getcpuclockid@GLIBC_PRIVATE' /home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/../../../../x86_64-pokysdk-linux/bin/ld: /lib64/librt.so.1: undefined reference to `__clock_nanosleep@GLIBC_PRIVATE' /home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/../../../../x86_64-pokysdk-linux/bin/ld: /lib64/librt.so.1: undefined reference to `__clock_settime@GLIBC_PRIVATE' /home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/../../../../x86_64-pokysdk-linux/bin/ld: /lib64/librt.so.1: undefined reference to `__clock_getres@GLIBC_PRIVATE' Stracing it down: 3061991 openat(AT_FDCWD, "/home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/security/tmp/work/x86_64-linux/nspr-native/4.25-r0/recipe-sysroot-native/usr/lib/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/security/tmp/work/x86_64-linux/nspr-native/4.25-r0/recipe-sysroot-native/lib/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64/atlas/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64//bind9-export/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64/dyninst/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64/iscsi/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64/mysql/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/usr/lib64/qt-3.3/lib/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/opt/poky/3.0+snapshot/sysroots/x86_64-pokysdk-linux/usr/x86_64-pokysdk-linux/lib64/librt.so.1", O_RDONLY) = -1 EACCES (Permission denied) 3061991 openat(AT_FDCWD, "/opt/poky/3.0+snapshot/sysroots/x86_64-pokysdk-linux/usr/lib64/librt.so.1", O_RDONLY) = -1 EACCES (Permission denied) 3061991 openat(AT_FDCWD, "/usr/local/lib64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 3061991 openat(AT_FDCWD, "/lib64/librt.so.1", O_RDONLY) = 26 The access for: /opt/poky/3.0+snapshot/sysroots/x86_64-pokysdk-linux/usr/x86_64-pokysdk-linux/lib64/ and /opt/poky/3.0+snapshot/sysroots/x86_64-pokysdk-linux/usr/lib64/ Should be relocated to wherever the compiler is installed rather than the default path. This only occurs if you just do -lpthread. This can be worked around in the build, by changing -lpthread to -lpthread -lrt so I don't think it is a ship stopper but its something that should likely be fixed at some point. I am currently poking at this.
Adding Tim, since he did a lot of work on this and may have some insight.
Here is the issue: 3061991 openat(AT_FDCWD, "/home/jpuhlman/builds/master/profiles/opencgx-x86-generic-64/buildtools/sysroots/x86_64-pokysdk-linux/etc/etc/ld.so.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
Looks like the issue is ld_sysconfigdir is set to /<sysroot path>/ then we add /etc/ld.so.conf as well in the binutils ld patch. The following should fix it, currently testing. diff --git a/meta/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch b/meta/recipes-devtools/binutils/bin index 8b59ba5..4b4d73d 100644 --- a/meta/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch +++ b/meta/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch @@ -65,7 +65,7 @@ index 2e27cf48a8..a095d6aac5 100644 info.path = NULL; info.len = info.alloc = 0; - tmppath = concat (ld_sysroot, prefix, "/etc/ld.so.conf", -+ tmppath = concat (ld_sysconfdir, "/etc/ld.so.conf", ++ tmppath = concat (ld_sysconfdir, "/ld.so.conf", (const char *) NULL); if (!ldelf_parse_ld_so_conf (&info, tmppath)) {
(In reply to comment #3) > Looks like the issue is ld_sysconfigdir is set to /<sysroot path>/ then we > add /etc/ld.so.conf as well in the binutils ld patch. That should be /<sysroot path>/etc then we add /etc/ld.so.conf to the end.
Looks like you figured out the root cause? https://patchwork.openembedded.org/patch/171584/
(In reply to comment #5) > Looks like you figured out the root cause? > > https://patchwork.openembedded.org/patch/171584/ Yes. Once the path is fixed nspr-native builds correctly. Moving to in progress review since its sitting in master-next.
In dunfell now. Moving to resolved. https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=dunfell&id=8b8d6897542f07cf47a4ee9def6d00d0fece96f1