LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 03-23-2010, 10:07 PM   #1
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Rep: Reputation: 15
Smile Eclipse CppUnit Test Run Time Error - libcppunit-1.12.so.1: cannot open shared object


I downloaded the CppUnit Test Library (V 1.12.1) and try to run a helloworldUnitTest sample program.

My eclipse was running under Fedora Core 12. I have modified the GCC C++ Linker libraries setting as follows:
-lcppunit -ldl

C++ Linker libraries search path as follows:
/usr/local/include/cppunit

The following are the files in /usr/local/lib
drwxr-xr-x. 3 root root 4096 2010-03-23 21:57 .
drwxr-xr-x. 11 root root 4096 2010-02-18 19:51 ..
lrwxrwxrwx. 1 root root 24 2010-03-23 21:57 libcppunit-1.12.so.1 -> libcppunit-1.12.so.1.0.0
-rwxr-xr-x. 1 root root 1995655 2010-03-23 21:57 libcppunit-1.12.so.1.0.0
-rw-r--r--. 1 root root 3489210 2010-03-23 21:57 libcppunit.a
-rwxr-xr-x. 1 root root 844 2010-03-23 21:57 libcppunit.la
lrwxrwxrwx. 1 root root 24 2010-03-23 21:57 libcppunit.so -> libcppunit-1.12.so.1.0.0
-rw-r--r--. 1 root root 803996 2010-03-04 20:46 libgmp.a
-rwxr-xr-x. 1 root root 785 2010-03-04 20:46 libgmp.la
lrwxrwxrwx. 1 root root 15 2010-03-04 20:46 libgmp.so -> libgmp.so.3.6.0
lrwxrwxrwx. 1 root root 15 2010-03-04 20:46 libgmp.so.3 -> libgmp.so.3.6.0
-rwxr-xr-x. 1 root root 450671 2010-03-04 20:46 libgmp.so.3.6.0
-rw-r--r--. 1 root root 557222 2010-03-04 20:57 libmpfr.a
-rwxr-xr-x. 1 root root 923 2010-03-04 20:57 libmpfr.la
lrwxrwxrwx. 1 root root 16 2010-03-04 20:57 libmpfr.so -> libmpfr.so.1.2.0
lrwxrwxrwx. 1 root root 16 2010-03-04 20:57 libmpfr.so.1 -> libmpfr.so.1.2.0
-rwxr-xr-x. 1 root root 332832 2010-03-04 20:57 libmpfr.so.1.2.0
drwxr-xr-x. 2 root root 4096 2010-03-23 21:58 pkgconfig

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

Can anyone please help on this ?

-aayu09
 
Old 03-23-2010, 10:14 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Q: Does it work if you set $LD_LIBRARY_PATH from the command line?

Q: Does "ls -lL /usr/local/lib/libcppunit-1.12.so.1" indicate that your symbolic link is OK?

Q: Does "ldd /helloWorldCppUnit/Debug/helloWorldCppUnit" show you the shared libraries you expect, in the locations you expect?

Please post back any specific error messages you might see (use the "code" tags to do this).

And these links might help:

http://www.comp.nus.edu.sg/~cs3214s/...ppunitSol.html

http://www.ibm.com/developerworks/ai...ools2_cppunit/
 
Old 03-23-2010, 10:33 PM   #3
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Thanks for the response.

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.

Thanks for the help.

aayu09
 
Old 03-23-2010, 10:40 PM   #4
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
some additional info from the from IDE:

**** Build of configuration Debug for project helloWorldCppUnit ****

make all
Building file: ../src/helloWorldCppUnit.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/helloWorldCppUnit.d" -MT"src/helloWorldCppUnit.d" -o"src/helloWorldCppUnit.o" "../src/helloWorldCppUnit.cpp"
Finished building: ../src/helloWorldCppUnit.cpp

Building target: helloWorldCppUnit
Invoking: GCC C++ Linker
g++ -L/usr/local/include/cppunit -L/usr/local/lib -o"helloWorldCppUnit" ./src/helloWorldCppUnit.o -lcppunit -ldl
Finished building target: helloWorldCppUnit
 
Old 03-23-2010, 11:27 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Thank you for the additional info:
Code:
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
I suspect the symbolic link is messed up

Last edited by paulsm4; 03-23-2010 at 11:28 PM.
 
Old 03-24-2010, 06:56 PM   #6
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Hi Thanks. See the following:

$ ls -lL libcppunit-1.12.so.1
-rwxr-xr-x. 1 root root 1995655 2010-03-23 21:57 libcppunit-1.12.so.1

The symbolic link looks fine, what else could be wrong?
 
Old 03-25-2010, 02:24 PM   #7
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Try something like this:
Quote:
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
Please cut/paste the results.

Good luck!

.. PSM
 
Old 03-25-2010, 08:12 PM   #8
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Hi PSM,

I have followed your suggestion. It worked fine now under command line. Please see the following when executing the commands:

[Alex@Dog lib]$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
[Alex@Dog lib]$ echo $LD_LIBRARY_PATH
/usr/local/lib:

[Alex@Dog lib]$ ls -l /usr/local/lib/libcppunit-1.12.so.1
lrwxrwxrwx. 1 root root 24 2010-03-23 21:57 /usr/local/lib/libcppunit-1.12.so.1 -> libcppunit-1.12.so.1.0.0
[Alex@Dog lib]$ ls -lL /usr/local/lib/libcppunit-1.12.so.1
-rwxr-xr-x. 1 root root 1995655 2010-03-23 21:57 /usr/local/lib/libcppunit-1.12.so.1

[Alex@Dog Debug]$ ldd helloWorldCppUnit
linux-gate.so.1 => (0x00b93000)
libcppunit-1.12.so.1 => /usr/local/lib/libcppunit-1.12.so.1 (0x007a9000)
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 (0x00110000)
/lib/ld-linux.so.2 (0x00a61000)

[Alex@Dog Debug]$ ./helloWorldCppUnit
Test::testHelloWorldHello, world!
: OK


Great!

If you don't mind, I will take one step further, why Eclipse IDE does not work? I have added the path (/usr/local/lib) to the library path

Thanks again.

--aayu
 
Old 07-23-2010, 08:22 AM   #9
Nielk
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 1
Quote:
Originally Posted by aayu09 View Post
Great!

If you don't mind, I will take one step further, why Eclipse IDE does not work? I have added the path (/usr/local/lib) to the library path

Thanks again.

--aayu
Hi,

It's quite an old topic, but I have exactly the same problem as you, and I've been stuck for a while...
Did you find a solution ?

Cheers,
Nielk
 
Old 07-26-2010, 04:59 AM   #10
Nielk
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 1
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...

Hope that can help someone one day !
 
Old 08-04-2010, 10:01 PM   #11
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Hey Nielk:

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.

Thanks,

-aayu
 
Old 08-05-2010, 03:24 AM   #12
Nielk
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 1
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).
 
Old 08-05-2010, 07:38 PM   #13
aayu09
Member
 
Registered: Feb 2010
Posts: 30

Original Poster
Rep: Reputation: 15
It works fine with me too using your trick. Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
error while loading shared libraries: libhid.so.0: cannot open shared object file: No misungs Linux - Software 4 06-10-2009 12:05 PM
error while loading shared libraries: libstdc++.so.5: cannot open shared object file PaulyWally Debian 2 10-18-2008 05:59 PM
error while loading shared libraries: libgvc.so.3: cannot open shared object file coolrock Slackware 6 01-17-2007 05:10 PM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration