Unix Programming - Problem while linking .a file

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2006 > Problem while linking .a file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Problem while linking .a file
Nithya

2006-03-03, 6:43 pm

Hi,
I encountered a problem when compiling multiple files with make file on
solaris. The program uses a thrid party library file(.a) and when
linking it to the program with -l option i get a error stating:

ld: elf error: file library.a(lib_obj.o): elf_strptr: Request error: no
string table
ld: elf error: file library.a: elf_begin: Format error: archive fmag
ld: fatal: File processing errors. No output written to Main
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `Main'

As this error states there is no string table associated with one of
the .o file archived to the library. I confirmed it by using nm
utility. It listed the string tables associated with many other .o
files but failed only one. Is there any way that i can generate the
string table by just having this archive?

And i have no idea what Format error is supposed to mean.... could
someone please throw some light on this?

Thanks a lot....

Paul Pluzhnikov

2006-03-03, 6:43 pm

"Nithya" <nithya4u@gmail.com> writes:

> I encountered a problem when compiling ...


No, you didn't. You encountered a problem *linking* ...

> The program uses a thrid party library file(.a) and when
> linking it to the program with -l option i get a error stating:
>
> ld: elf error: file library.a(lib_obj.o): elf_strptr: Request error: no string table

....
> As this error states there is no string table associated with one of
> the .o file archived to the library.


You should contact the third party and ask them why they put an
invalid object into their library.

You can also remove that object:

ar dv library.a lib_obj.o

and re-try your link.

If the lib_obj.o wasn't necessary to begin with, your link will succeed.
If it was necessary, the link will fail and you have no other choice
but to get a fixed version of library.a from the third party.

> And i have no idea what Format error is supposed to mean....


It means that the linker couldn't figure out what 'lib_obj.o' is
(apparenly it's not an ELF object file).

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Casper H.S. Dik

2006-03-03, 6:43 pm

"Nithya" <nithya4u@gmail.com> writes:

>As this error states there is no string table associated with one of
>the .o file archived to the library. I confirmed it by using nm
>utility. It listed the string tables associated with many other .o
>files but failed only one. Is there any way that i can generate the
>string table by just having this archive?


No, you cannot generate the string table from the object. The information
appears lost. The best you can do is rebuild the archive without the
particular .o file in it.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com