Hello,

I have a program "main.scm":
$ cat main.scm
(import (prefix sdl2 "sdl2:"))
(sdl2:set-main-ready!)
(sdl2:init! '(video))
(define window (sdl2:create-window! "Hello, World!" 0 0 600 400))
(sdl2:fill-rect! (sdl2:window-surface window) #f (sdl2:make-color 0 128 255))
(sdl2:update-window-surface! window)
(sdl2:delay! 3000)
(sdl2:quit!)

Also, I have this Makefile:
$ cat Makefile
CSC ?= csc
CC=$(shell $(CSC) -cc-name | sed "s/'//g")
CFLAGS=$(shell $(CSC) -cflags | sed "s/'//g")
LDFLAGS=$(shell $(CSC) -ldflags | sed "s/'//g")
LDLIBS=$(shell $(CSC) -libs | sed "s/'//g")
.PHONY: all clean edit run
.SECONDARY: main.c
all: main.out
clean:
        rm -fv *.c *.out
edit:
        gvim -p *.scm
run:
        ./*.out
%.c: %.scm
        $(CSC) -t -o $@ $<
%.out: %.c
        $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS)

On Linux, I can compile my program:
$ make
csc -t -o main.c main.scm
gcc -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -O2 
-fPIC -I/usr/include/chicken  -o main.out main.c -L/usr/lib64 
-Wl,-rpath=/usr/lib64  -lchicken -lm -ldl
Run it:
$ ./main.out
And I have the expected result.

However, if I cross compile my program, on Linux, for Windows:
$ CSC=i686-w64-mingw32-csc make
i686-w64-mingw32-csc -t -o main.c main.scm
i686-w64-mingw32-gcc -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H 
-DC_ENABLE_PTABLES -Os -fomit-frame-pointer 
-I/usr/i686-w64-mingw32/include/chicken  -o main.out main.c 
-L/usr/i686-w64-mingw32/lib -Wl,-rpath=/usr/i686-w64-mingw32/lib  -lchicken -lm 
-lws2_32
$ mv main.out main.exe
Run it on a windows machine.
I get some missing DLLs (libchicken.dll), so I add them to the same directory 
as the .exe.
I get some missing Eggs (sdl2-features.so, sdl2-internals.so, sdl2.so and 
srfi-1.so), so I add them to the same directory as the .exe.
Then I get the following error:
main.exe
Error: unbound variable: 
|MZ\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00\xff\xff\x00\x00\xb8\x00\x00\x00
\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0
0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x0e\x1f\xba\x0e\x00\xb4|

        Call history:

        <syntax>          (##core#quote #f)
        <syntax>          (##core#quote #f)
        <syntax>          (##core#require library chicken.base)
        <syntax>          (chicken.load#load-unit (##core#quote library) 
(##core#quote #f) (##core#q
uote #f))
        <syntax>          (##core#quote library)
        <syntax>          (##core#quote #f)
        <syntax>          (##core#quote #f)
        <syntax>          (##core#begin (##core#require expand chicken.syntax))
        <syntax>          (##core#require expand chicken.syntax)
        <syntax>          (chicken.load#load-unit (##core#quote expand) 
(##core#quote #f) (##core#qu
ote #f))
        <syntax>          (##core#quote expand)
        <syntax>          (##core#quote #f)
        <syntax>          (##core#quote #f)
        <eval>    (chicken.load#load-unit (##core#quote library) (##core#quote 
#f) (##core#quote #f)
)
        <eval>    (chicken.load#load-unit (##core#quote library) (##core#quote 
#f) (##core#quote #f)
)
        <eval>    (chicken.load#load-unit (##core#quote expand) (##core#quote 
#f) (##core#quote #f))
        <--
Here is the list of files in my directory:
$ file *
libchicken.dll:    PE32 executable (DLL) (console) Intel 80386, for MS Windows
main.exe:          PE32 executable (console) Intel 80386, for MS Windows
sdl2-features.so:  PE32 executable (DLL) (console) Intel 80386, for MS Windows
sdl2-internals.so: PE32 executable (DLL) (console) Intel 80386, for MS Windows
sdl2.so:           PE32 executable (DLL) (console) Intel 80386, for MS Windows
srfi-1.so:         PE32 executable (DLL) (console) Intel 80386, for MS Windows

I get this error only with this program that is using an egg.
With the same method, I have no problem to run a .exe, that is not using an 
egg, like a simple program that is doing factorial.

So, I am not sure what I am doing wrong, any idea please?

Thank you.
Best regards.

Reply via email to