您的位置:首页 > 其它

configure: error: C compiler cannot create executables编译错误的解决办法的思路分析

2015-10-23 09:36 525 查看
编译错误:
zyx@zyx:/opt/EmbedSky/Qte$ sudo ./arm-qtopia-2.2.0-konqueror_build

[sudo] password for zyx:

the qpe program is already !

the konqueror directory is already !

Build konqueror , please wait ...

configure: WARNING: If you wanted to set the --build type, don't use --host.

    If a cross compiler is detected then cross compile mode will be used.

checking build system type... i686-pc-linux-gnu

checking host system type... arm-unknown-linux-gnu

checking target system type... arm-unknown-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking for -p flag to install... yes

checking whether build environment is sane... yes

checking for gawk... no

checking for mawk... mawk

checking whether make sets $(MAKE)... yes

checking for arm-linux-strip... arm-linux-strip

checking for style of include used by make... GNU

checking for arm-linux-gcc... arm-linux-gcc

checking for C compiler default output... configure: error: C compiler cannot create executables

See `config.log' for more details.

make: *** No targets specified and no makefile found.  Stop.
zyx@zyx:/opt/EmbedSky/Qte$

思路分析:

首先在网上查到一些解决办法:
zyx@zyx:~$ sudo apt-get install build-essential
zyx@zyx:~$ sudo apt-get install libc6-dev

但重新编译以后错误仍然存在,看来不行。

我看到了倒数第二句:"See `config.log' for more details."

使用locate命令确定config.log的位置,如下。
zyx@zyx:/$ locate config.log

/opt/EmbedSky/Qte/arm-qtopia-2.2.0/konqueror/config.log

/opt/EmbedSky/Qte/arm-qtopia-2.2.0/tslib-1.4.1/config.log

/opt/EmbedSky/Qte/arm-qtopia-2.2.0   z/konqueror/config.log

/opt/EmbedSky/Qte/arm-qtopia-2.2.0   z/tslib-1.4.1/config.log

/opt/EmbedSky/Qte/ncurses-5.6/config.log

/opt/EmbedSky/Qte/x86-qtopia-2.2.0/konqueror/config.log

/opt/EmbedSky/apps/boa-0.94.13/src/config.log

/opt/EmbedSky/apps/madplay/libid3tag-0.15.1b/config.log

/opt/EmbedSky/apps/madplay/libmad-0.15.1b/config.log

/opt/EmbedSky/apps/madplay/madplay-0.15.2b/config.log

/opt/EmbedSky/apps/sqlite-3.5.9/config.log

/opt/EmbedSky/apps/wget-1.10.2/config.log

/scim-googlepinyin/config.log

/var/log/fontconfig.log
zyx@zyx:/$

第一条便是config.log的目录。
zyx@zyx:/$ cd /opt/EmbedSky/Qte/arm-qtopia-2.2.0/konqueror/
zyx@zyx:/opt/EmbedSky/Qte/arm-qtopia-2.2.0/konqueror$ sudo gedit config.log

[sudo] password for zyx:

打开config.log后第71行~第73行:

configure:2516: checking for C compiler version

configure:2519: arm-linux-gcc --version </dev/null >&5

./configure: line 2520: arm-linux-gcc: command not found

可以发现,编译脚本并没有找到arm-linux-gcc的编译器,但是交叉编译器已经配置过了并已经生效,此时我想起了有时候编译器只有

在根用户下才可以被识别,所以切换到根用户下,再运行一次编译脚本就可以了。

解决办法:
zyx@zyx:/opt/EmbedSky/Qte$ su

Password:
root@zyx:/opt/EmbedSky/Qte# ./arm-qtopia-2.2.0-konqueror_build

Done!!! 一切OK!!!

___________________________________________________

ubuntu下的arm-linux-gcc,ubuntu的特色问题

折腾了一天,终于搞定了。

ubuntu没有root权限,刚开始用碰到很多麻烦,查了好多资料,终于把arm-linux-gcc: Command not found 的问题解决了。

问题:
sudo tar jxvf cross-2.95.3.tar.bz2

export PATH=$PATH:/usr/local/arm/2.95.3/bin

使用arm-linux-gcc –v 检查交叉编译器安装成功

tar jxvf kernel.tar.bz2

解压之后生成kernel目录

 

sudo make clean

sudo make menuconfig

sudo make zImage

 

提示错误:

arm-linux-gcc: Command not found

 

PATH里有/usr/local/arm/2.95.3/bin, /usr/local/arm/2.95.3/bin/下有arm-linux-gcc文件,但是make的时候,就是找不到arm-linux-gcc
 

原因:
export PATH=$PATH:/usr/local/arm/2.95.3/bin

是设置当前用户的PATH,而sudo执行make的时候,使用的是超级用户权限,那也就使用了超级用户的PATH(但是这个PATH里,并没有/usr/local/arm/3.4.1/bin)
 

解决方法:

先打开一个超级用户权限的shell:

sudo –s

在当前shell下,设置环境变量:

export PATH=$PATH:/usr/local/arm/2.95.3/bin

 

再进入到kernel目录,make
zImage,就可以找到arm-linux-gcc了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: