openexr
openexr copied to clipboard
ilmbase: FTCBFS: uses the host arch compiler for build tools
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
$ 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
no comment ?
Bump, encountered the same issue.
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?
We use this in NixOS too https://github.com/NixOS/nixpkgs/commit/694b4d29e1d0e4c86d497da437a3eed90910a7db it would be nice if it was upstreamed.
The only change this patch needs is to use EXEEXT_FOR_BUILD
rather than EXEEXT
.
This would also need a cmake variant.