You are not logged in.

#1 2008-10-20 12:40:03

tgc
Member
From: DK
Registered: 2004-03-09
Posts: 96

Problems linking against lib32

Hi,

I'm trying to compile a program on arch64 which needs linking to some lib32 libs. (The program i VirtualBox - and no, I can't use the virtualbox_bin package from AUR because I'm hacking on the virtualbox source code).

It pretty much breaks down to the following:
I've installed lib32-gcc-archs, lib32-gcc-libs, and many others lib32 packages.
My testcode is:

#include <stdint.h>
int main(void)
{
  return 0;
}

And the command I use for compiling, and the resulting error is:

gcc -m32 -O -Wall -o .tmp_out test.c -L/opt/lib32/usr/lib/gcc/i686-pc-linux-gnu -L/opt/lib32/usr/lib/ -L/opt/lib32/lib/
/usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/usr/bin/ld: cannot find /lib/libc.so.6
collect2: ld returnerede afslutningskoden 1

It seems gcc has the path to libc.so.6 hardcoded, so it doesn't help to point to /opt/lib32/lib/ where the 32-bit version og libc.so.6 is. Any tips on how to make this work is most welcome!

Offline

#2 2008-10-20 18:48:50

ghostHack
Member
From: Bristol UK
Registered: 2008-02-29
Posts: 261

Re: Problems linking against lib32

64-bit Arch was never intended to be a multi-lib system so the gcc in [core] is not a cross-compiler.  The lib32 packages in [community] are a bit of a hack to let you run pre-compiled 32bit binaries on arch64, they simply take the library binaries from arch32 repos and copy them to /opt.  If you are compiling 32bit code I think you will need to do it in a chroot (link)

Offline

#3 2008-10-21 13:19:06

tgc
Member
From: DK
Registered: 2004-03-09
Posts: 96

Re: Problems linking against lib32

ghostHack wrote:

64-bit Arch was never intended to be a multi-lib system so the gcc in [core] is not a cross-compiler.  The lib32 packages in [community] are a bit of a hack to let you run pre-compiled 32bit binaries on arch64, they simply take the library binaries from arch32 repos and copy them to /opt.  If you are compiling 32bit code I think you will need to do it in a chroot (link)

Thanks for the answer! I'm afraid the chroot isn't an option when it comes to compiling VirtualBox for x86-64, so I guess I'll have to use 32-bit Arch for this.

Offline

Board footer

Powered by FluxBB