2017-07-07 332 views
0

我试图在Jetson Tx2上使用C++ ARM 32位库,这是一个ARM 64位Linux机器。当我尝试编译一些库提供我得到以下编译错误的示例代码:在64位linux armv8机器上编译32位二进制时遇到问题

/usr/bin/ld: skipping incompatible /home/nvidia/libroyale/bin/libroyale.so 
when searching for -lroyale 
/usr/bin/ld: cannot find -lroyale 
collect2: error: ld returned 1 exit status 
CMakeFiles/sampleCameraInfo.dir/build.make:94: recipe for target 
'sampleCameraInfo' failed 
make[2]: *** [sampleCameraInfo] Error 1 
CMakeFiles/Makefile2:67: recipe for target 
'CMakeFiles/sampleCameraInfo.dir/all' failed 
make[1]: *** [CMakeFiles/sampleCameraInfo.dir/all] Error 2 
Makefile:83: recipe for target 'all' failed 
make: *** [all] Error 2 

我认为这个错误是因为32位库与一个64位的机器不知何故不兼容。

我一直在浏览其他有关类似问题的StackOverflow论坛,根据这些论坛的建议,我在编译时向CXXFLAGS和LDFLAGS添加了-m32标志。然而,我则得到以下错误:

g++: error: unrecognized command line option ‘-m32’ 
CMakeFiles/sampleCameraInfo.dir/build.make:62: recipe for target 
'CMakeFiles/sampleCameraInfo.dir/sampleCameraInfo.cpp.o' failed 
make[2]: *** [CMakeFiles/sampleCameraInfo.dir/sampleCameraInfo.cpp.o] Error 1 
CMakeFiles/Makefile2:67: recipe for target 
'CMakeFiles/sampleCameraInfo.dir/all' failed 
make[1]: *** [CMakeFiles/sampleCameraInfo.dir/all] Error 2 
Makefile:83: recipe for target 'all' failed 
make: *** [all] Error 2 

一些其他StackOverflow的线程说,为了使用-m32标志,一个具有运行命令:

sudo apt-get install g++-multilib 

我不认为安装工作正常,因为我得到以下错误:

Some packages could not be installed. This may mean that you have 
requested an impossible situation or if you are using the unstable 
distribution that some required packages have not yet been created 
or been moved out of Incoming. 
The following information may help to resolve the situation: 

The following packages have unmet dependencies: 
g++-multilib:armhf : Depends: cpp:armhf (>= 4:5.3.1-1ubuntu1) but it is 
not going to be installed 
        Depends: gcc-multilib:armhf (>= 4:5.3.1-1ubuntu1) but it is not going to be installed 
        Depends: g++:armhf (>= 4:5.3.1-1ubuntu1) but it is not going to be installed 
        Depends: g++-5-multilib:armhf (>= 5.3.1-3~) but it is not going to be installed 
E: Unable to correct problems, you have held broken packages. 

任何建议将非常感激。谢谢!

更新:我意识到-m32标志只在x86 linux机器上受支持。有谁知道ARM机器是否有一些等价物?

回答

0

我看了一下GCC的文档,尤其是在以下网页:

https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html

https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/AArch64-Options.html

看起来像GNU编译器86是一个型号的CPU;您可以为此CPU类型创建16,32或64位代码。

但是它也看起来像GNU编译器32位ARM CPU和64位ARM CPU是两种完全不同的CPU类型。

因此,使用64位ARM编译器编译32位ARM与使用ARM编译器编译x86相同:它不起作用。

当然,32位库不会被接受; ARM编译器也不会接受x86库。

相关问题