Fixed when built with nativesdk-gcc from buildtools-extended-tarball:
$ bitbake nspr-native

gcc   abstract.o -Xlinker -L../../dist/lib -lplc4 -L../../dist/lib -lnspr4 
-lpthread -o abstract
/path/to/x86_64-wrlinuxsdk-linux/bin/ld:
/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_getcpuclockid@GLIBC_PRIVATE'
/path/to/x86_64-wrlinuxsdk-linux/bin/ld:
/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_nanosleep@GLIBC_PRIVATE'
/path/to/x86_64-wrlinuxsdk-linux/bin/ld:
/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_settime@GLIBC_PRIVATE'
/path/to/x86_64-wrlinuxsdk-linux/bin/ld:
/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_getres@GLIBC_PRIVATE'

Referred to:
https://github.com/linux-test-project/ltp/issues/255

There should be a bug hidden in nativesdk-gcc or other toolchains, but it's
very had to figure it out. The quick workaround is using "-lpthread -lrt"

Signed-off-by: Robert Yang <liezhi.y...@windriver.com>
---
 ...ts-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch | 47 +++++++++++++++++++
 meta-oe/recipes-support/nspr/nspr_4.29.bb     |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 
meta-oe/recipes-support/nspr/nspr/0001-nspr-pr-tests-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch

diff --git 
a/meta-oe/recipes-support/nspr/nspr/0001-nspr-pr-tests-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch
 
b/meta-oe/recipes-support/nspr/nspr/0001-nspr-pr-tests-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch
new file mode 100644
index 000000000..c71871c34
--- /dev/null
+++ 
b/meta-oe/recipes-support/nspr/nspr/0001-nspr-pr-tests-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch
@@ -0,0 +1,47 @@
+From 4441e9c15684623adb3d5cbd6c2f27c1f3d212ac Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.y...@windriver.com>
+Date: Tue, 29 Dec 2020 03:57:07 +0000
+Subject: [PATCH] nspr/pr/tests/Makefile.in: Add -lrt to EXTRA_LIBS
+
+Fixed when built with nativesdk-gcc from buildtools-extended-tarball:
+$ bitbake nspr-native
+
+gcc   abstract.o -Xlinker -L../../dist/lib -lplc4 -L../../dist/lib -lnspr4 
-lpthread -o abstract
+/path/to/x86_64-wrlinuxsdk-linux/bin/ld: 
+/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_getcpuclockid@GLIBC_PRIVATE'
+/path/to/x86_64-wrlinuxsdk-linux/bin/ld: 
+/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_nanosleep@GLIBC_PRIVATE'
+/path/to/x86_64-wrlinuxsdk-linux/bin/ld: 
+/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_settime@GLIBC_PRIVATE'
+/path/to/x86_64-wrlinuxsdk-linux/bin/ld: 
+/lib/x86_64-linux-gnu/librt.so.1: undefined reference to 
`__clock_getres@GLIBC_PRIVATE'
+
+Referred to:
+https://github.com/linux-test-project/ltp/issues/255
+
+There should be a bug hidden in nativesdk-gcc or other toolchains, but it's
+very had to figure it out. The quick workaround is using "-lpthread -lrt"
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Robert Yang <liezhi.y...@windriver.com>
+---
+ nspr/pr/tests/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
+index 2ccb992..45270e9 100644
+--- a/pr/tests/Makefile.in
++++ b/pr/tests/Makefile.in
+@@ -274,7 +274,7 @@ endif # SunOS
+ ifeq (,$(filter-out Linux GNU GNU_%,$(OS_ARCH)))
+     LDOPTS += -Xlinker
+     ifeq ($(USE_PTHREADS),1)
+-        EXTRA_LIBS = -lpthread
++        EXTRA_LIBS = -lpthread -lrt
+     endif
+ endif
+ 
+-- 
+2.29.2
+
diff --git a/meta-oe/recipes-support/nspr/nspr_4.29.bb 
b/meta-oe/recipes-support/nspr/nspr_4.29.bb
index 6307c159e..fa05bc022 100644
--- a/meta-oe/recipes-support/nspr/nspr_4.29.bb
+++ b/meta-oe/recipes-support/nspr/nspr_4.29.bb
@@ -13,6 +13,7 @@ SRC_URI = 
"http://ftp.mozilla.org/pub/nspr/releases/v${PV}/src/nspr-${PV}.tar.gz
            file://0001-md-Fix-build-with-musl.patch \
            file://Makefile.in-remove-_BUILD_STRING-and-_BUILD_TIME.patch \
            file://nspr.pc.in \
+           file://0001-nspr-pr-tests-Makefile.in-Add-lrt-to-EXTRA_LIBS.patch \
 "
 
 CACHED_CONFIGUREVARS_append_libc-musl = " CFLAGS='${CFLAGS} 
-D_PR_POLL_AVAILABLE \
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#88550): 
https://lists.openembedded.org/g/openembedded-devel/message/88550
Mute This Topic: https://lists.openembedded.org/mt/79473143/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to