View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013884CMakeCMakepublic2013-01-28 09:222013-06-03 09:05
ReporterTaoki 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformIntelOSLinux openSUSEOS Version12.2
Product VersionCMake 2.8.8 
Target VersionFixed in Version 
Summary0013884: SONAME_FLAG incorrectly prefixed to libraries in link.txt & relink.txt, causes linker to fail
DescriptionI 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 InformationExperienced with cmake 2.8.8. Operating system is Linux openSUSE 12.2 KDE 4.9.5.
Tagsc++, gcc, link, linker, linux, make, makefile, relink, unix
Attached Files

 Relationships

  Notes
(0032174)
Brad King (manager)
2013-01-29 13:46

The SONAME_FLAG rule variable placeholder was added in CMake 2.8.9 here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1409ac5 [^]

and is not available in 2.8.8. Since the source code to CMake 2.8.8 doesn't even mention it the string must be coming from the project itself. I suspect these projects are trying to use custom link rule variables without updating their minimum required version of CMake to a sufficiently new version to have the features they use.
(0032175)
Taoki (reporter)
2013-01-29 14:05

Ah... so it's because the projects are optimized for Cmake 2.8.9 and I'm still using 2.8.8 which doesn't recognize the flag? Good to know. I have 2.8.8 because my distribution didn't update it in its repositories... might be a good idea to ask them to do so, since it sounds like this is a needed update.
(0033194)
Robert Maynard (manager)
2013-06-03 09:05

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-01-28 09:22 Taoki New Issue
2013-01-28 09:22 Taoki Tag Attached: linker
2013-01-28 09:23 Taoki Tag Attached: c++
2013-01-28 09:23 Taoki Tag Attached: gcc
2013-01-28 09:23 Taoki Tag Attached: make
2013-01-28 09:23 Taoki Tag Attached: makefile
2013-01-28 09:23 Taoki Tag Attached: link
2013-01-28 09:23 Taoki Tag Attached: relink
2013-01-28 09:23 Taoki Tag Attached: unix
2013-01-28 09:23 Taoki Tag Attached: linux
2013-01-29 13:46 Brad King Note Added: 0032174
2013-01-29 14:05 Taoki Note Added: 0032175
2013-01-29 14:53 Brad King Status new => resolved
2013-01-29 14:53 Brad King Resolution open => no change required
2013-06-03 09:05 Robert Maynard Note Added: 0033194
2013-06-03 09:05 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team