LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2009, 05:54 AM   #1
Manidas
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
Archiving static libraries: "could not read symbols"


Hi All,
I have two static libraries, and i need to create a single library by combining these two
i.e I have libone.a and libtwo.a and need to make libcombined.a by combining libone.a and libtwo.a

I tried
ar -rs libcombined.a libone.a libtwo.a
But when i tried to link this library to an exe i got the error

"libcombined.a:could not read symbols: Archive has no index; run ranlib to add one"

I tried running ranlib, but still i am getting this error , please help.
 
Old 06-05-2009, 03:47 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Try to extract all the objects from libone.a and libtwo.a then merge them all together:
Code:
$ ar -x libone.a
$ ar -x libtwo.a
$ ar -r -c libcombined.a *.o
this should recreate the index. Anyway, from the man page of ar:
Quote:
The ordering of members in an archive can make a difference in how programs are linked using the library, if a symbol is defined in more than one member.
this may bring to complications.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting "Short read in buffer_copy" error with "dpkg" stalefries Linux - Software 6 03-24-2010 04:19 PM
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 06:57 PM
Hiding Symbols in Static Libraries JCipriani Programming 2 03-03-2006 06:15 PM
Making static symbols private/local in shared libraries skoona Programming 1 02-18-2005 04:14 PM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 10:29 PM


All times are GMT -5. The time now is 12:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration