Thanks Kai, It works now. I found I have only gcc-4.4 multilibs so I force the CC command to use gcc-4.4. Alireza Haghdoost On Fri, Feb 11, 2011 at 10:22, Kai Ruottu <kai.ruottu@xxxxxxxxxxx> wrote: > 11.2.2011 6:49, Alireza Haghdoost kirjoitti: >> >> Hello >> >> I am trying to make an application on a 64-bit machine with -m32 >> option. I have add "-m32" in CFLAGS and >> "-L/usr/lib/gcc/x86_64-linux-gnu/4.4/32 -m32 -L/usr/lib32" in LDFLAGS. >> However I have got the following error : >> >> /usr/bin/ld: i386:x86-64 architecture of input file >> `/usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtbegin.o' is incompatible with >> i386 output >> /usr/bin/ld: i386:x86-64 architecture of input file >> `/usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtend.o' is incompatible with >> i386 output > > These 'crt*' files are the default 64-bit x86_64 objects, the > '/usr/lib/gcc/x86_64-linux-gnu/4.1.3/32' should have the 32-bit > x86 equivalents. >> >> I have 32-bit version of crtbegin.o and crtend.o in >> /usr/lib/gcc/x86_64-linux-gnu/4.4/32/ However gcc try to use 64-bit >> version from /usr/lib/gcc/x86_64-linux-gnu/4.1.3/. > > The '-verbose' option for the linker would be nice in a case > like this... One gives it with the '-Wl,<linker-option>', here > '-Wl,-verbose' on the 'cc' command line. In any case it can be > that the '-L' options will only add directories AFTER the normal > ones, not BEFORE them! The GCC manual doesn't tell the order : > > -Ldir > ÂAdd directory dir to the list of directories to be searched for â-lâ. > >> Does any one know how I can force gcc to use object files in >> /usr/lib/gcc/x86_64-linux-gnu/4.4/32/ ? > > Why the '/usr/lib/gcc/x86_64-linux-gnu/4.1.3/32' doesn't have > the 32-bit 'crtbegin.o' and 'crtend.o' ? ÂMixing the 4.4 ones > isn't sane at all! > > Maybe you haven't added support for 32-bit linking into your > gcc-4.1.3 toolchain at all via installing the 'glibc-32bit-dev*' > or something packages? >