diff mbox

libspatialindex: fix build on Microblaze

Message ID 20170814214059.18498-1-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni Aug. 14, 2017, 9:40 p.m. UTC
This commit fixes the build of libspatialindex on the Microblaze
architecture by working around a gcc bug, by passing -O0 as the
optimization level.

A patch to configure.ac is needed to not have -O2 be forced by the
libspatialindex build system, and therefore AUTORECONF=YES is now
needed.

Fixes:

  http://autobuild.buildroot.net/results/bbba2a2c97dbec21340c7fd07162a316a411cba4/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../0001-configure.ac-do-not-force-O2.patch        | 30 ++++++++++++++++++++++
 package/libspatialindex/libspatialindex.mk         | 10 ++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 package/libspatialindex/0001-configure.ac-do-not-force-O2.patch

Comments

Arnout Vandecappelle Aug. 15, 2017, 4:15 p.m. UTC | #1
On 14-08-17 23:40, Thomas Petazzoni wrote:
> This commit fixes the build of libspatialindex on the Microblaze
> architecture by working around a gcc bug, by passing -O0 as the
> optimization level.
> 
> A patch to configure.ac is needed to not have -O2 be forced by the
> libspatialindex build system, and therefore AUTORECONF=YES is now
> needed.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/bbba2a2c97dbec21340c7fd07162a316a411cba4/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

 Applied to master with one small change, thanks.

[snip]

>  LIBSPATIALINDEX_INSTALL_STAGING = YES
>  LIBSPATIALINDEX_LICENSE = MIT
>  LIBSPATIALINDEX_LICENSE_FILES = COPYING
> +# We're patching configure.ac

 I've updated the comment with the name of the patch, like we currently often do.

 I've also added an empty line above and below to make things stand out more.

 Regards,
 Arnout

> +LIBSPATIALINDEX_AUTORECONF = YES
> +LIBSPATIALINDEX_CXXFLAGS = $(TARGET_CXXFLAGS)
> +LIBSPATIALINDEX_CONF_ENV = CXXFLAGS="$(LIBSPATIALINDEX_CXXFLAGS)"
> +
> +# Workaround gcc ICE
> +# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485)
> +ifeq ($(BR2_microblaze),y)
> +LIBSPATIALINDEX_CXXFLAGS += -O0
> +endif
>  
>  $(eval $(autotools-package))
>
diff mbox

Patch

diff --git a/package/libspatialindex/0001-configure.ac-do-not-force-O2.patch b/package/libspatialindex/0001-configure.ac-do-not-force-O2.patch
new file mode 100644
index 0000000..c078e71
--- /dev/null
+++ b/package/libspatialindex/0001-configure.ac-do-not-force-O2.patch
@@ -0,0 +1,30 @@ 
+From 7472764fe19cb3eea77f21cc2859859b8ac62085 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Mon, 14 Aug 2017 23:36:36 +0200
+Subject: [PATCH] configure.ac: do not force -O2
+
+The user may want to provide its own set of optimization flags, and
+therefore forcing -O2 should not be done.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Submitted-upstream: https://github.com/libspatialindex/libspatialindex/pull/101
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index dc5e49f..2e2aa68 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -53,7 +53,7 @@ if test "x$enable_debug" = "xyes"; then
+ 	CXXFLAGS="$CXXFLAGS -g -DDEBUG"
+ 	AC_MSG_RESULT(checking wether debug information is enabled... yes)
+ else
+-	CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
++	CXXFLAGS="$CXXFLAGS -DNDEBUG"
+ 	AC_MSG_RESULT(checking wether debug information is enabled... no)
+ fi
+ 
+-- 
+2.9.4
+
diff --git a/package/libspatialindex/libspatialindex.mk b/package/libspatialindex/libspatialindex.mk
index d815364..e6e773d 100644
--- a/package/libspatialindex/libspatialindex.mk
+++ b/package/libspatialindex/libspatialindex.mk
@@ -10,5 +10,15 @@  LIBSPATIALINDEX_SOURCE = spatialindex-src-$(LIBSPATIALINDEX_VERSION).tar.bz2
 LIBSPATIALINDEX_INSTALL_STAGING = YES
 LIBSPATIALINDEX_LICENSE = MIT
 LIBSPATIALINDEX_LICENSE_FILES = COPYING
+# We're patching configure.ac
+LIBSPATIALINDEX_AUTORECONF = YES
+LIBSPATIALINDEX_CXXFLAGS = $(TARGET_CXXFLAGS)
+LIBSPATIALINDEX_CONF_ENV = CXXFLAGS="$(LIBSPATIALINDEX_CXXFLAGS)"
+
+# Workaround gcc ICE
+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485)
+ifeq ($(BR2_microblaze),y)
+LIBSPATIALINDEX_CXXFLAGS += -O0
+endif
 
 $(eval $(autotools-package))