简体   繁体   中英

Using 32 bit .a library file in 64 bit linux machine

I am trying to use 32 bit .a files in a 64 bit machine. I compiled source code using gcc -m32 option. It gave following error

gcc -m32 *.c -Llib -lquanser_communications -Iinclude -o prg.o`In file included from /usr/include/wchar.h:27:0,
             from include/quanser_types.h:16,
             from include/quanser_communications.h:16,
             from include/quanser_stream.h:11,
             from stream_client.c:3:/usr/include/features.h:374:25: 

fatal error: sys/cdefs.h: No such file or directory

After searching I got to this and thread and installed libx32gcc-4.8-dev and libc6-dev-i386 packages.

After installing those packages and running compilation gives following error

gcc -m32 *.c -Llib -lquanser_communications -Iinclude -o prg.o
lib/libquanser_communications.a: file not recognized: File truncated

How could I fix this issue ? Thanks.

You're probably getting this error because your libquanser_communications is 64-bit and not 32-bit. You can't compile 32 bit against 64 bit code.

If you compiled libqunaser yourself, compile it with the -m32 flag (recursively, until you're done with all dependencies).

If not, get the 32 bit version of it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM