Eclipse CppUnit Test Run Time Error - libcppunit-1.12.so.1: cannot open shared object
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
While the project compile and linked successfully. It has the following execution error:
/helloWorldCppUnit/Debug/helloWorldCppUnit: error while loading shared libraries: libcppunit-1.12.so.1: cannot open shared object file: No such file or directory
I am using eclipse IDE. Here it the results of to Question 2:
ls -il libcppunit-1.12.so.1
205760 lrwxrwxrwx. 1 root root 24 2010-03-23 21:57 libcppunit-1.12.so.1 -> libcppunit-1.12.so.1.0.0
The results to Question 3:
ldd helloWorldCppUnit
linux-gate.so.1 => (0x00504000)
libcppunit-1.12.so.1 => not found
libdl.so.2 => /lib/libdl.so.2 (0x00bfa000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x046d2000)
libm.so.6 => /lib/libm.so.6 (0x00c1d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00523000)
libc.so.6 => /lib/libc.so.6 (0x00a83000)
/lib/ld-linux.so.2 (0x00a61000)
Don't know why libcppunit-1.12.so.1 can not be found by during run time.
ldd helloWorldCppUnit
linux-gate.so.1 => (0x00504000)
libcppunit-1.12.so.1 => not found
<= This is the problem!
libdl.so.2 => /lib/libdl.so.2 (0x00bfa000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x046d2000)
libm.so.6 => /lib/libm.so.6 (0x00c1d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00523000)
libc.so.6 => /lib/libc.so.6 (0x00a83000)
/lib/ld-linux.so.2 (0x00a61000)
Code:
ls -lL /usr/local/lib/libcppunit-1.12.so.1
<= This is the command I meant for you to run:
"ls dash-little-ell-Big-Ell", not "ls -il..."
Please cut and paste the "ls -lL /usr/local..." command directly from above
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
<= This explicitly adds "/usr/local/lib" to the shared library runtime search path
echo $LD_LIBRARY_PATH
ls -l /usr/local/lib/libcppunit-1.12.so.1
ls -lL /usr/local/lib/libcppunit-1.12.so.1
<= You've already done this (ad nauseum!). But it never hurts to be absolutely sure
cd DIRECTORY_WITH_MY_UNIT_TEST
ldd helloWorldCppUnit
<= We'd be Very Sad if "libcppunit-1.12.so.1" was still "not found"
./helloWorldCppUnit
<= Otherwise, if ldd shows everything OK, try running your unit test
If anyone is interested, I found a (not so elegant) fix...
It seems that the eclipse terminal is not aware of system variables, even if they are exported from inside eclipse
So a solution is to add it manually in the run configuration file, i.e. add a LD_LIBRARY_PATH with the appropriate list of directories...
I am revisiting this post, and still interested in the cppunit sample. Could you please specify how to add the LD_LIBRARY_PATH to the IDE ? Please list the details steps if possible.
I am using Eclipse 3.5 (Galileo), and on this version the procedure is the following :
- click on the arrow next to the "Run" button, then on "Run configuration..." in the menu.
- in the new configuration window, check that the relevant project is selected, on the left pane.
- on the right pane, click on the "Environment" Tab, and add the LD_LIBRARY_PATH to the list, with appropriate value ("New" button).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.