Dear Racket community, I need your help.

Once upon a time, I was looking for a Racket physics engine.  I looked 
around and found a few different bindings from Racket to the Chipmunk 
physics engine.  However, none of these repositories appeared to be 
maintained.  None of them used the latest version of Chipmunk.  And they 
didn't work (for me) out of the box.

So... in my hubris, I decided to learn the Racket FFI and make my own 
Racket/Chipmunk bindings.  Hence... this repo was born:

https://github.com/thoughtstem/racket-chipmunk

Still confident, I integrated my racket-chipmunk library into my 
Racket-based game-engine (https://github.com/thoughtstem/game-engine).

I THOUGHT all was well.  It worked great.  For a time, I was happy.

But then...  Three bad things happened:

1) First, I tried (and failed) to integrate the Rsound library into 
game-engine.  I thought (at the time) this was a problem in Rsound -- since 
the stack trace pointed me to the RSound code.  Here's the issue I 
opened: https://github.com/jbclements/RSound/issues/38

2) Then, later, when I saw the same error pop up with the Lux library, I 
started to think that maybe something in game-engine was at fault.  I did 
some digging and discovered racket-chipmunk to be the culprit.  Here's the 
issue where I came to that 
discovery: https://github.com/jeapostrophe/lux/issues/9

3) Now, a few days ago, I began to see a similar issue when I tried to 
integrate Mode Lambda into game-engine.  Once again, racket-chipmunk seems 
to be interfering with another library.  There's no explicit error message 
this time.  But the rendering is broken.  Here's the issue I opened about 
that: https://github.com/jeapostrophe/mode-lambda/issues/19

Feel free to follow those links to the issues for further information if 
you wish, but to save you some time, I'll try to sketch out the high level 
idea here.

Basically, in my racket-chipmunk library (in this file 
https://github.com/thoughtstem/racket-chipmunk/blob/master/lang/chipmunk-ffi.rkt),
 
I have these two lines:

(require ffi/unsafe)
(define chipmunk (ffi-lib "./binaries/libchipmunk"))



These two lines seem to subtly "poison" the Racket process (until I 
restart).  What I mean is that if I run those lines in ANY DrRacket tab, I 
immediately start to get subtle errors with programs launched from ANY 
other tabs -- whether or not those programs are even related to each 
other.  

1) With RSound and Lux the subtle error is that when those libraries (require 
math/flonum) it triggers a puzzling error inside of math/flonum.
2) With Mode Lambda, the subtle error is that all Mode Lambda programs, 
including the Mode Lambda examples, render just solid black.  

The idea that something that gets run in one tab will poison things I run 
in other tabs makes this bug uncharted territory (for me).  I've personally 
never seen that in DrRacket.  So I don't even have a clear hypothesis about 
what might be going wrong under the hood.  I also don't have any skills for 
debugging stuff that is going wrong under the hood in Racket.

To make matters MUCH worse, I only see the above phenomenon on certain 
Linux machines.  (But I have a few hundred of those machines -- so it's 
still very important for me to fix this issue).

Basically, I need the community's help here.  Has anyone seen a bug with a 
similar "feel"?  Has anyone seen this exact phenomenon?  Can someone tell 
me if I'm doing something obviously wrong with my FFI code?  Can someone 
tell me if there is something special I needed to have done when compiling 
the Chipmunk C libraries?  Can anyone give me a way to seek out more 
information to narrow down the issue?

I would genuinely appreciate any help. 

Thanks,
Stephen


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to