run time error while loading shared libraries

This is a discussion on run time error while loading shared libraries within the C++ Programming forums, part of the General Programming Boards category; I wrote a program that uses: Code: libCppUnit.so, libCppUnitd.so, libPocoFoundation.so libPocoFoundationd.so libPocoNet.so libPocoNetd.so libPocoUtil.so libPocoUtild.so libPocoXML.so libPocoXMLd.so I add this ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    5

    run time error while loading shared libraries

    I wrote a program that uses:
    Code:
    libCppUnit.so, libCppUnitd.so, libPocoFoundation.so libPocoFoundationd.so libPocoNet.so libPocoNetd.so libPocoUtil.so libPocoUtild.so libPocoXML.so libPocoXMLd.so
    I add this libraries with related include files and compiled test.cpp:
    Code:
    Building file: ../src/test.cpp
    Invoking: GCC C++ Compiler
    g++ -I"/home/mijax/Eclipse/workspace/Anal1/common/CppUnit/include" -I"/home/mijax/Eclipse/workspace/Anal1/common/Foundation/include" -I"/home/mijax/Eclipse/workspace/Anal1/common/Net/include" -I"/home/mijax/Eclipse/workspace/Anal1/common/Util/include" -I"/home/mijax/Eclipse/workspace/Anal1/common/XML/include" -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.cpp"
    Finished building: ../src/test.cpp
     
    Building target: Anal1
    Invoking: GCC C++ Linker
    g++ -L"/home/mijax/Eclipse/workspace/Anal1/lib" -o"Anal1"  ./src/test.o   -lCppUnit -lCppUnitd -lPocoFoundationd -lPocoNetd -lPocoUtild -lPocoXMLd -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML
    Finished building target: Anal1
    As you see, When I build it, all thing is OK. BUT when i run Anal1, get me this error:

    Code:
    /home/mijax/Eclipse/workspace/Anal1/Release/Anal1: error while loading shared libraries: libCppUnit.so.1: cannot open shared object file: No such file or directory
    How add shared objects file?
    Code:
    libCppUnit.so.1, libCppUnitd.so.1, libPocoFoundation.so.9 libPocoFoundationd.so.9 libPocoNet.so.9 libPocoNetd.so.9 libPocoUtil.so.9 libPocoUtild.so.9 libPocoXML.so.9 libPocoXMLd.so.9

  2. #2
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Are you sure the library is in the right place and ldconfig has checked it?

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    5
    What is your intention "in right place"?

    I want to use these libraries only in this project. I put
    Code:
    libCppUnit.so, libCppUnitd.so, libPocoFoundation.so libPocoFoundationd.so libPocoNet.so libPocoNetd.so libPocoUtil.so libPocoUtild.so libPocoXML.so libPocoXMLd.so
    in /home/mijax/Eclipse/workspace/Anal1/lib directory.

    Where & how to add these?
    Code:
    libCppUnit.so.1, libCppUnitd.so.1, libPocoFoundation.so.9 libPocoFoundationd.so.9 libPocoNet.so.9 libPocoNetd.so.9 libPocoUtil.so.9 libPocoUtild.so.9 libPocoXML.so.9 libPocoXMLd.so.9

  4. #4
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Put them in /usr/lib (the default place) and then run ldconfig. Try if it works. Linux looks for shared libraries only in a catalogue generated by ldconfig.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    5
    Thank you Brafil.
    I copied
    Code:
    libCppUnit.so.1, libCppUnitd.so.1, libPocoFoundation.so.9 libPocoFoundationd.so.9 libPocoNet.so.9 libPocoNetd.so.9 libPocoUtil.so.9 libPocoUtild.so.9 libPocoXML.so.9 libPocoXMLd.so.9
    to /usr/lib/ and program run successfully but got these message to stderr:
    Code:
    *** glibc detected *** /home/mijax/Eclipse/workspace/Anal1/Release/Anal1: double free or corruption (fasttop): 0x095673a0 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6[0xb7609604]
    /lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb760b5b6]
    /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb77ec231]
    /usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0xb77c89fd]
    /usr/lib/libstdc++.so.6(_ZNSsD1Ev+0x51)[0xb77ca3b1]
    /lib/tls/i686/cmov/libc.so.6(__cxa_finalize+0xc1)[0xb75c8f51]
    /usr/lib/libCppUnitd.so.1[0xb7fc4d64]
    /usr/lib/libCppUnitd.so.1[0xb7fcbe50]
    /lib/ld-linux.so.2[0xb7ffda73]
    /lib/tls/i686/cmov/libc.so.6(exit+0x89)[0xb75c8bb9]
    /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xed)[0xb75b077d]
    /home/mijax/Eclipse/workspace/Anal1/Release/Anal1[0x8048b01]
    ======= Memory map: ========
    08048000-08049000 r-xp 00000000 08:02 1415678    /home/mijax/Eclipse/workspace/Anal1/Release/Anal1
    08049000-0804a000 r--p 00001000 08:02 1415678    /home/mijax/Eclipse/workspace/Anal1/Release/Anal1
    0804a000-0804b000 rw-p 00002000 08:02 1415678    /home/mijax/Eclipse/workspace/Anal1/Release/Anal1
    0953d000-0957f000 rw-p 0953d000 00:00 0          [heap]
    b7400000-b7421000 rw-p b7400000 00:00 0 
    b7421000-b7500000 ---p b7421000 00:00 0 
    b7571000-b7574000 rw-p b7571000 00:00 0 
    b7574000-b757b000 r-xp 00000000 08:02 246665     /lib/tls/i686/cmov/librt-2.9.so
    b757b000-b757c000 r--p 00006000 08:02 246665     /lib/tls/i686/cmov/librt-2.9.so
    b757c000-b757d000 rw-p 00007000 08:02 246665     /lib/tls/i686/cmov/librt-2.9.so
    b757d000-b757f000 r-xp 00000000 08:02 246641     /lib/tls/i686/cmov/libdl-2.9.so
    b757f000-b7580000 r--p 00001000 08:02 246641     /lib/tls/i686/cmov/libdl-2.9.so
    b7580000-b7581000 rw-p 00002000 08:02 246641     /lib/tls/i686/cmov/libdl-2.9.so
    b7581000-b7596000 r-xp 00000000 08:02 246661     /lib/tls/i686/cmov/libpthread-2.9.so
    b7596000-b7597000 r--p 00014000 08:02 246661     /lib/tls/i686/cmov/libpthread-2.9.so
    b7597000-b7598000 rw-p 00015000 08:02 246661     /lib/tls/i686/cmov/libpthread-2.9.so
    b7598000-b759a000 rw-p b7598000 00:00 0 
    b759a000-b76f6000 r-xp 00000000 08:02 246635     /lib/tls/i686/cmov/libc-2.9.so
    b76f6000-b76f7000 ---p 0015c000 08:02 246635     /lib/tls/i686/cmov/libc-2.9.so
    b76f7000-b76f9000 r--p 0015c000 08:02 246635     /lib/tls/i686/cmov/libc-2.9.so
    b76f9000-b76fa000 rw-p 0015e000 08:02 246635     /lib/tls/i686/cmov/libc-2.9.so
    b76fa000-b76fd000 rw-p b76fa000 00:00 0 
    b76fd000-b770a000 r-xp 00000000 08:02 228993     /lib/libgcc_s.so.1
    b770a000-b770b000 r--p 0000c000 08:02 228993     /lib/libgcc_s.so.1
    b770b000-b770c000 rw-p 0000d000 08:02 228993     /lib/libgcc_s.so.1
    b770c000-b770d000 rw-p b770c000 00:00 0 
    b770d000-b7731000 r-xp 00000000 08:02 246643     /lib/tls/i686/cmov/libm-2.9.so
    b7731000-b7732000 r--p 00023000 08:02 246643     /lib/tls/i686/cmov/libm-2.9.so
    b7732000-b7733000 rw-p 00024000 08:02 246643     /lib/tls/i686/cmov/libm-2.9.so
    b7733000-b7817000 r-xp 00000000 08:02 2824254    /usr/lib/libstdc++.so.6.0.10
    b7817000-b781b000 r--p 000e3000 08:02 2824254    /usr/lib/libstdc++.so.6.0.10
    b781b000-b781c000 rw-p 000e7000 08:02 2824254    /usr/lib/libstdc++.so.6.0.10
    b781c000-b7822000 rw-p b781c000 00:00 0 
    b7822000-b78a8000 r-xp 00000000 08:02 2824694    /usr/lib/libPocoXML.so.9
    b78a8000-b78ac000 r--p 00086000 08:02 2824694    /usr/lib/libPocoXML.so.9
    b78ac000-b78ad000 rw-p 0008a000 08:02 2824694    /usr/lib/libPocoXML.so.9
    b78ad000-b78f9000 r-xp 00000000 08:02 2824692    /usr/lib/libPocoUtil.so.9
    b78f9000-b78fa000 ---p 0004c000 08:02 2824692    /usr/lib/libPocoUtil.so.9
    b78fa000-b78fb000 r--p 0004c000 08:02 2824692    /usr/lib/libPocoUtil.so.9
    b78fb000-b78fc000 rw-p 0004d000 08:02 2824692    /usr/lib/libPocoUtil.so.9
    b78fc000-b79db000 r-xp 00000000 08:02 2824690    /usr/lib/libPocoNet.so.9
    b79db000-b79dc000 ---p 000df000 08:02 2824690    /usr/lib/libPocoNet.so.9
    b79dc000-b79e0000 r--p 000df000 08:02 2824690    /usr/lib/libPocoNet.so.9
    b79e0000-b79e2000 rw-p 000e3000 08:02 2824690    /usr/lib/libPocoNet.so.9
    b79e2000-b79e3000 rw-p b79e2000 00:00 0 
    b79e3000-b7b71000 r-xp 00000000 08:02 2824688    /usr/lib/libPocoFoundation.so.9
    b7b71000-b7b72000 ---p 0018e000 08:02 2824688    /usr/lib/libPocoFoundation.so.9
    b7b72000-b7b78000 r--p 0018e000 08:02 2824688    /usr/lib/libPocoFoundation.so.9
    b7b78000-b7b7a000 rw-p 00194000 08:02 2824688    /usr/lib/libPocoFoundation.so.9
    b7b7a000-b7c2d000 r-xp 00000000 08:02 2824695    /usr/lib/libPocoXMLd.so.9
    b7c2d000-b7c31000 r--p 000b3000 08:02 2824695    /usr/lib/libPocoXMLd.so.9
    b7c31000-b7c33000 rw-p 000b7000 08:02 2824695    /usr/lib/libPocoXMLd.so.9
    b7c33000-b7c95000 r-xp 00000000 08:02 2824693    /usr/lib/libPocoUtild.so.9
    b7c95000-b7c96000 ---p 00062000 08:02 2824693    /usr/lib/libPocoUtild.so.9
    b7c96000-b7c97000 r--p 00062000 08:02 2824693    /usr/lib/libPocoUtild.so.9
    b7c97000-b7c99000 rw-p 00063000 08:02 2824693    /usr/lib/libPocoUtild.so.9
    b7c99000-b7dae000 r-xp 00000000 08:02 2824691    /usr/lib/libPocoNetd.so.9
    b7dae000-b7daf000 ---p 00115000 08:02 2824691    /usr/lib/libPocoNetd.so.9
    b7daf000-b7db3000 r--p 00115000 08:02 2824691    /usr/lib/libPocoNetd.so.9
    b7db3000-b7db6000 rw-p 00119000 08:02 2824691    /usr/lib/libPocoNetd.so.9
    b7db6000-b7fb0000 r-xp 00000000 08:02 2824689    /usr/lib/libPocoFoundationd.so.9
    b7fb0000-b7fb6000 r--p 001fa000 08:02 2824689    /usr/lib/libPocoFoundationd.so.9
    b7fb6000-b7fbb000 rw-p 00200000 08:02 2824689    /usr/lib/libPocoFoundationd.so.9
    b7fbb000-b7fbc000 rw-p b7fbb000 00:00 0 
    b7fbc000-b7fcf000 r-xp 00000000 08:02 2824687    /usr/lib/libCppUnitd.so.1
    b7fcf000-b7fd0000 r--p 00012000 08:02 2824687    /usr/lib/libCppUnitd.so.1
    b7fd0000-b7fd1000 rw-p 00013000 08:02 2824687    /usr/lib/libCppUnitd.so.1
    b7fd1000-b7fdc000 r-xp 00000000 08:02 2824686    /usr/lib/libCppUnit.so.1
    b7fdc000-b7fdd000 r--p 0000a000 08:02 2824686    /usr/lib/libCppUnit.so.1
    b7fdd000-b7fde000 rw-p 0000b000 08:02 2824686    /usr/lib/libCppUnit.so.1
    b7feb000-b7fee000 rw-p b7feb000 00:00 0 
    b7fee000-b7fef000 r-xp b7fee000 00:00 0          [vdso]
    b7fef000-b800b000 r-xp 00000000 08:02 228951     /lib/ld-2.9.so
    b800b000-b800c000 r--p 0001b000 08:02 228951     /lib/ld-2.9.so
    b800c000-b800d000 rw-p 0001c000 08:02 228951     /lib/ld-2.9.so
    bf9f7000-bfa0c000 rw-p bffeb000 00:00 0          [stack]
    For solving this message and remove it, i edit
    Code:
    Building target: Anal1
    Invoking: GCC C++ Linker
    g++ -L"/home/mijax/Eclipse/workspace/Anal1/lib" -o"Anal1"  ./src/test.o   -lCppUnit -lCppUnitd -lPocoFoundationd -lPocoNetd -lPocoUtild -lPocoXMLd -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML
    Finished building target: Anal1
    to:
    Code:
    Building target: Anal1
    Invoking: GCC C++ Linker
    g++ -L"/home/mijax/Eclipse/workspace/Anal1/lib" -o"Anal1"  ./src/test.o   -lCppUnit -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML
    Finished building target: Anal1
    Now program run succesfully without any stderr message.
    Last edited by mijax; 05-16-2010 at 05:24 AM.

  6. #6
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Seems like the problem is in libCppunitd.so.1, so your removal helped. But, actually, if you didn't need it, why did you link against libCppunitd?

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    5
    At now I only want to test Poco library and in test.cpp i only use PocoFoundation library and didn't use others.
    Last edited by mijax; 05-16-2010 at 08:19 AM.

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    5

    Wonderful!

    I build & ran again with CppUnitd and others:
    Code:
    Building target: Anal1
    Invoking: GCC C++ Linker
    g++ -L"/home/mijax/Eclipse/workspace/Anal1/lib" -o"Anal1"  ./src/test.o   -lCppUnit -lCppUnitd -lPocoFoundationd -lPocoNetd -lPocoUtild -lPocoXMLd -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML
    Finished building target: Anal1
    But At now, There is not any problem and any stderr. It seem CppUnitd has bug.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. shared libraries
    By kris.c in forum Linux Programming
    Replies: 5
    Last Post: 12-25-2006, 08:08 PM
  2. wxWidgets loading shared library problem
    By BobS0327 in forum Linux Programming
    Replies: 1
    Last Post: 05-10-2006, 08:23 PM
  3. shared libraries
    By Raven Arkadon in forum C++ Programming
    Replies: 5
    Last Post: 06-27-2005, 08:11 AM
  4. Globar Variables in Shared Libraries
    By Raven Arkadon in forum C++ Programming
    Replies: 10
    Last Post: 02-24-2005, 04:26 PM
  5. Create class at run time
    By muaed in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-11-2002, 09:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21