Re: gauche-c-wrapper's cwcompile stopped working: function is not found

Jens Thiele <[email protected]> Tue, 30 Apr 2024 09:27:20 +0200
Newsgroups gmane.lisp.scheme.gauche
Message-ID <[email protected]>
Jens Thiele <[email protected]> writes:

> Jens Thiele <[email protected]> writes:
>
>> will have to dig further
>
> i repeated the test in a debian/bookworm chroot using official gauche
> 0.9.15 and for me it still fails with:
>
> ERROR: function add is not found.

i think i found the problem

(bookworm-amd64-sbuild)karme@amalthea:/tmp$ cwcompile -v test-libhello.scm 
gauche-package compile --verbose --cflags=  --cppflags=   --ldflags=   --libs=  -L. -lhello  libgauche-hello libgauche-hello.stub
gcc -c    '-I/usr/local/lib/gauche-0.98/0.9.15/include'   -fPIC -o 'libgauche-hello.o' 'libgauche-hello.c'
gcc    '-L/usr/local/lib/gauche-0.98/0.9.15/x86_64-pc-linux-gnu' '-L/usr/local/lib/gauche-0.98/site/x86_64-pc-linux-gnu'  -shared -o libgauche-hello.so 'libgauche-hello.o' -lgauche-0.98 -lmbedtls -lcrypt -lrt -lm  -lpthread   -L. -lhello 

but:

(bookworm-amd64-sbuild)karme@amalthea:/tmp$ ldd ./libgauche-hello.so
        linux-vdso.so.1 (0x00007ffd9b3f9000)
        libgauche-0.98.so.0.15 => /usr/local/lib/libgauche-0.98.so.0.15 (0x00007f9f5a3a0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9f5a1bf000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f9f5a183000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9f5a0a4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9f5afb9000)

=> the dependency on libhello.so somehow got optimized away?

on the working system I have:

karme@jupiter:~/cwcompile$ LD_LIBRARY_PATH=. ldd ./libgauche-hello.so
        linux-vdso.so.1 (0x00007ffe90da6000)
        libgauche-0.9.so.0 => /usr/lib/libgauche-0.9.so.0 (0x00007efe7ccd7000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe7ccd2000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007efe7cc98000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efe7cc8e000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe7cb0b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe7caea000)
        libhello.so => ./libhello.so (0x00007efe7cae3000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe7c923000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efe7d2e5000)

jens