[cmake-developers] [CMake 0013884]: SONAME_FLAG incorrectly prefixed to libraries in link.txt & relink.txt, causes linker to fail

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 28 09:22:17 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13884 
====================================================================== 
Reported By:                Taoki
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13884
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2013-01-28 09:22 EST
Last Modified:              2013-01-28 09:22 EST
====================================================================== 
Summary:                    SONAME_FLAG incorrectly prefixed to libraries in
link.txt & relink.txt, causes linker to fail
Description: 
I discovered a major problem while configuring two C++ projects with cmake. When
Generating the configuration, cmake adds the word SONAME_FLAG before the name of
each library in link.txt and relink.txt once. This causes the linker to fail
when compiling with make. Here's the error I get with the OGRE engine:

c++: error: SONAME_FLAGlibOgreMain.so.1.9.0: No such file or directory
make[2]: *** [lib/libOgreMain.so.1.9.0] Error 1
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2

After hours of digging into the issue, I found where it happens and what goes
wrong. Here's the OGRE and libOgreMain example, but the problem happens with
each library of projects that are affected:

- After you generate your cmake configuration, open the file
.../OGRE/build/OgreMain/CMakeFiles/OgreMain.dir/link.txt

- Somewhere within this file, you will find the following part: -shared
SONAME_FLAGlibOgreMain.so.1.9.0

- To fix it, you must manually change that to: -shared
-Wl,-soname,libOgreMain.so.1.9.0

Steps to Reproduce: 
- Get the source of one of the projects affected by the issue. I only noticed it
with OGRE and PolyVox, other C++ codes work fine.

- Unpack it and run cmake (in my case I use cmake-gui). Specify "Unix makefiles"
with "Default native compilers". If the main folder is OGRE set the build folder
to OGRE/build. Leave all cmake options to their defaults and Configure then
Generate. Normally you should see no errors or warnings.

- Now go to OGRE/build and run "make". It will start to compile, but when it
gets to linking the first library you get the error: c++: error:
SONAME_FLAGlibWhatever.so.1.2.3: No such file or directory

Additional Information: 
Experienced with cmake 2.8.8. Operating system is Linux openSUSE 12.2 KDE 4.9.5.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-01-28 09:22 Taoki          New Issue                                    
======================================================================




More information about the cmake-developers mailing list