Digger
Digger

Reputation: 23

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. Despite that I installed the foreign architecture i386 and gcc-multilib, I still get error by compiling:

/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

Upvotes: 1

Views: 1239

Answers (1)

Dúthomhas
Dúthomhas

Reputation: 10048

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.

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.

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. (Unless you are running really old, obsolete stuff, in which case you should be compiling a 32-bit program.)

Upvotes: 0

Related Questions