MantisBT - CMake
View Issue Details
0012954CMakeCMakepublic2012-02-10 19:442012-09-03 16:02
Eric Anderson 
Brad King 
normalmajoralways
closedfixed 
i386OpenBSD5.0
CMake 2.8.4 
CMake 2.8.8CMake 2.8.8 
0012954: cmake does not properly detect shared libraries on OpenBSD 5.0
cmake does not properly detect shared libraries on OpenBSD 5.0.

Shared libraries on that platform always end in .so.#.#

When detecting shared libraries, cmake only considers files that end in .so

Therefore in cmComputeLinkInformation::AddLibraryRuntimeInfo, libraries will not be considered for adding rpath information.

Simplest fix is to put:

    LIST(APPEND CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES .so.[0-9]+.[0-9]+)

Into some module, e.g. OpenBSD.cmake; there may be a better fix. I also tried CMAKE_SHARED_LIBRARY_SUFFIX, but that caused shared libraries to not build.
Put a required shared library in a non-standard path.

Setup cmake to include the rpath in the build tree:

SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

Add a target that depends on that non-standard path

Build the target

Run ldd on the built executable (or try to execute it), it will fail to link to the special path.

Note that if you set CMAKE_INSTALL_RPATH to include the non-standard path, the installed binary will work fine.

      

No tags attached.
patch 16b1a6e4+0001-Recognize-OpenBSD-versioned-.so-names-12954.patch (2,069) 2012-02-13 10:37
https://public.kitware.com/Bug/file/4218/16b1a6e4%2B0001-Recognize-OpenBSD-versioned-.so-names-12954.patch
Issue History
2012-02-10 19:44Eric AndersonNew Issue
2012-02-13 10:37Brad KingAssigned To => Brad King
2012-02-13 10:37Brad KingStatusnew => assigned
2012-02-13 10:37Brad KingFile Added: 16b1a6e4+0001-Recognize-OpenBSD-versioned-.so-names-12954.patch
2012-02-13 10:37Brad KingNote Added: 0028573
2012-02-13 19:00Eric AndersonNote Added: 0028581
2012-02-14 10:10Brad KingNote Added: 0028584
2012-02-14 10:10Brad KingStatusassigned => resolved
2012-02-14 10:10Brad KingFixed in Version => CMake 2.8.8
2012-02-14 10:10Brad KingResolutionopen => fixed
2012-04-19 15:50David ColeTarget Version => CMake 2.8.8
2012-09-03 16:02David ColeNote Added: 0030881
2012-09-03 16:02David ColeStatusresolved => closed

Notes
(0028573)
Brad King   
2012-02-13 10:37   
Please build CMake from source with attached patch

 16b1a6e4+0001-Recognize-OpenBSD-versioned-.so-names-12954.patch

to test it.
(0028581)
Eric Anderson   
2012-02-13 19:00   
Patch works fine, I tested on cmake-2.8.4 since that happens to be the version that ships with openbsd. I also verified that the workaround I showed above works with the patched cmake so I can have files that work with unpatched versions.

Thanks for working out the correct patch.
(0028584)
Brad King   
2012-02-14 10:10   
Applied, thanks for testing:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afc75bb7 [^]
(0030881)
David Cole   
2012-09-03 16:02   
Closing resolved issues that have not been updated in more than 4 months.