From: Mingli Yu <mingli...@windriver.com> Fail to build re2 which depends on googletest as below: /build/tmp-glibc/work/core2-64-wrs-linux/re2/2024.03.01/recipe-sysroot-native/usr/bin/x86_64-wrs-linux/../../libexec/x86_64-wrs-linux/gcc/x86_64-wrs-linux/13.2.0/ld: /build/tmp-glibc/work/core2-64-wrs-linux/re2/2024.03.01/recipe-sysroot/usr/lib64/libgtest.a(gtest-all.cc.o): warning: relocation against `_ZTVN7testing8internal11MatcherBaseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE' in read-only section `.text._ZN7testing8internal11MatcherBaseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED0Ev[_ZN7testing8internal11MatcherBaseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED5Ev]' /build/tmp-glibc/work/core2-64-wrs-linux/re2/2024.03.01/recipe-sysroot-native/usr/bin/x86_64-wrs-linux/../../libexec/x86_64-wrs-linux/gcc/x86_64-wrs-linux/13.2.0/ld: /build/tmp-glibc/work/core2-64-wrs-linux/re2/2024.03.01/recipe-sysroot/usr/lib64/libgtest.a(gtest-all.cc.o): relocation R_X86_64_PC32 against symbol `_ZTVN7testing8internal17TestEventRepeaterE' can not be used when making a shared object; recompile with -fPIC /build/tmp-glibc/work/core2-64-wrs-linux/re2/2024.03.01/recipe-sysroot-native/usr/bin/x86_64-wrs-linux/../../libexec/x86_64-wrs-linux/gcc/x86_64-wrs-linux/13.2.0/ld: final link failed: bad value collect2: error: ld returned 1 exit status
So pass -fPIC to fix the above issue. Signed-off-by: Mingli Yu <mingli...@windriver.com> --- meta-oe/recipes-test/googletest/googletest_1.14.0.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/meta-oe/recipes-test/googletest/googletest_1.14.0.bb b/meta-oe/recipes-test/googletest/googletest_1.14.0.bb index 1b05f3d33..4c9d1e709 100644 --- a/meta-oe/recipes-test/googletest/googletest_1.14.0.bb +++ b/meta-oe/recipes-test/googletest/googletest_1.14.0.bb @@ -16,6 +16,7 @@ inherit cmake pkgconfig # PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF,," +CXXFLAGS:append = " -fPIC" ALLOW_EMPTY:${PN} = "1" ALLOW_EMPTY:${PN}-dbg = "1" -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#109187): https://lists.openembedded.org/g/openembedded-devel/message/109187 Mute This Topic: https://lists.openembedded.org/mt/104781176/21656 Group Owner: openembedded-devel+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-