簡體   English   中英

在64位linux armv8機器上編譯32位二進制文​​件時遇到問題

[英]Having trouble compiling 32-bit binary on 64-bit linux armv8 machine

我正在嘗試在Jetson Tx2(這是一台ARM 64位linux計算機)上使用c ++ ARM 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機器是否有同等的機器?

我查看了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編譯器來說,x86是CPU的一種。 您可以為此CPU類型創建16位,32位或64位代碼。

但是,對於GNU編譯器來說,32位ARM CPU和64位ARM CPU是兩種完全不同的CPU類型。

因此,使用64位ARM編譯器為32位ARM進行編譯與使用ARM編譯器為x86進行編譯相同:它將不起作用。

當然,將不接受32位庫。 ARM編譯器也不接受x86庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM