views:

268

answers:

2

I've got a proprietary program that I'm trying to use on a 64 bit system.

When I launch the setup it works ok, but after it tries to update itself and compile some modules and it fails to load them.

I'm suspecting it's because it's using gcc and gcc tries to compile them for a 64 bit system and therefore this program cannot use these modules.

Is there any way (some environmental variables or something like that) to force gcc to do everything for a 32 bit platform. Would a 32 bit chroot work?

A: 

Yes, chroot will work. When you have 32-bit gcc installed in a 32-bit chroot, there is just no way it could compile 64-bit code instead.

gcc is compiled for each target platform distinctively; there is no way you could force the same gcc to generate code for another platform, through if you have gcc with 32-bit target somewhere you can add it in $PATH and it will work, too.

You can check which gcc you have with a -dumpmachine option.

$ /path/to/your/gcc -dumpmachine
i486-linux-gnu

The exact names may differ between distributions, but 64-bit version will surely include number "64" in it.

whitequark
+6  A: 

You need to make GCC use the -m32 flag.

You could try writing a simple shell script to your $PATH and call it gcc (make sure you don't overwrite the original gcc, and make sure the new script comes earlier in $PATH, and that it uses the full path to GCC.

I think the code you need is just something like /bin/gcc -m32 $* depending on your shell (the $* is there to include all arguments, although it might be something else – very important!)

Alan
You'll also need the 32bit C library, as well as 32 bit versions of whatever external libraries the program links against in some cases.
Tim Post