Re: [SLUG] gcc, 32-bit code, 64-bit Linux

From: Eben King (eben01@verizon.net)
Date: Mon Dec 21 2009 - 21:01:27 EST


On Mon, 21 Dec 2009, Jason Copenhaver wrote:

> On Sun, Dec 20, 2009 at 6:59 PM, Eben King <eben01@verizon.net> wrote:
>
>> I'm trying to get gcc to compile a library into 32-bit code (specifically,
>> libv4lconvert from the latest gspca) on a 64-bit Linux. I run the command:
>>
>> make PREFIX=/usr CFLAGS=-m32 LDFLAGS=-melf_i386
>>
>> (apparently ld has disallowed the -m32 option)
>>
>> and after a few successful compiles it tells me
>>
>> ld: Relocatable linking with relocations from format elf64-x86-64
>> (/usr/src/libv4l-2009-12-20/v4l/.tmp_tuner-xc2028.o) to format elf32-i386
>> (/usr/src/libv4l-2009-12-20/v4l/tuner-xc2028.o) is not supported
>>
>> and then backs its way out of the directory tree.

> set LDEMULATION=elf_i386 on your command line also.

Nope:

,--
| eben@pc:~$ cd /usr/src/libv4l-2009-12-20/
| eben@pc:/usr/src/libv4l-2009-12-20$ make clean
... (no errors)
| eben@pc:/usr/src/libv4l-2009-12-20$ make PREFIX=/usr CFLAGS=-m32 LDFLAGS=-melf_i386 LDEMULATION=elf_i386
...
| make[2]: Entering directory `/usr/src/linux-2.6.26.5'
| CC [M] /usr/src/libv4l-2009-12-20/v4l/tuner-xc2028.o
| ld: Relocatable linking with relocations from format elf64-x86-64
| (/usr/src/libv4l-2009-12-20/v4l/.tmp_tuner-xc2028.o) to format elf32-i386
| (/usr/src/libv4l-2009-12-20/v4l/tuner-xc2028.o) is not supported
'--

/me beats his head against the keyboard

and suddenly has an idea, stops, and tries a small variation -- removing
LDFLAGS entirely, since in that case LD defaults to using an environment
variable which I thought called EMULATION. <checks man page> Nope, I
misremembered.

On desktop (Ubuntu 6.xx LTS) in gspca*/v4l2-apps, libv4l*,
libv4l*/v4l2-apps/ and on the laptop (Ubuntu 8.04 LTS) in the same places, I
get:

,--
| /usr/bin/ld: i386 architecture of input file `helper.o' is incompatible with i386:x86-64 output
'--

for a bunch of files. Sigh. Maybe cc's getting the message, but not ld?

Just for kicks, I added CPPFLAGS=-m32 CXXFLAGS=-m32 and got it down to two
errors:

,--
| make[1]: Entering directory `/usr/src/libv4l-2009-12-20/v4l2-apps/libv4l2util'
| CC frequencies.o
| CC v4l2_driver.o
| LD libv4l2util.so
| /usr/bin/ld: i386 architecture of input file `frequencies.o' is incompatible with i386:x86-64 output
| /usr/bin/ld: i386 architecture of input file `v4l2_driver.o' is incompatible with i386:x86-64 output
| collect2: ld returned 1 exit status
'--

Closer, but still no cigar.

-- 
-eben   QebWenE01R@vTerYizUonI.nOetP   http://royalty.mine.nu:81

"You're one of those condescending Unix computer users!" "Here's a nickel, kid. Get yourself a better computer" - Dilbert ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 14:20:24 EDT