如何静态地 link 一个使用扩展的 Chicken Scheme 程序?
How to statically link a Chicken Scheme program that uses extensions?
我需要编译并静态link一个小鸡程序。我希望使用许多扩展名,最值得注意的是 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
静态 linking 是我 需要 的东西。这不是 XY 问题。我 需要 我的可执行文件 运行 在没有依赖项的新安装 Linux 系统上。这是我最初从 Common Lisp 切换到 Scheme 的主要原因。
请问我做错了什么?
假设您的程序在-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
我需要编译并静态link一个小鸡程序。我希望使用许多扩展名,最值得注意的是 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
静态 linking 是我 需要 的东西。这不是 XY 问题。我 需要 我的可执行文件 运行 在没有依赖项的新安装 Linux 系统上。这是我最初从 Common Lisp 切换到 Scheme 的主要原因。
请问我做错了什么?
假设您的程序在-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