Menu

Problem finding the CppUnit library.

Help
SippyCup
2007-04-29
2013-04-22
  • SippyCup

    SippyCup - 2007-04-29

    I'm new to CppUnit, so sorry if this is silly. I've got CppUnit installed on a Linux server (I didn't have the permissions to install it--had to get someone with root permissions, but it's there). I've been following what examples I can find on the net, but so far, I'm not able to get a simple program to work. I can get it compiled, but I get a runtime error. I've provided the error below, as well as the contents of my makefile. Any help would be greatly appreciated!

    Error:

    ./test: error while loading shared libraries: libcppunit-1.10.so.2: cannot open shared object file: No such file or directory

    Makefile:

    CPPUNIT_PATH=/usr/local/include/cppunit

    test: test.o ComplexNumberTest.o ComplexNumber.o
            g++ -o test test.o ComplexNumberTest.o ComplexNumber.o -L/usr/local/lib/  -lstdc++ -lcppunit -ldl
    ComplexNumber.o: ComplexNumber.cc ComplexNumber.h
            g++ -c ComplexNumber.cc
    ComplexNumberTest.o: ComplexNumberTest.cc
            g++ -c ComplexNumberTest.cc -I${CPPUNIT_PATH}
    test.o: test.cc
            g++ -c test.cc -I${CPPUNIT_PATH}

    Notes:

    I did a locate on libcppunit-1.10.so.2, and it's in the directory I'm providing in the makefile. That leads me to believe I either don't know what I'm doing with the make options, or something really weird is happening. Also, I know it isn't a permission issue.

     
    • Code Guru

      Code Guru - 2007-04-29

      Your makefile only determines what happens when you compile the test program.  Since you don't get any compiler or linker errors, your makefile is just fine.

      The error you get at run-time means that Linux (technically "ld", the Linux loader) cannot find the dynamic .so library.  To fix this, you need to ask the system admin to add the directory containing this .so file to the path that ld searches.  I believe it's just requires modifying an environment variable, but I don't remember the details off the top of my head.  The sys admin probably knows more details.  You can also modify the variable for yourself in .bashrc or the similar script file for your shell.  Sorry that I can't provide any details.  With the right search, google will probably be able to provide more info.

       
    • SippyCup

      SippyCup - 2007-05-01

      Thanks! I kind of figured it was an environment variable that needed to be changed. I'll see what I can turn up with google.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.