[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dev-serveez] i386-mingw32 cross compilation

From: stefan
Subject: [dev-serveez] i386-mingw32 cross compilation
Date: Fri, 4 Jan 2002 19:26:57 +0100 (CET)

Hello list,

at my work I was able to install a cross compiler for the i386-mingw32
target using a i686-linux.  Then I tried to build Serveez with it with the
following results.

I used binutils-2.11.92 and gcc-2.95.3-6 with MinGW 1.2 runtime/w32api
from <>.  Additional packages like
Guile, libbz2 and zlib cam from

        $ LIBS=-L/usr/local/i386-mingw32/lib i386-mingw32-configure \
          --prefix=/home/stefan/svz --host=i386-mingw32 \
          --build=i386-linux --with-guile=/usr/local/i386-mingw32

The `LIBS' environment variable helps the gcc toolchain to overwrite its
default search path which still refers to `/usr/lib'.

It seems like 

 * host: is the system the final executables shall run
 * build: is the system where you build these executable
 * target: is the system any gcc-toolchain program is meant to produce
           code for.

If I leave the `--host' argument libtool refuses to build shared libraries
for MinGW32.  I am personally a bit confused about these semantices
because the names can be misleading.  Any comments, hints?

Also you are required to set the `--build' argument to the correct value
because it defaults to the value of `--host' which I do not understand

The script `i386-mingw32-configure' looks like this:

#! /bin/sh

export AR=i386-mingw32-ar
export AS=i386-mingw32-as
export CXX=i386-mingw32-c++
export CC=i386-mingw32-gcc
export LD=i386-mingw32-ld
export DLLTOOL=i386-mingw32-dlltool
export NM=i386-mingw32-nm
export OBJDUMP=i386-mingw32-objdump
export RANLIB=i386-mingw32-ranlib
export STRIP=i386-mingw32-strip
export WINDRES=i386-mingw32-windres

echo "Setup for i386 MinGW32 cross..."
./configure $@ --target=i386-mingw32

Then I had to:

        $ HOST_CC=gcc make
        $ make install

The environment variable `HOST_CC' tells the `libtool' script to use the
native `gcc' in order to compile and run! a program named `impgen'
which creates the import library of `libserveez.dll' necessary to link
`serveez.exe' against it.  The `HOST_CC' defaults to the given cross
compiler `i386-mingw32-gcc' which creates a binary for Windows and can not
be run on the build system - which is done by libtool.

After all:
Thus I got a full shared build for Windows in less than 2 minutes where I
waited for about half an hour on my Windoze box at home.

I packed the installation directory and moved it to a Win2k machine.
Works like charm...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]