[gambit-list] Help building shared lib

Evan Hanson vnhnsn at gmail.com
Sun Sep 19 22:24:16 EDT 2010


I'm trying to use gsc to build a shared library, but I'm having issues. 
I've been through the info file and tried a host of build techniques, 
and while the library compiles fine when I try to use it my test 
executable segfaults somewhere in __garbage_collect(). I've pared it to 
a trivial situation:

library.scm:

   (define (hello)
     (display "hello")
     (newline))

   (c-define (c-hello) () void "hello" ""
     (hello))

Makefile:

   gsc -link library
   gsc -obj -cc-options "-D___SHARED" library.c library_.c
   gcc -shared -o liblibrary.so library.o library_.o \
     -L/home/evanhanson/.builds/gambc/lib -lgambc

test.c:

   int main(int argc, char* argv[]) {
     hello();
     return 0;
   }

And the backtrace from gdb:

   #0  0x00007ffff782ea09 in ___garbage_collect () from ./libgambc.so
   #1  0x00007ffff782fbcc in ___alloc_scmobj () from ./libgambc.so
   #2  0x00007ffff782fd3b in ___make_vector () from ./libgambc.so
   #3  0x00007ffff78325ca in ___make_sfun_stack_marker () from
       ./libgambc.so
   #4  0x00007ffff741ce94 in hello () from ./libom.so
   #5  0x000000000040064d in main ()

I'm sure there's something simple I'm missing. Any suggestions?

Evan



More information about the Gambit-list mailing list