Skip to contentSkip to conversation

libvips: fix compile error for sparc64

PATCH New Waldemar Brodkorb 2 participants 3 messages Nov 23, 2015 – Dec 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libvips: fix compile error for sparc64

Fixes following build error:
http://autobuild.buildroot.net/results/1515f070c0fd410c681fc8306700244c34eb1635/

---
v1 -> v2:
- fixes suggested by Thomas Pettazoni
- better testing done. Compiles for sparc64 and arm.
- same issue happens with gcc 5.x

---
 package/libvips/libvips.mk |   11 +++++++++++
 1 file changed, 11 insertions(+)
package/libvips/libvips.mk +11 -0
index d6dddc8..eb034b1 100644
@@ -12,6 +12,17 @@ LIBVIPS_LICENSE = LGPLv2.1+
 LIBVIPS_LICENSE_FILES = COPYING
 # We're patching gtk-doc.make, so need to autoreconf
 LIBVIPS_AUTORECONF = YES
+
+# Sparc64 compile fails, this seems to be caused by the -Os option we pass
+# by default. To fix the problem, use -O0 with no optimization instead.
+ifeq ($(BR2_sparc64),y)
+LIBVIPS_CXXFLAGS = $(filter-out -Os,$(TARGET_CXXFLAGS))
+LIBVIPS_CXXFLAGS += -O0
+else
+LIBVIPS_CXXFLAGS = $(TARGET_CXXFLAGS)
+endif
+LIBVIPS_CONF_ENV += CXXFLAGS="$(LIBVIPS_CXXFLAGS)"
+
 LIBVIPS_CONF_OPTS = \
 	--disable-introspection \
 	--without-dmalloc \
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/1 libvips: fix compile error for sparc64

Waldemar,

Quoted 8 lines · Waldemar Brodkorb
package/libvips/libvips.mk +0 -0
index d6dddc8..eb034b1 100644
@@ -12,6 +12,17 @@ LIBVIPS_LICENSE = LGPLv2.1+
 LIBVIPS_LICENSE_FILES = COPYING
 # We're patching gtk-doc.make, so need to autoreconf
 LIBVIPS_AUTORECONF = YES

package/libvips/libvips.mk LIBVIPS_LICENSE = LGPLv2.1+ · line 24

Quoted 10 lines
package/libvips/libvips.mk +10 -0
+
+# Sparc64 compile fails, this seems to be caused by the -Os option we pass
+# by default. To fix the problem, use -O0 with no optimization instead.
+ifeq ($(BR2_sparc64),y)
+LIBVIPS_CXXFLAGS = $(filter-out -Os,$(TARGET_CXXFLAGS))
+LIBVIPS_CXXFLAGS += -O0
+else
+LIBVIPS_CXXFLAGS = $(TARGET_CXXFLAGS)
+endif
+LIBVIPS_CONF_ENV += CXXFLAGS="$(LIBVIPS_CXXFLAGS)"

I am still not super happy with this solution, since it's really work arounding a compiler bug it seems, and the way it's implemented will never allow to notice when the bug gets fixed. But I don't really have a much better solution.

Has at least the problem been reported to upstream gcc? If it's already reported, do you have a pointer to the upstream bug?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 libvips: fix compile error for sparc64

In reply to Waldemar Brodkorb

Dear Waldemar Brodkorb,

Quoted 4 lines · Waldemar Brodkorb

Fixes following build error:
http://autobuild.buildroot.net/results/1515f070c0fd410c681fc8306700244c34eb1635/

Quoted 8 lines

---
v1 -> v2:
- fixes suggested by Thomas Pettazoni
- better testing done. Compiles for sparc64 and arm.
- same issue happens with gcc 5.x

---
 package/libvips/libvips.mk |   11 +++++++++++
 1 file changed, 11 insertions(+)

I've applied after simplifying the logic, and reporting the bug upstream to the gcc developers (I was able to reproduce with gcc 5.3.0). The logic could be simplified a lot by simply doing:

# Sparc64 compile fails, for all optimization levels except -O0. To

# fix the problem, use -O0 with no optimization instead. Bug reported
# upstream at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69038.
ifeq ($(BR2_sparc64),y)
LIBVIPS_CXXFLAGS += -O0
endif

LIBVIPS_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) $(LIBVIPS_CXXFLAGS)"

Indeed, if you put -O0 *after* a previous -O<something> option, it takes precedence. So there's no need to do a filter. In addition, this is more correct since the compiler bug also occurs with -O2 or -O3, not only -Os.

See
https://git.busybox.net/buildroot/commit/?id=c4486e8c947e728b663eb2ac1c0286077129445f
for the final commit.

Thanks!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com