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 7908235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:50:34+00:00 2026-06-03T11:50:34+00:00

Let be an executable C.exe depending on libB.so that itself depends on libA.so .

  • 0

Let be an executable C.exe depending on libB.so that itself depends on libA.so. C.exe doesn’t use libA directly. The tool ldd shows that C.exe still need libA.so :

> ldd C.exe 
    libB.so => ./libB.so (0x00002b11cc4f5000)
    libA.so.1 => ./libA.so.1 (0x00002b11cc719000)
    <snip>

I would have thought that libA.so would show up only when inspecting libB.so. Is there a way to avoid that behavior or do you consider it correct ?

My problem is that libA can be updated to version 2 and thus the library name would change to libA.so.2. I recompiled libB but not C.exe. I was expecting C.exe to run fine because it depends on libB which knows which libA to choose, but it is not the case.

How to handle that case ?

Compilation and Linking details

libA.so is compiled and linked this way:

g++ -fPIC -Wall -shared -Wl,-soname,libA.so.1 libA.cpp -o libA.so.1
ln -s libA.so.1 libA.so

libB.so is compiled and linked this way:

g++ -fPIC -Wall -shared -L. -lA libB.cpp -o libB.so

C.exe is compiled and linked this way:

export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
g++ -fPIC -Wall -L. -lB exeC.cpp -o C.exe
  • 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. Editorial Team
    Editorial Team
    2026-06-03T11:50:38+00:00Added an answer on June 3, 2026 at 11:50 am

    You’d have to create libA as a static library (using ar). That way its code will be embedded into libB.so and you won’t have the additional dependencies.

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

Sidebar

Related Questions

In my application there is a loader executable (let's call it Loader.exe). It searches
Let's say I am writing installation script for the program which contains executable file
Let's assume I want to change something in the 000F5344 address of an executable.
after i execute .exe and .bat files and close them, system does not let
Let's assume I have a package which calls an executable file somewhere in the
Let's say my PATH=/usr/bin ... /root/.rbenv/shims I have an executable (ruby) in /usr/bin and
Alright everyone, Let's say i wanted to make a system that used only assembly
I have a command-line tool written in Cocoa. Let's call it processFile. So if
ldd is a good simple way to check for shared libraries a given executable
I suppose there's no way to use resource from exe without full loading it

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.