Reputation: 5205
I have following CMakeLists.txt:
set( PROJECT_LINK_LIBS lib1.so lib2.so )
link_directories( path/to/libs ) # lib1.so and lib2.so are there.
add_library( ${PROJECT_NAME} SHARED ${PROJECT_SOURCES} )
target_link_libraries( ${PROJECT_NAME} ${PROJECT_LINK_LIBS} )
Which compiles and links fine.
But when I do:
ldd -d mylib.so
I get:
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf529b000)
linux-gate.so.1 => (0xf777a000)
/lib/ld-linux.so.2 (0xf777b000)
lib1.so => /path/to/libs/lib1.so (0xf56a2000)
lib2.so => /path/to/libs/lib2.so (0xf548f000)
My questions are:
locate linux-gate.so.1
gives nothing. Why 3. has no => symbol? (found answer here)Upvotes: 5
Views: 6094
Reputation: 836
Do you have an actual problem or are you just confused with the out put of ldd
? To answer your question: If you successfully compile and link your library on Linux, the full paths to your external libraries will be stored. If you now copy or install (using CMake) your library, the full libraries paths will be stripped. Now, you will have to make sure that the correct paths are provided by LD_LIBRARY_PATH
or that the external libs reside in the same folder your library is in.
Upvotes: -1
Reputation: 5205
Ok found the answer:
set( CMAKE_SKIP_BUILD_RPATH true )
That did it.
Upvotes: 4