【已解决】Ubuntu中crosstool-ng编译出错:[ERROR] Missing: ‘i686-pc-linux-gnu-g++’ or ‘i686-pc-linux-gnu-g++’ or ‘g++’ : either needed!

【问题】

折腾:

【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc

期间,编译出错:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ct-ng menuconfig
  CONF  config/config.in
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20130807.234932
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[ERROR]  Missing: 'i686-pc-linux-gnu-g++' or 'i686-pc-linux-gnu-g++' or 'g++' : either needed!
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@331]
[ERROR]  >>        called from: CT_TestAndAbort[scripts/functions@351]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@449]
          

Current command (unknown), exited with error code: 1
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    3  abort build

ct-ng:~/develop/crosstool-ng/crosstool-ng-1.18.0_build> 

 

Missing i686-pc-linux-gnu-g   or i686-pc-linux-gnu-g   or g   either needed

 

【解决过程】

1.很明显,是缺少了g++。

2.参考:

Ubuntu10.10下利用crosstool-ng构建交叉编译链

去安装g++:

crifan@ubuntu:~/develop/crosstool-ng/src$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  g++-4.7 libstdc++6-4.7-dev
Suggested packages:
  g++-multilib g++-4.7-multilib gcc-4.7-doc libstdc++6-4.7-dbg
  libstdc++6-4.7-doc
The following NEW packages will be installed:
  g++ g++-4.7 libstdc++6-4.7-dev
0 upgraded, 3 newly installed, 0 to remove and 202 not upgraded.
Need to get 9,466 kB of archives.
After this operation, 26.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.163.com/ubuntu/ raring/main libstdc++6-4.7-dev i386 4.7.3-1ubuntu1 [1,705 kB]
Get:2 http://mirrors.163.com/ubuntu/ raring/main g++-4.7 i386 4.7.3-1ubuntu1 [7,760 kB]
Get:3 http://mirrors.163.com/ubuntu/ raring/main g++ i386 4:4.7.3-1ubuntu10 [1,456 B]                 
Fetched 9,466 kB in 34s (276 kB/s)                                                                    
Selecting previously unselected package libstdc++6-4.7-dev:i386.
(Reading database ... 157549 files and directories currently installed.)
Unpacking libstdc++6-4.7-dev:i386 (from .../libstdc++6-4.7-dev_4.7.3-1ubuntu1_i386.deb) ...
Selecting previously unselected package g++-4.7.
Unpacking g++-4.7 (from .../g++-4.7_4.7.3-1ubuntu1_i386.deb) ...
Selecting previously unselected package g++.
Unpacking g++ (from .../g++_4%3a4.7.3-1ubuntu10_i386.deb) ...
Processing triggers for man-db ...
Setting up libstdc++6-4.7-dev:i386 (4.7.3-1ubuntu1) ...
Setting up g++-4.7 (4.7.3-1ubuntu1) ...
Setting up g++ (4:4.7.3-1ubuntu10) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
crifan@ubuntu:~/develop/crosstool-ng/src$ 

3.再去继续编译,就可以了:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20130807.235739
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Installing user-supplied crosstool-NG configuration
[EXTRA]  =================================================================
[EXTRA]  Dumping internal crosstool-NG configuration
[EXTRA]    Building a toolchain for:
[EXTRA]      build  = i686-pc-linux-gnu
[EXTRA]      host   = i686-pc-linux-gnu
[EXTRA]      target = arm-xscale-linux-gnueabi
[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.09s (at 00:02)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Using 'linux-custom' from custom location
[INFO ]  Retrieving needed toolchain components' tarballs: done in 0.30s (at 00:02)
[INFO ]  =================================================================

 

【总结】

当出现:

[ERROR] Missing: ‘i686-pc-linux-gnu-g++’ or ‘i686-pc-linux-gnu-g++’ or ‘g++’ : either needed!

时,原因是:

缺少了g++ -> Ubuntu默认情况下,没有安装这些工具

解决办法是:

其实也是可以去安装那个build-essential的。但是此处还是简单点,去只安装g++即可:

sudo apt-get install g++


发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量