3

I have need to compile and statically link a Chicken program. I expect to use many extensions, most notably http-client.

I can compile the source with the following command:

csc -compile-syntax -static linux-setup.scm

or

csc -R http-client -compile-syntax -static linux-setup.scm

But when I run it, I get the following error:

Error: (require) cannot load extension: http-client

    Call history:

    ##sys#require           <--

I have also tried (declare (uses http-client)) in the source, with no success:

linux-setup.o: In function `f_369':
/mnt/data/Documents/Programming/chicken-scheme/linux-setup/linux-setup.c:219:
 undefined reference to `C_http_2dclient_toplevel'
collect2: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: 'gcc' 'linux-setup.o'
 -o 'linux-setup' -L"/usr/lib"  -Wl,-R"/usr/lib" -static '/usr/lib/libchicken.a' -lm -ldl

Static linking is something I need. This is not an XY problem. I need my executables to run on a freshly-installed Linux system with no dependancies. This is the primary reason I switched from Common Lisp to Scheme in the first place.

What am I doing wrong, please?

4

1 回答 1

1

假设您的程序在 a-program.scm 文件中:

csc -deploy a-program.scm
cd a-program/
chicken-install -deploy -p $PWD http-client

......等等瞧!

编辑:事实证明,在本文档中解决了发布的问题的正确答案:http ://www.foldling.org/scheme.html#compiling-statically-linked-chicken-scheme-programs-with-extensions

于 2016-08-13T02:09:26.700 回答