cppcms - Shared library - Linux - linux

I am trying to use the cppcms framework on Linux(Debian distribution).
I followed the steps described in the Build tutorial on the site and then tried to build the hello world application.
I have successfully compiled the source, but when I try to run it I get the following error:
./hello: error while loading shared libraries: libcppcms.so.1: cannot open shared object file: No such file or directory
I am relatively new to Linux so I had to a little research and come across these things called Shared Libraries. As I understood, these *.so files are exactly what I was needing to create.
I also read that the base folder for libraries was /home/usr/lib so I tried copying the file onto that folder, but it didn't help.
I would really appreciate any help that might get me through this problem.
Thank you!

I was able to recover from this problem by executing "sudo ldconfig"

Also this worked out for me:
export LD_LIBRARY_PATH=/path/to/library/
./hello -c config.js
where "/path/to/library/" is the actual directory where libcppcms.so.1
lives. (mine was /usr/local/lib/)
[got it from http://comments.gmane.org/gmane.comp.lib.cppcms.user/764 ]

Instead of building CppCMS on your own, install ready to use deb: http://cppcms.com/wikipp/en/page/apt#Apt-Get.Repositories
You can use the troubleshooting guide that the problem you are talking about was mentioned: http://cppcms.com/wikipp/en/page/cppcms_1x_build_troubleshooting#My.sample.application.does.not.find.the.shared.object..code.libcppcms.so..code..when.I.try.to.run.it.

Related

make: i686-linux-gnu-ld: Command not found

i want to install cpanm WWW::Curl::Form on my Synology NAS. But that fails. Here is the output cpanm WWW::Curl::Form WWW::Curl::Easy File::Find::Rule String::CRC32 URI::Escape
--> Working on WWW::Curl::Form
Fetching http://www.cpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz ... OK
Configuring WWW-Curl-4.17 ... OK
Building and testing WWW-Curl-4.17 ... FAIL
! Installing WWW::Curl::Form failed. See /var/services/homes/fox/.cpanm/work/1541095458.25803/build.log
the log file gives me:
make: i686-linux-gnu-ld: Command not found
But i dont know how to fix it on my Synology NAS (DSM 6.2 and appollolake architecture DS918+)
After reviewing your additional comments, I believe I have potential solution. It looks like you are trying to install some Perl modules via the default Perl shell, cpan. As part of the installation process, the make utility is being executed. This utility is heavily used for compiling and building source from C and C++ source code, along with other languages.
The make utility is trying to call some executable i686-linux-gnu-ld which is a linker, see ld. A linker is a utility used in C programming for linking (combining) multiple compiled object files into a single executable binary. make is calling this utility as some sort of build process. Instead of calling i686-linux-gnu-ld it should probably just be calling ld. The only thing I am not sure about is why it is using the full name of the utility instead of ld.
I can think of two solutions. The first would be to update the make file to use the correct name for the linker. I'm not sure how you would do this when it is being installed via cpan since it is downloading a package and executing the make file before you have a chance to modify it. The other option is to create a symbolic link from the incorrect name and path of ld that the make file is using to the correct path /opt/bin/ld. This will result in ld being called when i686-linux-gnu-ld is called. Also, I forgot to mention it earlier but the which command will tell you where an executable / command is located on your shell's path.
The Stack Overflow post, How to symlink a file in Liunx?, gives a good explanation of how to create a symlink. You need to create a symlink to point to the correct name and path of the linker. To do so run the following command:
ln -s /opt/bin/ld /usr/bin/i686-linux-gnu-ld
Depending on the permissions of these directories you may need to run this command under a account with elevated permissions or via sudo. I apologize for this post being rather long and verbose. I just wanted to explain my solution in detail. I hope this helps. Please let me know if this doesn't resolve the problem.
edit: fixed typo in the command.

Adding path to CUDA libraries without sudo access

I used a library (the library is called cublas) in my CUDA code which I 'm writing in linux, I can compile my code successfully using nvcc but when I run the code I get this error:
error while loading shared libraries: libcublas.so.7.5: cannot open shared object file: No such file or directory
I found This link as a solution which suggests to run some commands in order to solve the issue. one solution based on this link is running the following command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
The system which gpu locates in it and I am using to run my code on it is shared between me and other people, I am not a sudo user in that system. I am wondering if running this command is safe and does not affect other settings of the system
Can anyone please help me to know that>
Thank you so much
I am wondering if running this command is safe and does not affect other settings of the system
Yes, you'll be fine.
This command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
only affects the process you execute it in.
It will not affect any other user's process, or any other process of yours.
Furthermore, if you log out and log in again, you will have to execute that command again. It is not "sticky"

Python3.5 installation fails: cannot open libpython3.5m.so.1.0

I'm trying to install Python 3.5.2 on CentOS 7. The build appears to succeed, but executing python3 elicits
python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
I checked this question as the only link that appeared to help. ldd does show the file as missing, and it does not seem to exist anywhere, although /usr/lib/libpython3.5m.so exists.
By any chance, is /usr/lib/libpython3.5m.so the correct file? I have no problem making a link, but I don't want to shoot myself in the foot if it's wrong. I also wonder whether there are related layers of yak fur waiting for me. Perhaps I need to make clean and rebuild with other options?
Much along the same lines as the quoted question, I still need to repair LD_LIBRARY_PATH. The global solution is at least a workaround:
export LD_LIBRARY_PATH=/usr/lib/
The problem was mostly in locating the wayward file.
You should make it by ./configure --enable-shared
then
make && make install
after that,
vim /etc/ld.so.conf.d/python3.conf && and add a new line
/usr/local/lib
try /sbin/ldconfig
hope it works !

Cygwin Gcc error while loading shared libraries?

I have instaled Cygwin after running MinGW for a while now. But when I try to compile the console gives me:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
What does this mean?
I have the same problem and I found the solution.
According to the FAQ of Cygwin
Q: Why is C:\cygwin\usr\bin invisible from windows?
A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin.
So trying to add "C:\cygwin\usr\bin" to PATH will be in vain.
Add "C:\cygwin64\bin" to PATH instead. Hope this helps :)
You are missing a library, please run cygcheck /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe or ldd /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe to see what is the missing library.
(I'd rather ask a question in the comments first, but I don't have enough reputation yet.)
Your cc1 is unable to load some DLLs it needs to start. Looking at the Cygwin source code, this can be either a library specified in LD_PRELOAD, or -- more probably -- a library the executable depends on. The ? in the error message seems to be the default return value of find_first_notloaded_dll (hookapi.cc), in case the function can't determine what library is missing.
To diagnose the issue, I suggest checking your PATH variable (or even clearing it of any non-Cygwin paths and trying the compilation again) and/or using Dependency Walker to find the missing DLLs (start it from a Cygwin shell, so it can see the same PATH). ldd (included with Cygwin) may also give some clues, but I wouldn't bet on it.
It's possible a clean re-install of Cygwin will be necessary to solve the issue.
Most likely, you are simply missing /usr/bin in the PATH variable.
Adding 'export PATH=/usr/bin:$PATH' to your .bashrc file will solve the issue.
Adding some background info. I had the same problem when building my own program and linking it against graphviz cgraph.dll. Turns out this is related to where windows searches for DLLs (see here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) So adding the path of your missing library to PATH should fix the problem.
It is unfortunate that the message doesn't include the name of the library. Luckily cmd.exe DOES give you this name (so it's good for something after all;)
Are you including the path to your lib directory?
Looks like you are not
I'm not very familiar with Cygwin, I mainly use MinGW, but I think the error message speaks for itself
I also came this error on windows machine while executing .exe file generated by scilab2C i.e toolbox for Scilab
For Windows 32 bit Add the environment variable path as follow :
C:\cygwin\usr\i686-pc-cygwin\bin
Hope so this will solve your issue.
Just had this problem trying to compile a package with make and it wanted some cygguile dll file that was just installed along with make.
My solution was I had not only migrated my cygwin64 directory across drives because the sector sizes were mismatched for some reason even though the drivers were both under 2TB and should have been using 512 byte sector sizes.. So I had to install a new system and move files over there, might have had weird permissions on them.
Also had to patch cygwin1.dll end of Jan 2020 because of a recent input problem in ConEmu with Windows 10 1903 build, but just did it again with this working so that doesn't seem to be the issue.
Reinstalling cygwin by deleting that entire directory, taking ownership of it first.., seemed to work now...

Matlab Libopencv error using Linux

I am running into errors with opencv. I downloaded a package online and compiled each of the folders by cd into them and running make through the command line. But when I try using one of the functions, I run into this error: libopencv_core.so.2.3: cannot open shared object file: No such file or directory
The file its trying to reach is indeed there, since I checked this, but for some reason its saying its not. I am pretty bad at figuring out path problems but I think this is one of them. Can anyone tell me how to fix this? Thanks

Resources