Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

file format not recognized; treating as linker script

Tags:

c

gcc

gnu

i'm new on gcc compiler.

My friend wrote this script (graphic filter) for me but i can't use it because i receive some error.

I have 2 directory and a C file:

-dir- include --> basics.h common.h freeimage.h hqx.h imageIO.h pcxIO.h    
-dir- lib --> libfreeimage-3.13.1.so libfreeimage.a libfreeimage.so.3 libhqx.a libhqx.so libhqx.so.1 libhqx.so.1.0.0  
scaling.c

i try to compile with this command:

gcc scaling.c -I./include -L./lib -lm -lfreeimage -lhqx -lstdc++ -o filter

But i receive this error:

/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld:./lib/libhqx.so: file format not recognized; treating as linker script
/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld:./lib/libhqx.so:1: syntax error
collect2: ld returned 1 exit status

Thanks in advance and sorry for my english.

like image 972
MarcoD Avatar asked Dec 28 '22 22:12

MarcoD


2 Answers

The linker will treat any file that doesn't look like an object file or library as a linker script containing commands to specify how linking should be done. Things like load addresses, section definitions, etc.

Apparently libhqx.so doesn't look like a shared library on you system. I assume it was built on your friend's system?

To get a clue about what the file is, use the file command. You should get something like:

main% file /lib/libc-2.11.2.so 
/lib/libc-2.11.2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

If not, you'll have to build or find a library compatible with your system.

like image 151
Richard Pennington Avatar answered Jan 31 '23 09:01

Richard Pennington


I had a similar problem yesterday, and I think your libhqx.so was a symbolic link to libhqx.so.1.0.0 or to libhqx.so.1 in your friend's machine, and when you copied this files, this link had broken. (at least that was the situation in our system, and the problem solved after we remove the .so file, and create the right symbolic link)

like image 34
gincsait Avatar answered Jan 31 '23 08:01

gincsait