我正在为Eclipse中的自动工具插件和我下载的一些C++项目而苦苦挣扎。
我的目标是为arm处理器进行交叉编译,因此该项目已经配置为使用自动工具,但当我尝试交叉编译时,我遇到了以下问题
In file included from /usr/include/c++/4.6/bits/stl_algo.h:61:0,
from /usr/include/c++/4.6/algorithm:63,
from dtntracepath.cpp:17:
/usr/include/c++/4.6/cstdlib:119:11: error: ‘::malloc’ has not been declared
我已经检查了我的项目的配置输出,注意到这个
...
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... no
checking for memset... yes
...
我知道如何通过添加选项通过linux终端修复它
export ac_cv_func_malloc_0_nonnull=yes
但不是通过Eclipse或autotools插件,因为项目的设置不可用。你能启发我吗?
问候,
提前感谢
PS:我在autotools插件中设置的参数如下:
-Command: configure CFLAGS="-m32" LDFLAGS="-m32" CC=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-gcc CC=c99
-All options : --host=arm-mv5sft-linux-gnueabi --build=i686-linux --target=arm-mv5sft-linux-gnueabi --with-sysroot=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/arm-mv5sft-linux-gnueabi/
编辑:
我已经尝试过ldav1s建议使用以下配置
configure CC=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-gcc CXX=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-g++ CFLAGS="-m32" LDFLAGS="-m32"
我收到这些错误
Command-line environment variables:
LDFLAGS="-m32" LDFLAGS="-m32" CC="/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-gcc" CXX="/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-g++"
sh -c /home/t/ibrdtn/ibrdtn-tools-0.8.0/configure ++ --host=arm-mv5sft-linux-gnueabi --with-sysroot=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/arm-mv5sft-linux-gnueabi/
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: ++
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-mv5sft-linux-gnueabi-strip... no
checking for arm-mv5sft-linux-gnueabi-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
Invalid configuration `++': machine `++' not recognized
configure: error: /bin/bash ./config.sub ++ failed
configure: error: /bin/bash ./config.sub ++ failed
checking build system type...
Configuration failed with error
编辑2在重新安装eclipse之后,第一版的++错误消失了,现在如果我使用以下配置
configure CC=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-gcc CXX=/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1/bin/arm-mv5sft-linux-gnueabi-g++ CFLAGS="-m32" LDFLAGS="-m32"--host=arm-mv5sft-linux-gnueabi --build=i686-linux --target=arm-mv5sft-linux-gnueabi
它编译得很好,我看到了一些arm/le输出,但我遇到了这个错误关于其中一个图书馆
make[3]: Entering directory `/home/t/ibrdtn/ibrcommon-0.8.0/ibrcommon/net'
CXX tcpclient.lo
CXX tcpserver.lo
CXX tcpstream.lo
CXX udpsocket.lo
CXX MulticastSocket.lo
CXX UnicastSocket.lo
CXX stopandwait.lo
CXX vsocket.lo
CXX vinterface.lo
CXX vaddress.lo
CXX LinkManager.lo
In file included from LinkManager.cpp:16:
../../ibrcommon/net/NetLinkManager.h:19:29: error: netlink/netlink.h: No such file or directory
../../ibrcommon/net/NetLinkManager.h:20:26: error: netlink/attr.h: No such file or directory
make[3]: *** [LinkManager.lo] Error 1
make[3]: Leaving directory `/home/t/ibrdtn/ibrcommon-0.8.0/ibrcommon/net'
make[2]: Leaving directory `/home/t/ibrdtn/ibrcommon-0.8.0/ibrcommon'
make[2]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/t/ibrdtn/ibrcommon-0.8.0/ibrcommon'
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
**** Build Finished ****
您还没有将C++编译器(CXX
)设置为configure
的参数的一部分,也没有对C编译器(CC
)进行乘法定义。
您似乎在为构建机器(/usr/include
中的编译器)而不是为交叉编译器(/home/t/s/arm-mv5sft-linux-gnueabi/SW3.2p1
中的编译器。