googletest: Pass -fPIC to CFLAGS
PATCH 1/2 googletest: Pass -fPIC to CFLAGS
From: Mingli Yu <[email protected]>
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.
--- meta-oe/recipes-test/googletest/googletest_1.14.0.bb | 1 + 1 file changed, 1 insertion(+)
meta-oe/recipes-test/googletest/googletest_1.14.0.bb +1 -0
@@ -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"
Signature · 1 line
2.25.1
PATCH 2/2 re2: Upgrade 2023.03.01 -> 2024.03.01
From: Mingli Yu <[email protected]>
1, Add abseil-cpp, gtest and benchmark to DEPENDS to fix the below kind configure error.
CMake Error at CMakeLists.txt:81 (find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "absl", but CMake did not find one.
Could not find a package configuration file provided by "absl" with any of the following names:
abslConfig.cmake
absl-config.cmake
2, Install libtesting.so to target to fix the below QA issue.
ERROR: re2-2024.03.01-r0 do_package_qa: QA Issue: /usr/lib64/re2/ptest/string_generator_test contained in package re2-ptest requires libtesting.so()(64bit), but no providers found in RDEPENDS:re2-ptest? [file-rdeps]
3, Add abseil-cpp-dev to RDEPENDS to fix the below QA issue.
ERROR: re2-2024.03.01-r0 do_package_qa: QA Issue: re2 rdepends on abseil-cpp-dev [dev-deps]
4, The ptest output as below:
# ./run-ptest PASS: charclass_test PASS: compile_test PASS: filtered_re2_test PASS: mimics_pcre_test PASS: parse_test PASS: possible_match_test PASS: re2_test PASS: re2_arg_test PASS: regexp_test PASS: required_prefix_test PASS: search_test PASS: set_test PASS: simplify_test PASS: string_generator_test PASS: dfa_test PASS: exhaustive1_test PASS: exhaustive2_test PASS: exhaustive3_test PASS: exhaustive_test PASS: random_test
---
.../re2/{re2_2023.03.01.bb => re2_2024.03.01.bb} | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
rename meta-oe/recipes-support/re2/{re2_2023.03.01.bb => re2_2024.03.01.bb} (62%)meta-oe/recipes-support/re2/re2_2024.03.01.bb renamed from meta-oe/recipes-support/re2/re2_2023.03.01.bb +10 -3
@@ -3,8 +3,8 @@ HOMEPAGE = "https://github.com/google/re2/" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://LICENSE;md5=3b5c31eb512bdf3cb11ffd5713963760" -# tag 2023-03-01 -SRCREV = "241e2e430836e80f93d704d1f06cd3e7fe3100f5" +# tag 2024-03-01 +SRCREV = "2d866a3d0753f4f4fce93cccc6c59c4b052d7db4" SRC_URI = "git://github.com/google/re2.git;branch=main;protocol=https \ ${@bb.utils.contains('PTEST_ENABLED', '1', 'file://run-ptest', '', d)} \
@@ -12,12 +12,17 @@ SRC_URI = "git://github.com/google/re2.git;branch=main;protocol=https \ S = "${WORKDIR}/git" +DEPENDS = "abseil-cpp ${@bb.utils.contains('PTEST_ENABLED', '1', 'gtest googlebenchmark', '', d)}" + inherit cmake ptest RDEPENDS:${PN}-ptest += "cmake sed" +RDEPENDS:${PN} += "abseil-cpp-dev" + +INSANE_SKIP:${PN} += "dev-deps" EXTRA_OECMAKE += " \ -DBUILD_SHARED_LIBS=ON \ - ${@bb.utils.contains('PTEST_ENABLED', '1', '-DRE2_BUILD_TESTING=ON', '-DRE2_BUILD_TESTING=OFF', d)} \ + ${@bb.utils.contains('PTEST_ENABLED', '1', '-DRE2_BUILD_TESTING=ON', '-DRE2_BUILD_TESTING=OFF', d)} \ " do_install_ptest () {
@@ -25,6 +30,8 @@ do_install_ptest () { cp -r ${B}/CTestTestfile.cmake ${D}${PTEST_PATH} sed -i -e 's#${B}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` sed -i -e 's#${S}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` + # ERROR: re2-2024.03.01-r0 do_package_qa: QA Issue: /usr/lib64/re2/ptest/string_generator_test contained in package re2-ptest requires libtesting.so()(64bit), but no providers found in RDEPENDS:re2-ptest? [file-rdeps] + cp -r ${B}/libtesting.so ${D}${PTEST_PATH} } # ignore .so in /usr/lib64
Signature · 1 line
2.25.1