Skip to contentSkip to conversation

package/glog: switch to cmake

PATCH New Fabrice Fontaine 2 participants 2 messages Oct 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/glog: switch to cmake

Switch to cmake to fix a build failure on m68k with uclibc because glog's configure tests wrongly thinks that -fPIE works

By switching to cmake, we can remove the patch as the unittests won't be built anymore

We can also finely tune options such as gflags, threads and dynamic library support. This last option is handled through the standard BUILD_SHARED_LIBS option

Fixes:
- http://autobuild.buildroot.net/results/5a659d960c24256a2905f129dfa70e3dc9e92aec

---
 ...mbolize.cc-fix-build-without-dlfcn.h.patch | 37 ++++++++++++++++++
 ...ts-some-tests-require-HAVE_STACKTRAC.patch | 39 -------------------
 package/glog/Config.in                        |  7 +---
 package/glog/glog.mk                          | 21 +++-------
 4 files changed, 45 insertions(+), 59 deletions(-)
 create mode 100644 package/glog/0001-src-symbolize.cc-fix-build-without-dlfcn.h.patch
 delete mode 100644 package/glog/0001-symbolize_unitests-some-tests-require-HAVE_STACKTRAC.patch
package/glog/0001-src-symbolize.cc-fix-build-without-dlfcn.h.patch new file +37 -0
new file mode 100644
index 0000000000..73c6e670ed
@@ -0,0 +1,37 @@
+From f71e0899439aaa0e6172243a0862bf8a72a241fc Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Mon, 28 Oct 2019 18:21:55 +0100
+Subject: [PATCH] src/symbolize.cc: fix build without dlfcn.h
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: https://github.com/google/glog/pull/475]
+---
+ src/symbolize.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/symbolize.cc b/src/symbolize.cc
+index 1ffc607..ff027f2 100644
+--- a/src/symbolize.cc
++++ b/src/symbolize.cc
+@@ -110,7 +110,9 @@ _END_GOOGLE_NAMESPACE_
+ 
+ #if defined(__ELF__)
+ 
++#if defined(HAVE_DLFCN_H)
+ #include <dlfcn.h>
++#endif
+ #if defined(OS_OPENBSD)
+ #include <sys/exec_elf.h>
+ #else
+@@ -832,7 +834,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
+ 
+ _END_GOOGLE_NAMESPACE_
+ 
+-#elif defined(OS_MACOSX) && defined(HAVE_DLADDR)
++#elif defined(OS_MACOSX) && defined(HAVE_DLADDR) && defined(HAVE_DLFCN_H)
+ 
+ #include <dlfcn.h>
+ #include <string.h>
+-- 
+2.23.0
+
package/glog/0001-symbolize_unitests-some-tests-require-HAVE_STACKTRAC.patch deleted +0 -39
deleted file mode 100644
index 10a84fbbe0..0000000000
@@ -1,39 +0,0 @@
-From 87b41094299cdc626876085549725ed0205ca830 Mon Sep 17 00:00:00 2001
-From: Gilles Talis <[email protected]>
-Date: Sat, 26 Oct 2019 19:10:43 +0200
-Subject: [PATCH] symbolize_unitests: some tests require HAVE_STACKTRACE
- defined to be run
-
-The following test cases functions:
--  TestWithPCInsideInlineFunction
--  TestWithPCInsideNonInlineFunction
--  TestWithReturnAddress
-are defined if HAVE_STACKTRACE is defined
-
-Make sure they are invoked under the same condition
-
-Signed-off-by: Gilles Talis <[email protected]>
----
- src/symbolize_unittest.cc | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/src/symbolize_unittest.cc b/src/symbolize_unittest.cc
-index 9a17e7b..e11470e 100644
---- a/src/symbolize_unittest.cc
-+++ b/src/symbolize_unittest.cc
-@@ -407,9 +407,12 @@ int main(int argc, char **argv) {
-   // used to install some callback function at InitGoogle() time.
-   InstallSymbolizeCallback(NULL);
-
-+# if defined(HAVE_STACKTRACE)
-   TestWithPCInsideInlineFunction();
-   TestWithPCInsideNonInlineFunction();
-   TestWithReturnAddress();
-+# endif
-+
-   return RUN_ALL_TESTS();
- # elif defined(OS_WINDOWS) || defined(OS_CYGWIN)
-   TestWithReturnAddress();
--- 
-2.17.1
-
package/glog/Config.in +2 -5
index 534997af49..e864094646 100644
@@ -1,13 +1,10 @@
 config BR2_PACKAGE_GLOG
 	bool "glog"
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on !BR2_STATIC_LIBS
 	help
 	  C++ implementation of the Google logging module
 
 	  https://github.com/google/glog
 
-comment "glog needs a toolchain w/ C++, threads, dynamic library"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
-		BR2_STATIC_LIBS
+comment "glog needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
package/glog/glog.mk +6 -15
index 6974f7bac7..9d31732a88 100644
@@ -9,23 +9,14 @@ GLOG_SITE = $(call github,google,glog,v$(GLOG_VERSION))
 GLOG_INSTALL_STAGING = YES
 GLOG_LICENSE = BSD-3-Clause
 GLOG_LICENSE_FILES = COPYING
-
-# No configure script provided, so we need autoreconf
-GLOG_AUTORECONF = YES
+GLOG_CONF_OPTS = \
+	$(if $(BR2_TOOLCHAIN_HAS_THREADS),-DWITH_THREADS=ON, -DWITH_THREADS=OFF)
 
 ifeq ($(BR2_PACKAGE_GFLAGS),y)
 GLOG_DEPENDENCIES = gflags
+GLOG_CONF_OPTS += -DWITH_GFLAGS=ON
+else
+GLOG_CONF_OPTS += -DWITH_GFLAGS=OFF
 endif
 
-# glog can optionally use atomic __sync built-ins. However, its
-# configure script only checks for the availability of the 4 bytes
-# version, but the code also uses the 1 byte version. While this works
-# on most architectures, it does not on architectures that implement
-# only the 4 bytes version, such as Microblaze. So if the architecture
-# does not implement the 1 byte version, we hint the configure script
-# that atomic built-ins should not be used.
-ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_1),)
-GLOG_CONF_ENV += ac_cv___sync_val_compare_and_swap=no
-endif
-
-$(eval $(autotools-package))
+$(eval $(cmake-package))
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 package/glog: switch to cmake

