Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 161317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:11:30+00:00 2026-05-11T11:11:30+00:00

Suppose I have three C static libraries say libColor.a which depends on *libRGB.*a which

  • 0

Suppose I have three C static libraries say libColor.a which depends on *libRGB.*a which in turn depends on libPixel.a . The library libColor.a is said to depend on library libRGB.a since there are some references in libColor.a to some of symbols defined in libRGB.a. How do I combine all the above libraries to a new libNewColor.a which is independent?

Independent means the new library should have all symbols defined. So while linking I just need to give -lNewColor. The size of the new library should be minimal i.e it should not contain any symbols in libRGB.a which is not used by libColor.a etc. I tried my luck using various options in ar command (used to create and update static libraries/archives).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:11:31+00:00Added an answer on May 11, 2026 at 11:11 am

    1/ Extract ALL of the object files from each library (using ar) and try to compile your code without the libraries or any of the object files. You’ll probably get an absolute bucket-load of undefined symbols. If you get no undefined symbols, go to step 5.

    2/ Grab the first one and find out which object file satisfies that symbol (using nm).

    3/ Write down that object file then compile your code, including the new object file. You’ll get a new list of undefined symbols or, if there’s none, go to step 5.

    4/ Go to step 2.

    5/ Combine all the object files in your list (if any) into a single library (again with ar).

    Bang! There you have it. Try to link your code without any of the objects but with the new library.

    This whole thing could be relatively easily automated with a shell script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

suppose I have a simple container which have three element: <div> <span>hello world</span> <input
I have a workspace with a project which links with the static libraries in
Suppose you have two static libraries A and B such that A references methods
Suppose I have a List<IMyInterface> ... I have three classes which implement IMyInterface :
Suppose I have 2 static Libs S1 and S2 which are different versions of
Suppose I have three projects in my sln. (1) xyz.a{Class Lib}{no reference added} (2)
Suppose I have three lists: list1 = a, c, d, r, t list2 =
Let us suppose i have these three methods defined: int F1(int, int); int F1(float,
Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable;
In the /data directory of solr, suppose, I have three folders named as index,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.