On Sat, 2009-07-18 at 15:21 +1200, Amos Jeffries wrote: > Is anyone familiar enough with cross-compilation and auto-tools to > verify and/or correct the solution to this bug? > > http://www.squid-cache.org/bugs/show_bug.cgi?id=2662 > > I'm happy to commit as-is if someone who knows can confirm its okay to > force g++ as the host cross-compiler.
Thats a very odd way to solve the problem. If based on the gcc build system, its just propogating some historical ugliness (see http://sourceware.org/autobook/autobook/autobook_270.html) cf-gen runs on the build machine, not on the host machine. We just need to tell automake that this is the case. To refresh - there are three targets: build (the machine compiling) host (the machine that it will be installed on) target (the machine that code output from stuff run on host should be for) target is only needed for compilers - its used when creating a cross compiler. As cf-gen runs during compilation, it should use the build compiler. There is a bug/limitation in configure - when cross compiling, both host and build must be supplied. (see autoconfs manual section 13.1 specifying the system type). The gentoo bug doesn't list the configure parameters used, so I can't see if they are indeed doing that. We need to do several things: - make sure that cf-gen (and what it uses) *do not* include config.h anywhere. (config.h will be for the host, and may well have nonsense settings for building on the build machine; we would need to audit what we use from it in cf-gen carefully if we want to include it). - we do need to define a CC_FOR_BUILD or similar (and for the love of all thats holy don't put the string HOST in there) - we should use that appropriate to build cf-gen So the patch from gentoo - s/CXX_HOST/CXX_FOR_BUILD/ - and its nearly right. The only problem is determining the build machine cxx. sadly autoconf and automake don't have good built in foo for this (at least according to their manuals). So I'd do this http://archives.postgresql.org/pgsql-hackers/2005-05/msg01520.php This is simple, lets people define the variable themselves, and we can worry about reusing the lookup logic in AC_PROG_CXX some other day. -Rob
signature.asc
Description: This is a digitally signed message part