简体   繁体   English

在 64 位系统上使用 32 位共享库

[英]Using 32-bit shared libraries on 64-bit system

I have some libraries with 32-bit architecture which I want to use for compiling on my 64-bit architecture system.我有一些 32 位架构的库,我想用它们在我的 64 位架构系统上进行编译。 Despite that I installed the foreign architecture i386 and gcc-multilib, I still get error by compiling:尽管我安装了国外架构i386和gcc-multilib,但编译还是报错:

/usr/bin/ld: skipping incompatible ../rep/Fipe/libOTB.so when searching for -lOTB
/usr/bin/ld: cannot find -lOTB
/usr/bin/ld: cannot find -lglut
collect2: error: ld returned 1 exit status

The shared library has the following specifications:共享库具有以下规范:

ELF 32-bit LSB shared object, intel 80386, version 1 (SYSV), dynamically linked, with debug info, not striped

The answer is: you cannot .答案是:你不能

GCC-multilib is for cross-compiling: compiling a program for use on a different architecture than the one being used to compile. GCC-multilib 用于交叉编译:编译一个程序以在与用于编译的架构不同的架构上使用。

It does not do anything to allow you to execute code for a different architecture than the one you are using.它不会做任何事情来允许您为与您正在使用的架构不同的架构执行代码。

tl;dr : you cannot mix 32-bit and 64-bit code in the same process. tl;dr :您不能在同一进程中混合 32 位和 64 位代码。

Well, you can , but it is a nightmare to do so, and it is really fragile.嗯,你可以,但这样做是一场噩梦,而且它真的很脆弱。 Unless you have well-defined reasons for it, don't.除非你有明确的理由,否则不要这样做。 There should not be any 32-bit libraries that you cannot also get in 64-bit.不应该有任何 64 位也无法获得的 32 位库。 (Unless you are running really old, obsolete stuff, in which case you should be compiling a 32-bit program.) (除非您运行的是非常旧的、过时的东西,在这种情况下您应该编译一个 32 位程序。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM