This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem compiling 32 bit application on 64 bit Linux server


Hi All,

I am trying to make an application on a 64-bit machine with -m32
option. but got error as follows. I had compile another code as 32 bit
on the same server but not sure why it's not working now!


CC FLAGS I have used are - /usr/bin/gcc -fpic -DNET_SSL -DLinux
-DLINUX -D_REENTRANT
LD FLAGS are - /usr/bin/gcc -shared -m32 --verbose

make prepare
make[1]: Entering directory `/tmp/test'
make[1]: Nothing to be done for `prepare'.
make[1]: Leaving directory `/tmp/test'
/usr/bin/gcc -shared -m32 --verbose test.o -o test.so
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux

Thread model: posix

gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m
elf_i386 --hash-style=gnu -shared -o test.so
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtbeginS.o
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib test.o -lgcc --as-needed -lgcc_s --no-as-needed -lc
-lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtendS.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib/crtn.o
/usr/bin/ld: warning: i386:x86-64 architecture of input file `test.o'
is incompatible with i386 output
test.o: In function `test':
test.c:(.text+0x17): undefined reference to `__nsapi30_table'
test.c:(.text+0x39): undefined reference to `__nsapi30_table'
test.c:(.text+0x8f): undefined reference to `__nsapi30_table'
test.c:(.text+0xb9): undefined reference to `__nsapi30_table'
test.c:(.text+0xd0): undefined reference to `__nsapi30_table'
test.o:test.c:(.text+0xff): more undefined references to
`__nsapi30_table' follow
collect2: ld returned 1 exit status
make: *** [test.so] Error 1

I have two dir under /usr/lib/gcc -

1) x86_64-redhat-linux
2) i386-redhat-linux

Please help me to compile 32 bit. If I remove -m32 gcc compiles with
64 bit without any problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]