package/gtest: fix gtest.pc/gmock.pc library names for the debug build
PATCH 1/2 package/gtest: fix gtest.pc/gmock.pc library names for the debug build
Fixes:
- http://autobuild.buildroot.org/results/e1bb8aa1de310f3d27b74ec7d8748d170ad444e2
Quoted 1 line
Quoted 1 line
Quoted 1 line
libcamera
40f5fddca7f774944a53f58eeaebc4db79c373d8Building
[...]
[114/123] Linking target src/lc-compliance/lc-compliance
FAILED: src/lc-compliance/lc-compliance
[...] .../host/lib/gcc/arm-buildroot-linux-uclibcgnueabi/10.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lgtest
--- ...test.pc-gmock.pc-library-names-for-t.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/gtest/0001-pkg-config-fix-gtest.pc-gmock.pc-library-names-for-t.patch
package/gtest/0001-pkg-config-fix-gtest.pc-gmock.pc-library-names-for-t.patch new file +62 -0
@@ -0,0 +1,62 @@ +From cf5a3177159ca832470e7f876cab0a1923fa666f Mon Sep 17 00:00:00 2001 +From: Peter Seiderer <[email protected]> +Date: Fri, 22 Oct 2021 20:17:36 +0200 +Subject: [PATCH] pkg-config: fix gtest.pc/gmock.pc library names for the debug + build + +In case CMAKE_BUILD_TYPE is set to Debug the gtest library is +name libgtestd.a but the link command returned from gtest.pc is +'-lgtest' (without the debug d) and so the linking of dependent +packages fails (see [1] for a buildroot failure example). + +Enhance the gtest.pc ang gmock.pc generation to honour the debug 'd'. + +[1] http://lists.busybox.net/pipermail/buildroot/2021-October/626382.html + +[Upstream: https://github.com/google/googletest/pull/3625] +Signed-off-by: Peter Seiderer <[email protected]> +--- + googlemock/cmake/gmock.pc.in | 2 +- + googletest/cmake/gtest.pc.in | 2 +- + googletest/cmake/internal_utils.cmake | 3 +++ + 3 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/googlemock/cmake/gmock.pc.in b/googlemock/cmake/gmock.pc.in +index 23c67b5c..0f469857 100644 +--- a/googlemock/cmake/gmock.pc.in ++++ b/googlemock/cmake/gmock.pc.in +@@ -6,5 +6,5 @@ Description: GoogleMock (without main() function) + Version: @PROJECT_VERSION@ + URL: https://github.com/google/googletest + Requires: gtest = @PROJECT_VERSION@ +-Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ ++Libs: -L${libdir} -lgmock@DEBUG_POSTFIX@ @CMAKE_THREAD_LIBS_INIT@ + Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ +diff --git a/googletest/cmake/gtest.pc.in b/googletest/cmake/gtest.pc.in +index b4148fae..225bba81 100644 +--- a/googletest/cmake/gtest.pc.in ++++ b/googletest/cmake/gtest.pc.in +@@ -5,5 +5,5 @@ Name: gtest + Description: GoogleTest (without main() function) + Version: @PROJECT_VERSION@ + URL: https://github.com/google/googletest +-Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ ++Libs: -L${libdir} -lgtest@DEBUG_POSTFIX@ @CMAKE_THREAD_LIBS_INIT@ + Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ +diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake +index 58fc9bfb..fd81b825 100644 +--- a/googletest/cmake/internal_utils.cmake ++++ b/googletest/cmake/internal_utils.cmake +@@ -335,6 +335,9 @@ function(install_project) + # Configure and install pkgconfig files. + foreach(t ${ARGN}) + set(configured_pc "${generated_dir}/${t}.pc") ++ if(CMAKE_BUILD_TYPE MATCHES Debug) ++ set(DEBUG_POSTFIX "d") ++ endif() + configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in" + "${configured_pc}" @ONLY) + install(FILES "${configured_pc}" +-- +2.33.1 +
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/libcamera: add lc-compliance test application option
- add lc-compliance test application option (and add proper dependencies on gtest and libevent)
--- package/libcamera/Config.in | 18 ++++++++++++++++++ package/libcamera/libcamera.mk | 7 +++++++ 2 files changed, 25 insertions(+)
package/libcamera/Config.in +18 -0
@@ -72,6 +72,24 @@ config BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC help Pipeline for the vimc device. +config BR2_PACKAGE_LIBCAMERA_COMPLIANCE + bool "lc-compliance test application" + depends on BR2_USE_WCHAR # gtest + depends on BR2_TOOLCHAIN_HAS_THREADS # gtest + depends on BR2_INSTALL_LIBSTDCPP # gtest + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # gtest + depends on BR2_USE_MMU # gtest + select BR2_PACKAGE_GTEST + select BR2_PACKAGE_LIBEVENT + help + lc-compliance test application + +comment "lc-compliance test application needs a toolchain w/ C++, wchar, threads, gcc >= 4.9" + depends on BR2_USE_MMU + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \ + !BR2_INSTALL_LIBSTDCPP || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + endif # BR2_PACKAGE_LIBCAMERA comment "libcamera needs a toolchain w/ C++, threads, wchar, dynamic library, gcc >= 7"
package/libcamera/libcamera.mk +7 -0
@@ -61,6 +61,13 @@ LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC) += vimc LIBCAMERA_CONF_OPTS += -Dpipelines=$(subst $(space),$(comma),$(LIBCAMERA_PIPELINES-y)) +ifeq ($(BR2_PACKAGE_LIBCAMERA_COMPLIANCE),y) +LIBCAMERA_DEPENDENCIES += gtest libevent +LIBCAMERA_CONF_OPTS += -Dlc-compliance=enabled +else +LIBCAMERA_CONF_OPTS += -Dlc-compliance=disabled +endif + # gstreamer-video-1.0, gstreamer-allocators-1.0 ifeq ($(BR2_PACKAGE_GSTREAMER1)$(BR2_PACKAGE_GST1_PLUGINS_BASE),yy) LIBCAMERA_CONF_OPTS += -Dgstreamer=enabled
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v1 2/2] package/libcamera: add lc-compliance test application option
Quoting Peter Seiderer (2021-10-22 20:07:02)
Quoted 14 lines
- add lc-compliance test application option (and add proper dependencies on gtest and libevent)
Signed-off-by Peter Seiderer <[email protected]>--- package/libcamera/Config.in | 18 ++++++++++++++++++ package/libcamera/libcamera.mk | 7 +++++++ 2 files changed, 25 insertions(+)package/libcamera/Config.in +0
-0
package/libcamera/Config.in config BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC · line 80
Quoted 9 lines
package/libcamera/Config.in +6
-0@@ -72,6 +72,24 @@ config BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC help Pipeline for the vimc device. +config BR2_PACKAGE_LIBCAMERA_COMPLIANCE + bool "lc-compliance test application" + depends on BR2_USE_WCHAR # gtest + depends on BR2_TOOLCHAIN_HAS_THREADS # gtest + depends on BR2_INSTALL_LIBSTDCPP # gtest + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # gtest
I think we stipulate a minimum gcc 7 on libcamera support, but this is for gtest ...
Other than that, this is better than simply disabling.
Quoted 36 lines
package/libcamera/Config.in +12
-0+ depends on BR2_USE_MMU # gtest + select BR2_PACKAGE_GTEST + select BR2_PACKAGE_LIBEVENT + help + lc-compliance test application + +comment "lc-compliance test application needs a toolchain w/ C++, wchar, threads, gcc >= 4.9" + depends on BR2_USE_MMU + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \ + !BR2_INSTALL_LIBSTDCPP || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + endif # BR2_PACKAGE_LIBCAMERA comment "libcamera needs a toolchain w/ C++, threads, wchar, dynamic library, gcc >= 7"package/libcamera/libcamera.mk +7
-0@@ -61,6 +61,13 @@ LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC) += vimc LIBCAMERA_CONF_OPTS += -Dpipelines=$(subst $(space),$(comma),$(LIBCAMERA_PIPELINES-y)) +ifeq ($(BR2_PACKAGE_LIBCAMERA_COMPLIANCE),y) +LIBCAMERA_DEPENDENCIES += gtest libevent +LIBCAMERA_CONF_OPTS += -Dlc-compliance=enabled +else +LIBCAMERA_CONF_OPTS += -Dlc-compliance=disabled +endif + # gstreamer-video-1.0, gstreamer-allocators-1.0 ifeq ($(BR2_PACKAGE_GSTREAMER1)$(BR2_PACKAGE_GST1_PLUGINS_BASE),yy) LIBCAMERA_CONF_OPTS += -Dgstreamer=enabledSignature · 1 line
2.33.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines · On Fri, 22 Oct 2021 21:07:01 +0200 Peter Seiderer <[email protected]> wrote:
Fixes:
- http://autobuild.buildroot.org/results/e1bb8aa1de310f3d27b74ec7d8748d170ad444e2
Quoted 1 line
Quoted 1 line
Quoted 1 line
libcamera
40f5fddca7f774944a53f58eeaebc4db79c373d8Building[...]
[114/123] Linking target src/lc-compliance/lc-compliance
FAILED: src/lc-compliance/lc-compliance
[...] .../host/lib/gcc/arm-buildroot-linux-uclibcgnueabi/10.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lgtest
Quoted 5 lines
Signed-off-by Peter Seiderer <[email protected]>--- ...test.pc-gmock.pc-library-names-for-t.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/gtest/0001-pkg-config-fix-gtest.pc-gmock.pc-library-names-for-t.patch
Series applied, thanks! To be honest, I always found it very weird this choice of some upstream project to have a different library name depending on whether it is built with/without debug. But oh well, if that's how gtest wants it...
Note that you have to sign the Google CLA if you want them to consider your patch on gtest.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Seiderer <[email protected]> writes:
Fixes:
- http://autobuild.buildroot.org/results/e1bb8aa1de310f3d27b74ec7d8748d170ad444e2
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
libcamera
40f5fddca7f774944a53f58eeaebc4db79c373d8Building[...]
[114/123] Linking target src/lc-compliance/lc-compliance
FAILED: src/lc-compliance/lc-compliance
[...] .../host/lib/gcc/arm-buildroot-linux-uclibcgnueabi/10.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lgtestSigned-off-by Peter Seiderer <[email protected]>
Committed to 2021.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot