[嵌入式Linux] 有谁编过来uclibc 帮忙快来看下

6 views
Skip to first unread message

Adam Jiang

unread,
May 31, 2010, 3:28:19 AM5/31/10
to embedded-l...@googlegroups.com
FWD
----- Forwarded message from lei yang <yangle...@gmail.com> -----

Date: Mon, 31 May 2010 15:18:02 +0800
From: lei yang <yangle...@gmail.com>
To: linux-...@zh-kernel.org
Subject: 有谁编过来uclibc 帮忙快来看下

Hi

lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test$ make compile
TEST_LINK args/ arg_test
arg_test.c:9:19: error: stdio.h: No such file or directory
arg_test.c:10:20: error: stdlib.h: No such file or directory
arg_test.c:11:20: error: unistd.h: No such file or directory
arg_test.c: In function 'main':
arg_test.c:16: error: '__environ' undeclared (first use in this function)
arg_test.c:16: error: (Each undeclared identifier is reported only once
arg_test.c:16: error: for each function it appears in.)
arg_test.c:28: warning: incompatible implicit declaration of built-in
function 'printf'
arg_test.c:39: warning: incompatible implicit declaration of built-in
function 'exit'
make[1]: *** [arg_test] Error 1
make: *** [_dircompile_args] Error 2

我的系统上肯定有这些头文件,因为:
lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test/args$ gcc arg_test.c -o xx
lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test/args$ file xx
xx: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux
2.6.8, dynamically linked (uses shared libs), not stripped

有哪为仁兄,下载个uclibc试下看 谢谢先


--
"We learn from failure, not from success!"
_______________________________________________
Linux 内核开发中文邮件列表
Linux-...@zh-kernel.org
http://zh-kernel.org/mailman/listinfo/linux-kernel
Linux 内核开发中文社区: http://zh-kernel.org

----- End forwarded message -----

Adam Jiang

unread,
May 31, 2010, 10:14:10 AM5/31/10
to lei yang, linux-...@zh-kernel.org, embedded-linux-zh-CN
2010/5/31 lei yang <yangle...@gmail.com>:
>>
>> 将下面这个命令的结果贴上来
>>
>> # gcc -Wp,-v
>>
>>
> 仁兄 我之前给 ucl...@uclibc.org 发过信 没人理我,我自己也 export C_INCLUE_PATH 过,不管用
> 你要是有兴趣 你可以下个这个包试下嘿嘿
>

Hi,

uclibc我编译过不下50遍,你若是真的想解决问题,就应该把
INCLUDE PATH搞清楚。

# echo "int main() {}" > test.c
# gcc -Wp,-v test.c

把输出结果贴上了。

如果是在不行,你可以试试buildroot,但实际上没必要,
你的错误消息一看就知道是环境配置不正确。

/大头阿当
--
Adam Jiang
-----------------------------------
e-mail:jiang...@gmail.com
http://www.adamjiang.com
-----------------------------------

Adam Jiang

unread,
May 31, 2010, 10:26:54 PM5/31/10
to lei yang, linux-...@zh-kernel.org, embedded-linux-zh-CN
2010/5/31 lei yang <yangle...@gmail.com>:

>> Hi,
>>
>> uclibc我编译过不下50遍,你若是真的想解决问题,就应该把
>> INCLUDE PATH搞清楚。
>>
>> # echo "int main() {}" > test.c
>> # gcc -Wp,-v test.c
>>
>
>
> 谢谢仁兄的耐心。
>
> lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test/args$ gcc -Wp,-v arg_test.c
> ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
> ignoring nonexistent directory
> "/usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../i486-linux-gnu/include"
> ignoring nonexistent directory "/usr/include/i486-linux-gnu"
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/local/include
> /usr/lib/gcc/i486-linux-gnu/4.2.3/include
> /usr/include
> End of search list.
>
>
> lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test/args$ ls /usr/include

从这个结果来看,至少可以肯定你机器上的某一个gcc是没有问题的,应该是host的toolchain.
你在配置uclibc的时候有没有开启交叉编译选项?编译用的命令是

# make

还是

# make CROSS=xxx-linux-

如果你使用的是交叉编译方式的,用同样的参数确认一下gcc的include path.
如果你搞不清楚究竟用的哪个,可以用下面的命令看看到底在哪里出错了

# make UCLIBC_EXTRA_CFLAGS="-Wp,-v"

lei yang

unread,
Jun 1, 2010, 5:21:08 AM6/1/10
to Adam Jiang, linux-...@zh-kernel.org, embedded-linux-zh-CN

我试了好几台 机器都是这个效果 ubuntu redhat 上都试了,注意我是在test那个目录下make的

Lei




2010/6/1 lei yang <yangle...@gmail.com>
我目前还没有使用交叉编译,以后要用,先尝试的非交叉编译

lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test$ make UCLIBC_EXTRA_CFLAGS="-Wp,-v"

  TEST_LINK args/ arg_test
arg_test.c:9:19: error: stdio.h: No such file or directory
arg_test.c:10:20: error: stdlib.h: No such file or directory
arg_test.c:11:20: error: unistd.h: No such file or directory
arg_test.c: In function 'main':
arg_test.c:16: error: '__environ' undeclared (first use in this function)
arg_test.c:16: error: (Each undeclared identifier is reported only once
arg_test.c:16: error: for each function it appears in.)
arg_test.c:28: warning: incompatible implicit declaration of built-in function 'printf'
arg_test.c:39: warning: incompatible implicit declaration of built-in function 'exit'
make[1]: *** [arg_test] Error 1
make: *** [_dirrun_args] Error 2



Thanks
Lei




2010/6/1 Adam Jiang <jiang...@gmail.com>
--
"We learn from failure, not from success!"

lei yang

unread,
Jun 1, 2010, 5:18:42 AM6/1/10
to Adam Jiang, linux-...@zh-kernel.org, embedded-linux-zh-CN
我目前还没有使用交叉编译,以后要用,先尝试的非交叉编译

lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test$ make UCLIBC_EXTRA_CFLAGS="-Wp,-v"
  TEST_LINK args/ arg_test
arg_test.c:9:19: error: stdio.h: No such file or directory
arg_test.c:10:20: error: stdlib.h: No such file or directory
arg_test.c:11:20: error: unistd.h: No such file or directory
arg_test.c: In function 'main':
arg_test.c:16: error: '__environ' undeclared (first use in this function)
arg_test.c:16: error: (Each undeclared identifier is reported only once
arg_test.c:16: error: for each function it appears in.)
arg_test.c:28: warning: incompatible implicit declaration of built-in function 'printf'
arg_test.c:39: warning: incompatible implicit declaration of built-in function 'exit'
make[1]: *** [arg_test] Error 1
make: *** [_dirrun_args] Error 2



Thanks
Lei




2010/6/1 Adam Jiang <jiang...@gmail.com>
2010/5/31 lei yang <yangle...@gmail.com>:

Adam Jiang

unread,
Jun 1, 2010, 10:03:25 AM6/1/10
to linux-...@zh-kernel.org, embedded-l...@googlegroups.com
On Tue, Jun 01, 2010 at 06:22:11PM +0800, fran...@greenpacket.com wrote:

> On Tue, Jun 01, 2010 at 05:18:42PM +0800, lei yang wrote:
> > 我目前还没有使用交叉编译,以后要用,先尝试的非交叉编译
> >
> > lyang0@lyang0:~/downloads/uClibc-0.9.30.3/test$ make
> > UCLIBC_EXTRA_CFLAGS="-Wp,-v"
> > TEST_LINK args/ arg_test
> > arg_test.c:9:19: error: stdio.h: No such file or directory
> > arg_test.c:10:20: error: stdlib.h: No such file or directory
> > arg_test.c:11:20: error: unistd.h: No such file or directory
> > arg_test.c: In function 'main':
> > arg_test.c:16: error: '__environ' undeclared (first use in this function)
> > arg_test.c:16: error: (Each undeclared identifier is reported only once
> > arg_test.c:16: error: for each function it appears in.)
> > arg_test.c:28: warning: incompatible implicit declaration of built-in
> > function 'printf'
> > arg_test.c:39: warning: incompatible implicit declaration of built-in
> > function 'exit'
> > make[1]: *** [arg_test] Error 1
> > make: *** [_dirrun_args] Error 2
> >
>
> /tmp/uClibc-0.9.30.1/test $ make -n | head

