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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:52:14+00:00 2026-05-27T13:52:14+00:00

I made a simple program that uses a shared object, opening it with dlopen()

  • 0

I made a simple program that uses a shared object, opening it with dlopen(). I also compiled and linked the shared object like below:

gcc -o libmylib.so libmylib.c -shared -fPIC -Wall

gcc -o program program.c -L. -lmylib -ldl -Wall

When I tried to run the program for the first time it said something like

cannot open libmylib.so: no such file or directory

so I searched the internet and found that I have to copy my shared object to /lib/i386-linux-gnu/ in order for the program to run. So I did so, and it worked, but then I tried to do it in other ways and therefore I removed libmylib.so from the /lib/i3686-linux-gnu/ directory. Now when I’m trying to run the program it shown no errors but keeps saying Segmentation fault. It is clear that the shared object is nowhere to be found, but how can I link it without copying anything?

I am using Ubuntu 11.10

  • 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-27T13:52:15+00:00Added an answer on May 27, 2026 at 1:52 pm

    When you compiled the program, you linked it properly; using -L. -lmylib. However, if it’s not a standard system library, the execution environment needs to know where to look for it. One way you can do this is by using the environment variable LD_LIBRARY_PATH, like so:

    LD_LIBRARY_PATH=. ./program
    

    or

    export LD_LIBRARY_PATH=.
    ./program
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For an assignment I've made a simple C++ program that uses a superclass (Student)
I'm learning java and I have made simple program that simply reads value from
Hi i have made a simple program that plays a video file, i used
I have a made a simple program that reproduces the problem: #include <boost/archive/text_oarchive.hpp> #include
I made a simple java program that sends bytes to the parallel port, which
I made a program that is supposed to recognize a simple grammar. When I
I made a simple program that allows the user to pick a number of
i've made a simple program that change a string from lowercase to uppercase and
I have made my own file type (.ddd) and I made a simple program
Very simple question, I made the following program : #include <stdlib.h> int main(int argc,

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.