[PATCH 0/1] Cross-compiling 32-bit macOS from 64-bit-only macOS.

Brendan Shanks bshanks at codeweavers.com
Thu Oct 21 00:12:22 CDT 2021


Something I've been working on lately is cross-compiling Wine for 32-bit
Mac from newer 64-bit-only macOS versions (10.15 and newer). This should
be especially useful for anyone packaging Wine for macOS. 

The first part needed is a toolchain. Apple's last official toolchain to
support targeting i386 is Xcode 9.4.1 and the 10.13 SDK, but this is 
unable to run on any OS newer than 10.14.

To fix this, I've created a hack that allows the Xcode 9.4.1 toolchain to
be used on newer OSes: <https://github.com/mrpippy/XcodeNueve>


With the toolchain working, building i386 with it is now a cross-compile.
Apple does not prefix the commands with the host triplet though
(i.e. 'i386-apple-darwin'), which Wine seems to expect for cross-compiling.

Specifically, configure adds "-b <host triplet>" to TARGETFLAGS, causing
winebuild to search for commands like ld and nm prefixed with that host
triplet, which fails.

This is a patch which only sets that TARGETFLAGS when the host triplet
appears in $CC. I'm open to a different approach to fixing this though.


Here's the command I use to configure, assuming the modified Xcode 9.4.1
is at /Applications/Xcode9.app:

DEVELOPER_DIR="/Applications/Xcode9.app" \
SDKROOT="/Applications/Xcode9.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" \
../configure --host=i386-apple-darwin \
--with-wine-tools=<path to wine64 build> --with-wine64=<path to wine64 build> \
CC="clang -arch i386" TARGETFLAGS="-m32"

Make also needs to be run with DEVELOPER_DIR and SDKROOT set.
And this also works on Apple Silicon, just run with 'arch -x86_64'

Brendan Shanks (1):
  configure: Only set TARGETFLAGS when cross-compiling with
    host-prefixed tools.

 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.30.1 (Apple Git-130)




More information about the wine-devel mailing list