openexr icon indicating copy to clipboard operation
openexr copied to clipboard

ilmbase: FTCBFS: uses the host arch compiler for build tools

Open malaterre opened this issue 7 years ago • 7 comments

ilmbase fails to cross build from source, because it uses the host architecture compiler to build two build tools. The attached patch fixes that by switching the compiler to CXX_FOR_BUILD, which needs updating configure.ac and thus running autoreconf. Please consider applying it.

Original ref: https://bugs.debian.org/841439

malaterre avatar Jan 11 '17 12:01 malaterre

$ cat ilmbase.patch 
From: Helmut Grohne <>
Subject: compile build tools with the build architecture compiler

Index: ilmbase-2.2.0/configure.ac
===================================================================
--- ilmbase-2.2.0.orig/configure.ac
+++ ilmbase-2.2.0/configure.ac
@@ -28,6 +28,7 @@
 AC_PROG_LN_S
 AC_PROG_LIBTOOL
 AC_PROG_MAKE_SET
+AX_PROG_CXX_FOR_BUILD
 
 dnl
 dnl PKGCONFIG preparations
Index: ilmbase-2.2.0/Half/Makefile.am
===================================================================
--- ilmbase-2.2.0.orig/Half/Makefile.am
+++ ilmbase-2.2.0/Half/Makefile.am
@@ -17,9 +17,11 @@
 
 CLEANFILES = eLut eLut.h toFloat toFloat.h
 
-eLut_SOURCES = eLut.cpp
+eLut$(EXEEXT): eLut.cpp
+	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@
 
-toFloat_SOURCES = toFloat.cpp
+toFloat$(EXEEXT): toFloat.cpp
+	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@
 
 eLut.h:	eLut
 	./eLut > eLut.h

malaterre avatar Jan 11 '17 12:01 malaterre

no comment ?

malaterre avatar Oct 23 '18 09:10 malaterre

Bump, encountered the same issue.

globin avatar Nov 29 '18 11:11 globin

I think I understand that the problem is that when trying to build the generated source files, the program that generates the source files itself needs to link against parts of IlmBase?

In that case, the generating programs need to be host architecture so they can run on the host architecture. So wouldn't the fix be that when targeting another architecture, say mips, you must build the helper programs on host, including any IlmBase dependencies on host, then build IlmBase on the target architecture?

meshula avatar Nov 30 '18 18:11 meshula

We use this in NixOS too https://github.com/NixOS/nixpkgs/commit/694b4d29e1d0e4c86d497da437a3eed90910a7db it would be nice if it was upstreamed.

Ericson2314 avatar May 14 '19 03:05 Ericson2314

The only change this patch needs is to use EXEEXT_FOR_BUILD rather than EXEEXT.

Ericson2314 avatar May 14 '19 03:05 Ericson2314

This would also need a cmake variant.

flokli avatar Apr 30 '20 10:04 flokli