I am creating packages of several Lisp interpreters and compilers, and one of them is Chicken Scheme (http://call-cc.org), which is already available from downloads.openwrt.org
via opkg
. Chicken comes with an interpreter (csi
) and a compiler (csc
).
However, I have only packaged the Chicken interpreter, but not the compiler. This is because the compiler, csc
, generates C
code, which then is then compiled using gcc
, and linked against a shared library, libchicken.so
. But this library is stripped during the package build process, and has no section headers. When csc
calls ld
through gcc
to link it, the symbols are not found.
# csc a.scm
(...) // several other undefined references here
a.c:(.text.f_130+0x74): undefined reference to `C_trace'
a.c:(.text.f_130+0xa0): undefined reference to `C_unbound_variable'
a.o: In function `main':
a.c:(.text.startup.main+0xc): undefined reference to `CHICKEN_main'
collect2: error: ld returned 1 exit status
Error: shell command terminated with non-zero exit status 256: 'mips-openwrt-linux-musl-gcc' 'a.o' -o 'a' -L/usr/lib -Wl,-R/usr/lib -lchicken -lm
# file /usr/lib/libchicken.so
/usr/lib/libchicken.so: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, no section header
Now, if I copy libchicken.so
from ~/openwrt-19.07/build_dir/target-mips_24kc_musl/chicken-5.2.0rc2/libchicken.so
(the non-stripped version) into the router, and put it in /usr/lib
, then csc
works perfectly.
# file /usr/lib/libchicken.so
/usr/lib/libchicken.so: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, with debug_info, not stripped
# csc a.scm
# ./a
x
(The program a.scm
only prints an "x" and exits -- it all worked fine)
Since the compiler (csc
) already depends on gcc
, I'm not that worried about size, so I thought it would be OK to not strip the shared library when building the package. But I could not find a way to do that.
Is there a way to tell the buildroot to not run strip.sh
on a specific file? (Or to override that file after strip
has run?)