albert198511 发表于 2008-5-3 23:15:41

busybox的静态编译问题

busybox-1.9.2版本:

Build Options 中选择:
[*] Build BusyBox as a static binary (no shared libs)                              │ │
[ ] Build shared libbusybox                                                          │ │
[*] Build with Large File Support (for accessing files > 2 GB)   

执行make命令,出现如下错误:
# make
cat: /dev/null: 没有那个文件或目录
SPLIT   include/autoconf.h -> include/config/*
GEN   include/bbconfigopts.h
HOSTCCapplets/usage
GEN   include/usage_compressed.h
HOSTCCapplets/applet_tables
GEN   include/applet_tables.h
CC      applets/applets.o
applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables
applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections).
applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway.
applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections
applets/applets.c:20:2: warning: #warning from scripts/trylink and remove this warning.
applets/applets.c:21:2: #error Aborting compilation.
make: *** 错误 1
make: *** 错误 2

查看applets/applets.c文件:
# vi applets/applets.c
#include <assert.h>
#include "busybox.h"

/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
#warning Static linking against glibc produces buggy executables
#warning (glibc does not cope well with ld --gc-sections).
#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
#warning Note that glibc is unsuitable for static linking anyway.
#warning If you still want to do it, remove -Wl,--gc-sections
#warning from scripts/trylink and remove this warning.
#error Aborting compilation.
#endif

#if ENABLE_BUILD_LIBBUSYBOX
int main(int argc, char **argv)
{
    return lbb_main(argc, argv);
}
#endif
#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)-----这句在哪可以改设置?

谢谢!

[ 本帖最后由 albert198511 于 2008-5-4 08:41 编辑 ]

duzhig 发表于 2008-5-5 21:02:50

注释掉就可以了
页: [1]
查看完整版本: busybox的静态编译问题