[racket-dev] Strange error with gui and ffi

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Thu Jan 19 09:40:07 EST 2012

Am 01/19/2012 02:02 PM, schrieb Matthew Flatt:
> At Thu, 19 Jan 2012 13:30:40 +0100, Tobias Hammer wrote:
>> i am getting a strange error message from racket if i use racket/gui in
>> the main module and only racket in a required one. If i load another
>> shared lib in the required module i get the following output:
>> jpeg: unsupported library version: "unknown"
> It does seem that loading libVLCore interferes with the use of libjpeg;
> if you use `racket/gui' in "guibug_req.rkt", that would avoid the
> problem by initializing the libjpeg use in `racket/draw' (via
> `racket/gui') before libVLCore is loaded.

Sure, that would be a possibility.

> Can you say more about the platform, libVLCore's linking, and the
> libjpeg that libVLCore uses?

Platform is Suse linux i386.
The jpeg lib is IJG (http://www.ijg.org) release 6b from 1998. So it's 
pretty old and may be incompatible to the current version. But i can't 
replace it because the readme says it may be modified.
The linking is this libjpeg as normal static lib (.a) and the libVLCore 
as regular shared lib that includes the static lib.

 > Even if libVLCore is statically linked to a libjpeg, I think it could
 > interact with dynamic loading of another libjpeg, depending on the
 > platform and linking options.

I digged a bit more and found the following line the rackets libffi:
handle = dlopen(name, RTLD_NOW | RTLD_GLOBAL);
If i interpret the manpages correct that means that all symbols from the 
lib are loaded and used to resolve references. That may be convenient 
for the libraries that the racket core uses but may lead strange 
behavior like the one i got whenever name clashes happen.

Maybe it would be a good idea to make this import all behavior optional.


Posted on the dev mailing list.