我需要编译和静态链接鸡计划。我希望使用许多扩展程序,最值得注意的是http-client
。
我可以使用以下命令编译源代码:
csc -compile-syntax -static linux-setup.scm
或
csc -R http-client -compile-syntax -static linux-setup.scm
但是当我运行它时,我收到以下错误:
Error: (require) cannot load extension: http-client
Call history:
##sys#require <--
我也在源代码中尝试了(declare (uses http-client))
,但没有成功:
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
静态链接是我需要的。这不是XY问题。我需要我的可执行文件可以在没有依赖性的新安装的Linux系统上运行。这是我首先从Common Lisp切换到Scheme的主要原因。
我做错了什么,拜托?
答案 0 :(得分:1)
假设您的程序位于a-program.scm文件中:
csc -deploy a-program.scm
cd a-program/
chicken-install -deploy -p $PWD http-client
...etvoilà!
编辑证明,本文档解决了所发布问题的正确答案:http://www.foldling.org/scheme.html#compiling-statically-linked-chicken-scheme-programs-with-extensions