Compiling for i386 on amd64 using tinderbox

Christopher Key cjk32 at cam.ac.uk
Wed Apr 21 11:25:45 UTC 2010


Hello,

I've recently been experimenting with building ports for i386 and amd64
using tinderbox on an amd64 machine.  Most ports aren't architecture
specific, and just use the toolchain provided within the tinderbox jail,
blindly producing i386/amd64 binaries as appropriate.  However, some
ports are architecture specific, e.g. those that have assembler
optimised routines, and they cause problems when compiling for i386 on
my amd64 machine.  Generally, they detect their host environment using
uname, and get amd64 back from the kernel.  They then proceeed to build,
passing amd64 code the the i386 assembler, and fail.

I'm not sure what the best solution is to this problem.  The purist
approach would be to have tinderbox work harder to emulate the target
environment, and patch uname to return the appropriate answer.  An
alternative solutions seems to be to try to get ports to prevent
autodetection of the architecture, and use ARCH instead.  This can be
set in make.conf within the tinderbox jail, overriding the autodetection
performed by the port build system.  For most ports, the should be
fairly straightforward.  For example the only change needed in
qt4-corelib is [1]

Is this something that should be fixed?  Do either of the above
solutions make sense?  It certainly seems desirable to be able to cross
compile ports like this, both for testing and for producing packages. 


Kind regards,

Christopher Key




[1]
--- devel/qt4-corelib/Makefile  2010-03-25 14:52:17.000000000 +0000
+++ devel/qt4-corelib/Makefile  2010-04-21 11:35:20.000000000 +0100
@@ -27,6 +27,7 @@

 ALL_TARGET=    first
 CONFIGURE_ENV?=        QTDIR=${WRKSRC} PATH=${WRKSRC}/bin:$$PATH
+CONFIGURE_ARGS?=        -arch ${ARCH:S/amd64/x86_64/}
 MAKE_ENV?=     QTDIR=${WRKSRC} LD_LIBRARY_PATH=${WRKSRC}/lib \
                PATH=${WRKSRC}/bin:$$PATH




More information about the freebsd-ports mailing list