Quoted 9 lines · Fabrice Fontaine

Switch to cmake to fix a build failure on m68k with uclibc because glog's configure tests wrongly thinks that -fPIE works

By switching to cmake, we can remove the patch as the unittests won't be built anymore

We can also finely tune options such as gflags, threads and dynamic library support. This last option is handled through the standard BUILD_SHARED_LIBS option

Thank you for the detailed commit message.

Quoted 5 lines

Fixes:
- http://autobuild.buildroot.net/results/5a659d960c24256a2905f129dfa70e3dc9e92aec

[snip]

package/glog/Config.in line 5

Quoted 10 lines
package/glog/Config.in +0 -2
index 534997af49..e864094646 100644
@@ -1,13 +1,10 @@
 config BR2_PACKAGE_GLOG
 	bool "glog"
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on !BR2_STATIC_LIBS

Normally, we'd like this in 2 or 3 separate patches: one that just does the
cmake conversion (so without the new patch, and keeping these dependencies), and a second one that removes those dependencies. That allows the first patch to be backported to stable branches. It also makes the review a whole lot simpler.

However, since I anyway reviewed it already, and since the failure doesn't
occur on the stable branches since it is triggered by the version bump, I've applied to master, thanks.

Regards,
Arnout

Quoted 45 lines
package/glog/Config.in +2 -3
 	help
 	  C++ implementation of the Google logging module
 
 	  https://github.com/google/glog
 
-comment "glog needs a toolchain w/ C++, threads, dynamic library"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
-		BR2_STATIC_LIBS
+comment "glog needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
package/glog/glog.mk +6 -15
index 6974f7bac7..9d31732a88 100644
@@ -9,23 +9,14 @@ GLOG_SITE = $(call github,google,glog,v$(GLOG_VERSION))
 GLOG_INSTALL_STAGING = YES
 GLOG_LICENSE = BSD-3-Clause
 GLOG_LICENSE_FILES = COPYING
-
-# No configure script provided, so we need autoreconf
-GLOG_AUTORECONF = YES
+GLOG_CONF_OPTS = \
+	$(if $(BR2_TOOLCHAIN_HAS_THREADS),-DWITH_THREADS=ON, -DWITH_THREADS=OFF)
 
 ifeq ($(BR2_PACKAGE_GFLAGS),y)
 GLOG_DEPENDENCIES = gflags
+GLOG_CONF_OPTS += -DWITH_GFLAGS=ON
+else
+GLOG_CONF_OPTS += -DWITH_GFLAGS=OFF
 endif
 
-# glog can optionally use atomic __sync built-ins. However, its
-# configure script only checks for the availability of the 4 bytes
-# version, but the code also uses the 1 byte version. While this works
-# on most architectures, it does not on architectures that implement
-# only the 4 bytes version, such as Microblaze. So if the architecture
-# does not implement the 1 byte version, we hint the configure script
-# that atomic built-ins should not be used.
-ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_1),)
-GLOG_CONF_ENV += ac_cv___sync_val_compare_and_swap=no
-endif
-
-$(eval $(autotools-package))
+$(eval $(cmake-package))