[Openmcl-devel] Why canot CCL load libSDL* ?

Gary Byers gb at clozure.com
Tue May 22 19:38:16 PDT 2012

The function CCL:OPEN-SHARED-LIBRARY essentially just passes its
argument to a foreign function (#_dlopen on Unix-based systems) and
returns something based on what that function returns or signals an
error.  The lisp package involved in your game uses code in the CFFI
package to call CCL:OPEN-SHARED-LIBRARY for you; it apparently tries
to look for "libSDL.so" under that name and a few version-specific 
variants; it tells you that none of those attempts was succesful but
doesn't tell you what problems were encountered.


? (CCL:OPEN-SHARED-LIBRARY "/usr/local/lib/libSDL.so")

directly would likely tell you something about what the problem is.

If that fails (signals an error), the error message may explain why.  (The
error message is just what #_dlopen returns - or, more accurately, what #_dlopen
causes a function named #_dlerror to return; if the error message seems a bit
cryptic, there isn't much that CCL can do to make it more intelligible for you.)

Since the file exists, some likely reasons for failure include:
   - the library was compiled for the wrong architecture (64-bit vs 32-bit, etc.)
   - some library that libSDL.so depends on wasn't found, or some symbol that
     was referenced by some library wasn't defined by any library because of
     versioning or installation issues.

If calling OPEN-SHARED-LIBRARY with a fully-qualified path name succeeds (returns
an object of type CCL::SHLIB), then the question becomes "why doesn't _#dlopen
find a library that's installed in /usr/local/lib when it's referenced by an
unqualified name like 'libSDL.so' ?"  The answer to that can be complicated,
but may involve running a utility ("/sbin/ldconfig") to update a systemwide
cache when a shared library is installed.  If libSDL.so is installed by the
FreeBSD ports system, the necessary steps to make it visible are done for you.

$ /sbin/ldconfig -r

on FreeBSD will show the cache (FreeBSD calls it "the hints file" that ldconfig
maintains), and seeing how unqualified library names map to fully qualified
filenames may be helpful.

None of this has much to do with CCL.  I can understand not wanting to know
everything there is to know about how shared libraries are implemented, but
if you don't understand anything at all you'll find yourself thinking that
it does have something to do with CCL and that won't get you very far.

On Tue, 22 May 2012, z_axis wrote:

> When i quickload a game from https://github.com/sykopomp/common-worm, CCL 
> reports:
>> Error: Unable to load any of the alternatives:
>>          ("libSDL-1.2.so.0.7.2" "libSDL-1.2.so.0" "libSDL-1.2.so" 
>> "libSDL.so" "libSDL")
>> While executing: CFFI::FL-ERROR, in process listener(1).
> But:
>> ls -l /usr/local/lib/libSDL*
> lrwxr-xr-x  1 root  wheel      16>ls -l /usr/local/lib/libSDL*
> lrwxr-xr-x  1 root  wheel      16 12  3 09:23 /usr/local/lib/libSDL-1.2.so@ 
> -> libSDL-1.2.so.11
> -rwxr-xr-x  1 root  wheel  452662 12  3 09:23 
> /usr/local/lib/libSDL-1.2.so.11*
> -rw-r--r--  1 root  wheel  559164 12  3 09:23 /usr/local/lib/libSDL.a
> -rwxr-xr-x  1 root  wheel    1170 12  3 09:23 /usr/local/lib/libSDL.la*
> lrwxr-xr-x  1 root  wheel      16 12  3 09:23 /usr/local/lib/libSDL.so@ -> 
> libSDL-1.2.so.11
> -rw-r--r--  1 root  wheel     872 12  3 09:23 /usr/local/lib/libSDLmain.a
>> uname -a
> FreeBSD mybsd.zsoft.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 
> 07:15:25 UTC 2012 
> root at obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
> Sincerely!
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list