Can anyone help to shed the light on mysterious bug in SBCL (probably)?

Matthew Dillon dillon at
Tue Apr 15 18:15:17 PDT 2014

:I finally found the problem! This happens when the library is loaded TWICE
:(one time at compile time, one time in load time in IOLIB) and calls
:dlclose between two dlopens. Here is a minimal test case in lisp:
:(defpackage test
:  (:use :cl :cffi))
:(eval-when (:compile-toplevel :load-toplevel :execute)
:  (define-foreign-library libfixposix
:    (t (:default "libfixposix")))
:  (use-foreign-library libfixposix))

    I've looked at this some more.  I think the problem might be that
    the code is trying to load a *different* or
    than the one that is being loaded at load time.

    The dynamic loader seems to work properly in my tests when I load the
    same library as the one that was preloaded by the executable, but fails
    if I load one that the dynamic loader thinks is different.

    I don't think you can use 'find' for your test... some of those
    libraries (such as libthread_xu) have one-time inits that will
    interfere with each other.  You'll have to try to recreate the exact
    circumstances of what the program is doing.

    Use 'ldd' to figure out which library is being preloaded and compare
    against the libraries it is trying to load by hand.  The program really
    has no business whatsoever trying to load pthreads or libthread_xu by
    hand... it should be preloaded only.


More information about the Users mailing list