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

  • Home
  • SEARCH
  • 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 836559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:00:06+00:00 2026-05-15T05:00:06+00:00

two shared libraries liba.so and libb.so. liba.so uses libb.so. All c files are compiled

  • 0

two shared libraries liba.so and libb.so. liba.so uses libb.so. All c files are compiled with -fPIC. Linking uses -shared. When we call dlopen on liba.so it cannot find symbols in libb.so…we get the “undefined symbol” error. We can dlopen libb.so with no errors. We know that liba is finding libb because we don’t get a file not found error. We get a file not found error when we delete libb.so. We tried -lutil and no luck.

Any ideas????

oh yeah. gcc 4.1.2

update: We use rpath when linking liba so it can find libb.

ldd liba.so returns:

linux-gate.so.1 => (0xffffe000)  
libb.so => ./libb.so (0xf6ef9000)  <-------- LIBB 
libutil.so.1 => /lib/libutil.so.1 (0xf6ef5000)  
libdl.so.2 => /lib/libdl.so.2 (0xf6ef1000)  
libm.so.6 => /lib/libm.so.6 (0xf6ec9000)  
libpthread.so.0 => /lib/libpthread.so.0 (0xf6eb1000)  
librt.so.1 => /lib/librt.so.1 (0xf6ea8000)  
libc.so.6 => /lib/libc.so.6 (0xf6d62000)  
/lib/ld-linux.so.2 (0x007d0000)   

is it significat that there is no .# at the end of libb???

  • 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-05-15T05:00:07+00:00Added an answer on May 15, 2026 at 5:00 am

    You can easily check where libb.so is expected to be with ldd command:

     $ ldd liba.so
        linux-gate.so.1 =>  (0xb77b0000)
        libb.so.1 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb75b6000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7572000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb742b000)
        /lib/ld-linux.so.2 (0xb77b1000)
    

    If it’s not found, libb.so‘s path should be added to /etc/ld.so.conf or shell variable LD_LIBRARY_PATH.

    Another way is setting rpath in the liba.so itself – it’s basically hardcoding its path so when the binary is started the dynamic linker would know where to search for the shared libraries.

    If rpath is not set it will first search in LD_LIBRARY_PATH, then the paths mentioned in /etc/ld.so.conf (or /etc/ld.so.conf.d/). After adding to ls.so.conf don’t forget to execute /sbin/ldconfig

    Dynamic linker searches the dependent shared libraries by their soname (if it’s set) – if soname is not set (with -Wl,-soname,libb.so.1 for example), it will be searched by library’s name.

    Example: libb.so.1.0 is your actual library, having soname – libb.so.1. You would normally have the following files structure:

    libb.so -> libb.so.1
    libb.so.1 -> libb.so.1.0
    libb.so.1.0
    

    where libb.so and libb.so.1 are symlinks.

    You usually link to libb.so, when building some application or other library, depending on libb.so.

    gcc -shared -Wl,-soname,liba.so.1 -o liba.so.1.2 -L/libb/path -lb
    

    When the application is started (or dlopen is executed – your case) – the dynamic linker will search for file with name libb.so.1 – the soname of dependent library, if the soname is set, not libb.so.

    That’s why you need that symlink libb.so.1, pointing to the actual library.

    If you use ld.so.conf and ldconfig, it will create the symlink with soname‘s name, pointing to the library file, if this symlink is missing.

    You can see ld-linux man page for more useful info.


    If the library is found but some of the symbols are missing, try building libb.so with -Wl,--no-undefined option

    gcc -shared -Wl,-soname,libb.so.1 -Wl,--no-undefined -o libb.so.1.2
    

    It should give you an error if you missed to define some symbol.

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

Sidebar

Ask A Question

Stats

  • Questions 457k
  • Answers 457k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Beware. You are about to enter some fairly deep magic… May 15, 2026 at 10:48 pm
  • Editorial Team
    Editorial Team added an answer The version number of the application is set in the… May 15, 2026 at 10:48 pm
  • Editorial Team
    Editorial Team added an answer I doubt that is a memory issue. If you are… May 15, 2026 at 10:48 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.