兄弟你太强大了!为什吗不直接在topdir做

make test

而要直接跑到test里面去make?

/大头阿当

> make -C args run
> echo " "TEST_LINK args/ arg_test
> gcc -Wstrict-prototypes -Os -funit-at-a-time -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -Os -D_GNU_SOURCE -I../../test -nostdinc -I../../install_dir/usr/include -I/usr/lib/gcc/i686-pc-linux-gnu/4.4.2//include-fixed -I/usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include -c arg_test.c -o arg_test.o
> gcc -s -static -B../../lib -Wl,-rpath,../../lib -Wl,-rpath-link,../../lib arg_test.o -o arg_test
> echo " "TEST_LINK args/ arg_test_glibc
> gcc -Wstrict-prototypes -Os -funit-at-a-time -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -Os -D_GNU_SOURCE -I../../test -c arg_test.c -o arg_test_glibc.o
> gcc -s -static arg_test_glibc.o -o arg_test_glibc
> echo " "TEST_EXEC args/ arg_test
> env -i ENVVAR=123 SOMETHING=sldajfasdf BLAHBLAH=" hi hi " ./arg_test a b c d e f g h > "arg_test.out" 2>&1 ; ret=$? ; expected_ret="" ; test -z "$expected_ret" && export expected_ret=0 ; if ! test $ret -eq $expected_ret ; then echo "ret == $ret ; expected_ret == $expected_ret" ; exit 1 ; fi
> true "arg_test.out"
> make: *** [_dirrun_args] 断开的管道
>
>
>
>
> 注意看 -I 以及 -nostdinc

Adam Jiang

unread,
Jun 1, 2010, 11:38:43 PM6/1/10
to lei yang, linux-...@zh-kernel.org, embedded-l...@googlegroups.com
On Wed, Jun 02, 2010 at 11:34:58AM +0800, lei yang wrote:
> 你编了50编, 你有一编把make test 编过没?
>

说老实话,make test没做过几遍,但有编译通过的时候,需要修改工具连和
uclibc的测试代码。除非你确认问题是工具链带来的,那么必须调整工具链,如果
是测试代码本身,我一般选择睁一只眼闭一只眼。

/Adam

> Lei
>
>
> 2010/6/2 Adam Jiang <jiang...@gmail.com>


>
> > On Wed, Jun 02, 2010 at 09:44:24AM +0800, fran...@greenpacket.com wrote:
> > > > > /tmp/uClibc-0.9.30.1/test $ make -n | head
> > > >
> > > > 兄弟你太强大了!为什吗不直接在topdir做
> > > >
> > > > make test
> > > >
> > > > 而要直接跑到test里面去make?
> > > >
> > >

> > > 你是要说 make -C test 吧?其实没什么区别。
> >
> > ......抱歉,这个讨论我不能再跟下去了,两位似乎根本不知道自己在干啥。
> >
> > make test
> >
> > 没有-C,自己less topdir/Makefile看看吧。test/Makefile里面没有include顶层
> > 目录中的makefile.in,缺少环境设置,这是你们都出错的原因。不要直接跑到
> > test下面去make,而要在顶层目录make test做对于uclibc的测试。
> >
> > 看uclibc的指南,google一下找找编译的步骤,稍微用心点就不会犯这样的低级错
> > 误。而这个错误竟然被挂在这里好几天,我是服了。
> >
> > /大头阿当


> >
> > _______________________________________________
> > Linux 内核开发中文邮件列表
> > Linux-...@zh-kernel.org
> > http://zh-kernel.org/mailman/listinfo/linux-kernel
> > Linux 内核开发中文社区: http://zh-kernel.org
> >
>
>
>

Reply all
Reply to author
Forward
0 new messages