chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] cross compilation setup


From: F. Wittenberger
Subject: [Chicken-users] cross compilation setup
Date: Mon, 01 Sep 2008 17:12:53 +0200

Hi all,

I'm trying to set up a cross compilation environment following the steps
details in http://chicken.wiki.br/cross-compilation .  This did not
fully apply, here is what I did:

I want to compile on Linux (Ubuntu 8.04) and build Windows executables.

1. I installed the mingw32 package.

2. make PLATFORM=linux HOST=i586-mingw32msvc PREFIX=/ ARCH=x86 DESTDIR=
$HOME/lib/mingw  

This leads to the first suspicious difference between the wiki page and
my command line.  the wiki said "Setting HOST will compile the C files
for the CHICKEN runtime system with ... [arm-linux-gcc]" - hence I'd
expect i586-mingw32msvc-gcc to be used, but the first I see is:

gcc -fno-strict-aliasing -DHAVE_CHICKEN_CONFIG_H -c apply-hack.x86.s -o
apply-hack.x86.o

which looks different.  The defaults.make appears to use HOSTSYSTEM, not
HOST.  So let's start all over.

3. make PLATFORM=linux HOSTSYSTEM=i586-mingw32msvc PREFIX=/ ARCH=x86
DESTDIR=$HOME/lib/mingw  

This dies searching for sysexits.h -- which in turn comes from
chicken-defaults.h (or was it chicken-config.h - why those two?).  I
removed them and ran

4. make PLATFORM=mingw-msys HOSTSYSTEM=i586-mingw32msvc PREFIX=/
ARCH=x86 DESTDIR=$HOME/lib/mingw 

This did generate the files, but dies after compiling apply-hack.x86.s
and  library.c to library-static.o -- it misses chicken.exe so badly.

5. make PLATFORM=linux HOSTSYSTEM=i586-mingw32msvc PREFIX=/ ARCH=x86
DESTDIR=$HOME/lib/mingw POSIXFILE=posixwin


This failes in the linker missing -ldl

6. make PLATFORM=mingw-msys HOSTSYSTEM=i586-mingw32msvc PREFIX=/
ARCH=x86 DESTDIR=$HOME/lib/mingw POSIXFILE=posixwin

 .... Creating library file: libchicken.dll.a ? Is this correct???

again missing chicken.exe

7. make CHICKEN=chicken PLATFORM=linux HOSTSYSTEM=i586-mingw32msvc
PREFIX=/ ARCH=x86 DESTDIR=$HOME/lib/mingw POSIXFILE=posixwin

Maybe that's a better trick than (5) ?

$ file chicken.exe 
chicken.exe: MS-DOS executable PE  for MS Windows (console) Intel 80386
32-bit

At least it seems to work.

8. make PLATFORM=mingw-msys HOSTSYSTEM=i586-mingw32msvc PREFIX=/
ARCH=x86 DESTDIR=$HOME/lib/mingw POSIXFILE=posixwin CHICKEN=chicken
install-libs

9. make PLATFORM=linux HOSTSYSTEM=i586-mingw32msvc PREFIX=/ ARCH=x86
DESTDIR=$HOME/lib/mingw POSIXFILE=posixwin CHICKEN=chicken clean

rm chicken-defaults.h chicken-config.h

10.   make PLATFORM=linux TARGET_PREFIX=$HOME/lib/mingw
TARGETSYSTEM=i586-mingw32msvc PREFIX=$HOME/lib/mingw-cross
TARGET_RUN_PREFIX='C:\\\\\\\\Ball' PROGRAM_PREFIX=mingw- install

[[[ The huge amount of #\\ is just trial&error and ought to be fixed in
the Makefile - skipping that now, because it seems that more #\/ are
inserted into filenames, which I doubt is acceptable for Wind$s. ]]]

$ PATH=/home/jfw/lib/mingw-cross/bin/:$PATH
$ mingw-csi

CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.3.11 - linux-unix-gnu-x86     [ manyargs dload ptables applyhook
cross ]
SVN rev. 11663  compiled 2008-09-01 on berfert (Linux)

looks good so far

11. mingw-chicken-setup -host-extension -v easyffi

!!! Use -host-extension - not -host as the wiki said.  -host is the same
as -H and changes the download host name!

Now chicken-setup accepts the -host-extension and sets a parameter
object, but does not evaluate it anywhere.  (Therefore it tries to
compile with the target instead the host compiler.)  Around line 347 I
changed:

(define-macro (compile . explist)
  `(run (csc ,@(if (host-extension) '("-host") '()) ,@explist) ) )

Repeat from (10) to install the fixed binary.

$ mingw-chicken-setup -l
chicken-wrap                               Version: 1.92 
easyffi                                    Version: 1.92 (Release
200802130216)
silex                                      Version:  1.1 (Release
200803222148)

That's enough for today.  I need a break.

best regards

/Jörg




reply via email to

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