cross-compiling

Hi,

I am stress testing clang build system and today my last idea was to
cross-compile clang
on SnowLeopard system using mingw from Cocotron project(they have a very
nice script
to get/compile/install latest mingw toolchain :
http://www.cocotron.org/Tools/Downloads/InstallCDT-2009-12-17.zip
sudo sh install.sh
export PATH=/Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/bin:$PATH)

So now the question is what should I pass to configure, because I tried
the following

./configure --enable-optimized --build=i386-mingw32msvc
--target=i386-mingw32msvc
make
llvm[1]: Compiling Alarm.cpp for Release build
In file included from Alarm.cpp:32:
Win32/Alarm.inc:39: error: expected initializer before ‘Sleep’
make[1]: *** [/Users/amartin/src/llvm/lib/System/Release/Alarm.o] Error 1
make: *** [all] Error 1

Don't seem to work so I tried also :
./configure --enable-optimized --host=i386-mingw32msvc
make
configure: error: Already configured in /Users/amartin/src/llvm
make[1]: *** No targets specified and no makefile found. Stop.
make: *** [cross-compile-build-tools] Error 1

./configure --enable-optimized --host=i386-mingw32msvc
--target=i386-mingw32msvc
configure: error: Already configured in /Users/amartin/src/llvm
make[1]: *** No targets specified and no makefile found. Stop.
make: *** [cross-compile-build-tools] Error 1

How do you-cross compile ?

Hello Vincent

./configure --enable-optimized --build=i386-mingw32msvc
--target=i386-mingw32msvc

What do you want to do? E.g. on which system you running the build,
which system you want to target?

I am building on MacOS SnowLeopard and I want to generate binaries running
on Windows.

I am building on MacOS SnowLeopard and I want to generate binaries running
on Windows.

Ok, then surely you need to put build=darwin and host=target=mingw32

In your case - I think your were confused by BuildTools directory -
consider removing it.

you mean something like that :

./configure --enable-optimized --build=darwin --host=mingw32
--target=mingw32

checking build system type... Invalid configuration `darwin': machine
`darwin' not recognized

Vincent,

./configure --enable-optimized --build=darwin --host=mingw32
--target=mingw32

checking build system type... Invalid configuration `darwin': machine
`darwin' not recognized

You need to provide proper target triplets here :slight_smile:

Also tried :

./configure --enable-optimized --build=i386-apple-darwin10.2.0 \
--host=i386-mingw32msvc \
--target=i386-mingw32msvc

and remove BuildTools:

configure: error: Already configured in /Users/amartin/src/llvm
make[1]: *** No targets specified and no makefile found. Stop.
make: *** [cross-compile-build-tools] Error 1

Will try on my home system because I have already noticed some issues at
work
but if someone on SnowLeopard could try ...

Will try on my home system because I have already noticed some issues at
work but if someone on SnowLeopard could try ...

It perefectly works on buildbot.
I'd suggest you to do a clean checkout / remove extra stuff.

mingw32 cross (debug) build succeeds for me too. though it produces one huge clang.exe :slight_smile:

build:
- llvm/clang trunk r96248
- Mac OS X 10.6.2

mingw32 toolchain based on:
- mingwrt-3.17-mingw32-dev.tar.gz
- w32api-3.14-mingw32-dev.tar.gz
- binutils-2.20.51.0.6.tar.bz2
- gmp-4.3.2.tar.bz2
- mpfr-2.4.2.tar.bz2
- gcc-4.4.3.tar.bz2

--kb