Having trouble to compile a 32 bits program on fedora 21(64bits)
I'm having an assembly course in my university. Our prof ask us the download some code from http://www.drpaulcarter.com/pcasm/index.php (example code for Linux, at the bottom of the page )
Since it's 32 bits program so i add -m32 after gcc and g++
but i still have trouble compiling the program. Can anyone pls help me ? thank you in advance
gcc -c driver.c
driver.c:3:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
int PRE_CDECL asm_main( void ) POST_CDECL;
^
nasm -f elf prime.asm
nasm -f elf -d ELF_TYPE asm_io.asm
gcc -oprime driver.o prime.o asm_io.o
/usr/bin/ld: i386 architecture of input file `prime.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `asm_io.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'prime' failed
make: *** [prime] Error 1
It has been a long time since I've dealt with this, but from what I remember it involves installing a bunch of compatibility library packages. If you don't get a good answer to this question, maybe consider alternatives? Virtual machines run so nice and smooth on Fedora these days, much smoother than gunking up your system with a bunch of rpms that may or may not do what you want.