如何让 crosstool-ng C++ 编译器工作 [英] How to I get crosstool-ng C++ compiler working
问题描述
我正在尝试让 crosstool-ng 与 C 和 C++ 一起工作.尽管我在使用 menuconfig 时选择了 C++,但它似乎并没有被构建.gcc 编译器按预期工作,但不是 g++
I'm trying to get crosstool-ng working with both C and C++. Even though I've selected C++ while using menuconfig, it doesn't seem to get built. The gcc compiler works as expected but not g++
我不确定我做错了什么,所以任何帮助将不胜感激.
I'm not sure what I'm doing wrong so any help would be appreciated.
我按照此处找到的步骤操作:使用 Crosstool-NG 构建嵌入式 ARM 系统
I followed the steps found here: Building embedded ARM systems with Crosstool-NG
$ arm-unknown-linux-gnueabi-cpp main.cpp -o test
arm-unknown-linux-gnueabi-cpp: main.cpp: C++ compiler not installed on this system
注意:在 bin 目录中找不到 arm-unknown-linux-gnueabi-g++
.我试过跨工具版本 1.16.0 和 1.15.3
NOTE: there is no arm-unknown-linux-gnueabi-g++
found on in the bin directory.
I've tried cross-tool version 1.16.0 and 1.15.3
arm-unknown-linux-gnueabi-cpp -v
Using built-in specs.
Target: arm-unknown-linux-gnueabi
Configured with: /opt/crossArm/.build/src/gcc-4.3.2/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-unknown-linux-gnueabi --prefix=/opt/crossArm/.build/arm-unknown-linux-gnueabi/buildtools --with-local-prefix=/home/jgarvin/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --disable-libmudflap --with-sysroot=/home/jgarvin/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --enable-shared --with-pkgversion='crosstool-NG 1.16.0' --with-float=soft --enable-__cxa_atexit --with-gmp=/opt/crossArm/.build/arm-unknown-linux-gnueabi/buildtools --with-mpfr=/opt/crossArm/.build/arm-unknown-linux-gnueabi/buildtools --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-nls --disable-multilib --enable-languages=c
Thread model: posix
gcc version 4.3.2 (crosstool-NG 1.16.0)
代码
#include<iostream>
using namespace std;
int main(){
cout<<"Hello World"<<endl;
return 0;
}
在我的 build.log
文件中,我看到 C++ 选项已打开
In my build.log
file I see C++ option turned on
[DEBUG] CT_CC_SUPPORT_CXX=y
我也在 config.log
中看到它:
configure:3030: $? = 0
configure:3019: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
推荐答案
来自,http://briolidz.wordpress.com/2012/02/07/building-embedded-arm-systems-with-crosstool-ng/
通过运行 menuconfig 界面来完善您的配置:
Refine your configuration by running the menuconfig interface:
$ ./ct-ng menuconfig
$ ./ct-ng menuconfig
在此步骤中,导航到 C 编译器 菜单.然后你可以选择C++或取消选择Java、Fortran等.因为crosstool-ng只是一个一堆脚本和补丁文件,开发构建破坏东西是非常罕见的.您可以随时从 hg 存储库中提取.
In this step, navigate to the C Compiler menu. Then you can select C++ or de-select Java, Fortran, etc. Since crosstool-ng is just a bunch of scripts and patch files, it is very rare that a development build breaks things. You can always pull from the hg repository.
hg 克隆 http://crosstool-ng.org/hg/crosstool-ng一>
cd crosstool-ng
./引导
制作
sudo make install
hg clone http://crosstool-ng.org/hg/crosstool-ng
cd crosstool-ng
./bootstrap
make
sudo make install
这将有最新的修复.我已经多次使用这种方法构建了支持 C++ 的 arm 交叉编译器 [包括 加拿大交叉 for Mingw 和来自 x86_64 主机的 i386].
This will have the latest fixes. I have built arm cross compilers with C++ support many times using this method [including Canadian crosses for Mingw and i386 from an x86_64 host].
我看到 wordpress 链接建议在本地安装 ct-ng.上面的命令执行完整安装,将内容放在 /usr/local 中.此外,似乎 OP 确实尝试设置 menuconfig 的 C++ 选项.尝试更改 sjlj 值,使用最新版本的 ct-ng 并安装它.这为我在 Ubuntu 上生成了一个 ARM Linux C++ 交叉编译器.build.log 输出有助于确定 ct-ng 是否认为某些配置是不可能的.
I see that the wordpress link recommends a local install of ct-ng. The commands above do a full install, putting things in /usr/local. Also, it seems the OP did try to set menuconfig's C++ option. Try altering the sjlj value, use the latest version of ct-ng and install it. This produces an ARM Linux C++ cross-compiler on Ubuntu for me. The build.log output can be helpful in determining if ct-ng decided some configuration was impossible.
最后,邮件列表 crossgcc@sourceware.org 不需要订阅 afaik.http://sourceware.org/ml/crossgcc/ 上的档案可能会有所帮助.如果您仍有问题,我相信邮件列表中的某个人可以为您提供帮助.
Finally, the mailing list crossgcc@sourceware.org doesn't require subscription afaik. The archives at http://sourceware.org/ml/crossgcc/ can be helpful. If you still have issues, I am sure someone on the mailing list will be able to help you.
安装最新的 ct-ng 试试,
$ ct-ng arm-cortex_a15-linux-gnueabi #替代arm-yem-linux-gnueabi
$ ct-ng menuconfig # 调整您的处理器、gcc 版本等
$ ct-ng build # 去喝杯咖啡(或者干点别的).
$ ct-ng arm-cortex_a15-linux-gnueabi #Alternate arm-yem-linux-gnueabi
$ ct-ng menuconfig # Tweak for your processor, gcc version, etc.
$ ct-ng build # Go have a coffee (or work on something else).
抱歉,您的主机编译器是用 Linaro 制作的.我对你的编辑读得太多了.
Sorry, your host compiler was made with Linaro. I was reading too much into your edit.
这篇关于如何让 crosstool-ng C++ 编译器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!