Ok, finally I found the solution. First I compiled the .c files into .o objects and then I needed to run gcc to link in this way: gcc -o prog -m32 -march=i386 -L/usr/lib -L/lib $obj -lreadline -lncurses with obj=`ls *.o` I don't know why I need two steps because I couldn't do this in one single step (it seems like if gcc doesn't bypass the proper flags/options to ld to compile agains the 32 bit libraries) HTH to another one, Cheers On 12/6/06, Fernando Apesteguía <fernando.apesteguia@xxxxxxxxx> wrote:
On 11/28/06, Steven W. Orr <steveo@xxxxxxxxxxx> wrote: > On Tuesday, Nov 28th 2006 at 18:50 +0100, quoth Fernando Apesteguía: > > =>Helo list, > => > =>I'm using FC6 for x86_64. I need to compile a program for linux 32 > =>bits. I tried with the -m32 flag to gcc, but I got: > => > =>core_recv.c:(.text+0x130): undefined reference to `__umoddi3' > => > =>and tons of ld warnings: > => > =>/usr/bin/ld: warning: i386 architecture of input file `main.o' is > =>incompatible with i386:x86-64 output > => > =>I searched in Google, but couldn't find the solution. For the > =>undefinded references I suppose it is because some missing i386 > =>libraries right? > => > =>And what about the other things? How can I compile a 32 bit > =>application under a 64 bit system? > > Sorry, but you need to create a seperate cross compiler. You're running on > a your native system and you're trying to create an executable for another > machine. So you need a whole different toolchain. The easiest way *might* > be to use buildroot (just google it please) but the point is that you need > a whole different setup to target a different machine. gcc, binutils, > libc, gdb, the whole banana, and the whole thing has to be specific to the > version of the kernel you're running on the target system. Just don't even > *try* to figgah out options for your current system. It won't work. > > -- > fedora-list mailing list > fedora-list@xxxxxxxxxx > To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list > > Hi again, Yes, the question is that I could make a chroot, but I would prefer not to do it for several reasons (hard disk space is one of them). The compiler does his work, the .o are all: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped but then, the ld doesn't manage the situation. The supported emulations are elf_x86_64 elf_i386 i386linux I tried with the last two and it didn't work... The program uses the common standard functions like printf and strcpy and some other features of libreadline. I have both i386 and x86_64 (and again both, binaries and devel packages) installed in my system. Any more clues? Thanks in advance