Date: Thu, 10 Sep 2009 05:10:26 +1000 From: Peter Jeremy <peterjeremy@acm.org> To: freebsd-amd64@freebsd.org Subject: Cross-building i386 on amd64 Message-ID: <20090909191026.GC55352@server.vk2pj.dyndns.org>
next in thread | raw e-mail | index | archive | help
--UHN/qo2QbUvPLonB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Cross-building i386 on amd64 is a fairly regular request and the only solution at present is installing a full i386 world and running the build inside a jail or chroot - and even then, some tweaks are necessary for (eg) the FreeBSD buildworld to work. Since the amd64 toolchain is inherently capable of building i386 code, this seems overkill. The biggest impediment I can see to cross-building i386 on amd64 is the presence of /usr/include/machine. I've been doing some thinking and come up with a number of possible solutions. I would appreciate input on any other approaches and which is the best approach. 1) Install /sys/{amd64,i386}/include as /usr/include/{amd64,i386} and use a variant symlink from /usr/include/machine + Extensible to other architectures if necessary + Easiest to understand for end users - Variant symlinks don't exist in FreeBSD 2) Install /sys/{amd64,i386}/include as /usr/include/{amd64,i386}/machine and use an option-dependent test in gcc specs to add -I/usr/include/i386 or -I/usr/include/amd64 before -I/usr/include + Extensible to other architectures if necessary - end users need to understand toolchain innards to find <machine/foo.h> - list of "standard system directories" in gcc may need tweaking so that -nostdinc and -I behave as documented[*] 3) Create /usr/include32 containing i386 include files + Naming consistent with existence of /usr/lib32 - list of "standard system directories" in gcc may need tweaking so that -nostdinc and -I behave as documented[*] - Not extensible - Duplicates installation of 99.8% of /usr/include (or needs pile of symlinks) Overall, I believe 2 may be the best option but would appreciate comments. [*] gcc documentation for -I DIR states: "If the directory DIR is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated." Do we need to make sure that someone manually entering -I/usr/include/i386 doesn't cause problems? How about someone using -nostdinc to fiddle with the system include ordering - they are likely to miss the special handling for <machine/foo.h>? --=20 Peter Jeremy --UHN/qo2QbUvPLonB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkqn/aIACgkQ/opHv/APuIcxXACeIDg4ilBLwgXCwrvVjJXU3qBZ Wt0AoL25DQJDvYzNr5XUBz6V6U0bTHwc =7sui -----END PGP SIGNATURE----- --UHN/qo2QbUvPLonB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090909191026.GC55352>