On 05/28/2014 12:17 PM, Nils Gladitz wrote:
> In case you drop "-Wl,-soname" entirely ... how do you work around the 
> issue of the linker using paths rather than names in NEEDED entries?
> Or does the issue not exist on OpenBSD?

This is an important issue.

CMake generates link command lines that refer to library files by path
rather than asking the linker to search with a -lfoo option.  This
approach ensures the expected library file is linked.  If the library
file has no DT_SONAME then some linkers put the path in DT_NEEDED.
For example, compare three commands for linking to a /path/to/libfoo.so
file that has no DT_SONAME:

 ====================================  ==============================
 Command Line                          Result
 ====================================  ==============================
 cc A.c -o A -L/path/to -lfoo          DT_NEEDED = libfoo.so
 cc B.c -o B /path/to/libfoo.so        DT_NEEDED = /path/to/libfoo.so
 cd /path && cc C.c -o C to/libfoo.so  DT_NEEDED = to/libfoo.so
 ====================================  ==============================

Therefore linking by path to a library requires that the library
have a DT_SONAME, or that the linker be modified to do something
else for DT_NEEDED.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to