ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to run my application at the start up time and that application use the shared library file to execute itself.
Now, my application runs at the start up time, but the library file doesn't load and it gives the error that "error in loading the shared library file: No such file found.
In fact, i have put the library file in bot /usr/lib and /lib, so that it can get from anywhere, but it couldnt get it from anywhere.
Instead once my OS loads, this application runs without any problem and there is no problem in loading the shared library file at that time, can anybody please tell me what could be the error?
In fact there is no ld.so.conf file in my /etc and there is no /ldconfig command run on my OS.
I guess that library paths are not yet set when your program is run. Looking into your starting scripts should reveal that. I understand, however, that you want to launch the program at the time it is. If so, the only sensible option seems to be to open the library using full path in your program (the path itself may be passed as program parameter). Of course, if you don't want to launch ldconfig or such.
I guess that library paths are not yet set when your program is run. Looking into your starting scripts should reveal that. I understand, however, that you want to launch the program at the time it is. If so, the only sensible option seems to be to open the library using full path in your program (the path itself may be passed as program parameter). Of course, if you don't want to launch ldconfig or such.
Hiii Mara,
I think you are right that i have to do the static linking of the shared library file, but what i observe is, there is no reference in the application about the shared library file and the only concern is about the header file, which will be called by shared library file.
1. Cut and paste the exact error message (if at all possible)
2. Run "ldd" on your executable, and cut/paste the exact output
3. Post the error message and your ldd output back to this thread
This should help us more intelligently troubleshoot the problem.
OK?
Thank you in advvance .. PSM
Hiii,
Below is the error I am getting while starting the application on initialisaztion:
-----------------------------------------------------
"/usr/sbin/slave: error in loading shared libraries: libmodbus.so: cannot open shared object file: No such file or directory"
-----------------------------------------------------
I am getting the above error, instead of there is a file inside my /usr/lib/libmodbus.so.
When i tried to run the command "ldd", it showed me that there is no such command, it mean that there is no linking for the library files has been implemented.
Is it necessary to have the ldd or ldconfig for linking the library files? or should i have to do the static binding?
The output of ldd is to see if all dependencies are resolved, and how. ldd should be installed by default, in /usr/bin/ldd.
Anyway, how about setting LD_LIBRARY_PATH yourself? Create a script, say startup_nishants_program
Inside that, add the following code:
Code:
#!/bin/bash
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<path to directory containing your required library>
export LD_LIBRARY_PATH
<path to your executable>
Then make startup_nishants_program executable, and add it to your startup scripts instead of adding your executable directly.
Hiii,
Not a bad idea either to create executable of setting LD_LIBRARY_PATH and to put it inside the initscript files, but my dobut is that it still wont load the libraries, because Linux only search for the files which are in the /etc/ld.so.cache and by the way i have already tried to write the setting Library file path inside the rc.sysinit (Which is an initialisation script), but i then also got an error.
Finally what i did is take the ld.so.conf, write the necessary code inside and then generate the ld.so.cache in my desktop linux and then copy it to my ARM Linux's Ramdisk, and it works for me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.