[Ecls-list] Two-level dependency "segmentation violation" - problem found, where/how to fix?

William Robinson airbaggins at gmail.com
Sun Jan 27 16:27:17 UTC 2008

William Robinson wrote:
> Hi,
> I have run into a problem, while trying to create a .fas out of an 
> ASDF system with a dependency. I've attached some super-simple code to 
> hopefully demonstrate this. I have a "program.lisp" loading a 
> "helper.fas", which is built from an ASDF package, which, in turn, 
> depends on "library.asd". The build process appears to statically link 
> "library" when it builds "helper.fas", but when I try to load the .fas 
> (from either a REPL or program.lisp), there is a "Segmentation 
> violation".
Hi again, I've been digging deeper into this and have found that the 
problem is here:
> ;;; Note: Invoking external command:
> ;;; gcc -o 
> "/home/bill/programming/test-lisp/ecl-two-level-deps/helper.fas" 
> -L"/usr/local/lib/" 
> "/home/bill/programming/test-lisp/ecl-two-level-deps/ECLINITxJowE3.o" 
> "/home/bill/programming/test-lisp/ecl-two-level-deps/liblibrary.a" 
> "/home/bill/programming/test-lisp/ecl-two-level-deps/helper.o"  
> -Wl,--rpath,/usr/local/lib/ -shared    -lecl -lpthread -ldl  -lm   -lgmp

When the liblibrary.a is included, it throws away the unused symbols, as 
the crash is because it cannot find init_lib_LIBRARY in the dynamic table.

However, if you put the linker flags (for GCC anyway) --whole-archive 
before the mention of liblibrary.a (and --no-whole-archive after, as you 
get an ungodly mess of multiply defined symbols), the resulting .fas is 
then loadable, and it runs correctly.

I am digging around in the asdf and cmp packages code now to find a 
suitable place to drop this in, if it's even possible.


More information about the ecl-devel mailing list