2016-08-13 56 views
2

我需要编译和静态链接一个鸡程序。我期望使用很多扩展,最值得注意的是http-client如何静态链接使用扩展程序的Chicken计划程序?

我可以编译使用以下命令来源:

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的主要原因。

我在做什么错?

回答

1

假设你的程序是在-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

+0

嗯,这是很方便的知道...和技术上** **将上一个新的Linux上运行安装...但它不是我的问题的答案,这是“如何在一个可执行文件中获取所有内容?”运行'chicken-install'后,$ PWD中有一百九十个文件。也就是说,我觉得有点过分。 –

+0

我不是故意的,但问题是“我需要我的可执行文件在没有依赖的新安装的Linux系统上运行(...)我在做什么错误? ;)无论如何,有一种乏味的方式声称构建一个可以为你工作的自包含的可执行文件:http://www.foldling.org/scheme.html#compiling-statically-linked-chicken-scheme-programs-with -extensions - 注意-deploy已经在a-program中创建了.o文件/ - 但是这可能比仅仅csc -static a-program.o a-program/*。o -o aprog更难...祝你好运! – dercz

+0

ps也许你也可以尝试gambit-c,它为我工作,但我没有搞乱包比其他比匹配器和irregex ... – dercz

相关问题