[gambit-list] Setting up scheme environment causes SDL to hang

Patrick Li patrickli.2001 at gmail.com
Wed Feb 15 21:17:14 EST 2012


Hi,

I am trying to get Gambit playing well with SDL, and am running into some
strange problems when trying to set up the scheme environment.

This is the main() function that starts up a SDL window:

int main(int argc, char *argv[])
{
  /* //SETUP */
  ___setup_params_struct setup_params;
  ___setup_params_reset (&setup_params);
  setup_params.version = ___VERSION;
  setup_params.linker  = SCHEME_LIBRARY_LINKER;
  ___setup (&setup_params);

  x = 0;
  run_stuff(); //Starts a simple SDL animation

  /* //CLEANUP */
  ___cleanup ();
}

Currently everything is still in C, so there are *no* calls to any scheme
functions yet.

I found that the animation runs for about 3 seconds before the whole
program hangs. If I comment out __setup(&setup_params), then the program
executes normally.

Are there some subtleties when setting up the Gambit environment that I
have to watch out for? Is Gambit spawning another thread and causing some
deadlock problems? I am fairly certain that SDL is single-threaded, and the
whole animation runs in an infinite loop.

I would appreciate any insight people would have on this. Thanks a lot.
  -Patrick



On Wed, Feb 15, 2012 at 1:11 PM, Marc Feeley <feeley at iro.umontreal.ca>wrote:

>
> On 2012-02-15, at 1:36 PM, Patrick Li wrote:
>
> > Hello everyone,
> >
> > I am just getting started using gsc to compile files, and I'm wondering
> how to go about debugging some error messages I'm seeing.
> >
> > This is what I am doing:
> >
> > == inside misha-sdl.scm ==
> > (println "hello world")
> >
> > == inside terminal ==
> > gsc -link misha-sdl
> > gcc misha-sdl.c misha-sdl_.c -I/Library/Gambit-C/v4.6.2/include
> -L/Library/Gambit-C/v4.6.2/lib -lgambc
> >
> > == error message ==
> > ld: warning: ignoring file /Library/Gambit-C/v4.6.2/lib/libgambc.a, file
> was built for archive which is not the architecture being linked (x86_64)
> > Undefined symbols for architecture x86_64:
> >   "____gstate", referenced from:
> >       ____H__20_misha_2d_sdl in cci2oaPA.o
> >   "____G_println", referenced from:
> >       ____H__20_misha_2d_sdl in cci2oaPA.o
> >   "_____20___gambc", referenced from:
> >       ____linker_tbl in ccR9LONi.o
> >   "____main_char", referenced from:
> >       _main in ccR9LONi.o
> >
> > The notice about skipping libgambc.a is especially worrying.
> >
> > However, using the command:
> > gsc -o hello -exe misha-sdl.scm
> > works perfectly. Is there any way to query to see what flags gsc is
> passing to gcc?
> >
>
> You can use the -verbose option to gsc :
>
>   gsc -verbose -o hello -exe misha-sdl.scm
>
> Marc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120215/be7744a8/attachment.htm>


More information about the Gambit-list mailing list