[gambit-list] Compile scheme to executable code...

David St-Hilaire sthilaid at iro.umontreal.ca
Sun May 6 13:22:07 EDT 2007


Hi everyone!

I'm rather new to the scheme world so that, so far, I've only needed to 
use a scheme interpreter to do the work I needed to get done. But now, I 
would be interested to build executable code from my scheme code. I've 
looked the example provided in the gambit documentation, but 
unfortunately, it does not work on my system (fedora core 6 laptop).

The exemple has 3 source files: m1.c, m2.scm and m3.scm. The 
instructions tells us to compile first the m2 and m3 scheme source files 
either by using

    $ *gsc -c m2.scm  /# create m2.c (note: .scm is optional)/*
    $ *gsc -c m3.scm  /# create m3.c (note: .scm is optional)/*
    $ *gsc m2.c m3.c  /# create the incremental link file m3_.c
    /*

or simply using:

    $ *gsc m2 m3
    *

The result of compiling the source files like this should create 3 new 
files: m2.c, m3.c and m3_.c, but on my system, only the m2.c and m3.c 
files gets created... Then when I try to compile my 3 'c' files with gcc:

    $ gcc -I/home/dave/diro/ift3060/g4/current/include -L/home/dave/diro/ift3060/g4/current/lib m1.c m2.c m3.c -lgambc -lm -ldl -lutil
    /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crt1.o: In function `_start':
    (.text+0x18): undefined reference to `main'
    /tmp/cc5ZPJZX.o: In function `___H__20_m2':
    m2.c:(.text+0x59): undefined reference to `___G_pow2'
    m2.c:(.text+0x64): undefined reference to `___G_twice'
    /tmp/cc5ZPJZX.o: In function `___init_proc':
    m2.c:(.text+0x4d6): undefined reference to `___G__20_m2'
    m2.c:(.text+0x4db): undefined reference to `___G__20_m2'
    m2.c:(.text+0x4e0): undefined reference to `___G__20_m2'
    m2.c:(.text+0x4ed): undefined reference to `___G__20_m2_23_0'
    m2.c:(.text+0x4f2): undefined reference to `___G__20_m2_23_0'
    m2.c:(.text+0x4f7): undefined reference to `___G__20_m2_23_0'
    /tmp/ccKAvQIK.o: In function `___H__20_m3':
    m3.c:(.text+0xa5): undefined reference to `___G_twice'
    m3.c:(.text+0xb2): undefined reference to `___G_pow2'
    /tmp/ccKAvQIK.o: In function `___init_proc':
    m3.c:(.text+0x779): undefined reference to `___G__20_m3'
    m3.c:(.text+0x77e): undefined reference to `___G__20_m3'
    m3.c:(.text+0x783): undefined reference to `___G__20_m3'
    collect2: ld returned 1 exit status
      

What's going on? How can I compile this simple example?

Thank you very much for your help!!

__
David St-Hilaire




More information about the Gambit-list mailing list