2017-07-07 168 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庫。

相關問題