MantisBT - CMake
View Issue Details
0016135CMakeCMakepublic2016-06-03 12:472016-06-10 14:21
Michał Górny 
Brad King 
normalminoralways
closedfixed 
SunOSopenindiana5.11
CMake 3.5.2 
CMake 3.7CMake 3.7 
0016135: RPATH linker flags no longer set correctly for SunOS PathScale compiler since cmake 3.1
We've recently upgraded CMake and noticed that our project stopped building correctly. After timesome debugging, I've found out that after CMake upgrade, CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG is no longer set correctly. This happens on SunOS-5 system with PathScale compiler in use, and it started to happen in cmake-3.1.

It looks that the correct linker flags are being set in two modules: Platform/SunOS.cmake and Platform/SunOS-GNU.cmake.

The former of the files does not apply the linker flags since it is restricted to apply to SunOS-4 only.

The latter of the files used to apply before cmake-3.1. However, since cmake-3.1 it is no longer used when PathScale compiler is in use.
1. Download PathScale compiler (http://www.pathscale.com/ekopath-compiler-suite [^]),

2. echo 'message(FATAL_ERROR "${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}")' > CMakeLists.txt

3. cmake . -DCMAKE_C_COMPILER=/opt/ekopath/bin/pathcc

With cmake-3.0.2 and older, it will print: -Wl,-R

With cmake-3.1.3 and newer, it will print an empty string
This probably could be fixed two ways: either by applying the 'GNU' rules for PathScale compiler, or by extending the SunOS rules to SunOS-5. I don't know which one is more correct here.
No tags attached.
patch 0001-Platform-add-flag-definitions-for-PathScale-compiler.patch (3,160) 2016-06-05 15:31
https://public.kitware.com/Bug/file/5699/0001-Platform-add-flag-definitions-for-PathScale-compiler.patch
Issue History
2016-06-03 12:47Michał GórnyNew Issue
2016-06-03 12:54Michał GórnyNote Added: 0041133
2016-06-03 13:26Brad KingNote Added: 0041134
2016-06-05 15:31Michał GórnyFile Added: 0001-Platform-add-flag-definitions-for-PathScale-compiler.patch
2016-06-05 15:33Michał GórnyNote Added: 0041136
2016-06-06 09:00Brad KingNote Added: 0041138
2016-06-06 09:00Brad KingAssigned To => Brad King
2016-06-06 09:00Brad KingStatusnew => resolved
2016-06-06 09:00Brad KingResolutionopen => fixed
2016-06-06 09:00Brad KingFixed in Version => CMake 3.7
2016-06-06 09:00Brad KingTarget Version => CMake 3.7
2016-06-10 14:21Kitware RobotNote Added: 0041157
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0041133)
Michał Górny   
2016-06-03 12:54   
Ok, the non-GNU rules can't be used since they pass wrong flags like -PIC.
(0041134)
Brad King   
2016-06-03 13:26   
Currently we have:

$ ls Modules/Platform/SunOS*
Modules/Platform/SunOS.cmake
Modules/Platform/SunOS-GNU-C.cmake
Modules/Platform/SunOS-GNU.cmake
Modules/Platform/SunOS-GNU-CXX.cmake
Modules/Platform/SunOS-GNU-Fortran.cmake

One will need to create equivalents to the SunOS-GNU* modules for SunOS-PathScale*, just as we already have Linux-PathScale*.
(0041136)
Michał Górny   
2016-06-05 15:33   
Thank you for your explanation. I have written and tested modules based on Linux-PathScale and SunOS, and attached a patch adding them.

Is there any chance this fix could go into 3.6? It'd be really great to be able to have PathScale compiler working with the next CMake release.
(0041138)
Brad King   
2016-06-06 09:00   
Thanks, I've applied the patch:

 Platform: add flag definitions for PathScale compiler on SunOS
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcfe121f [^]

I've also queued it for merge to 'release' for inclusion in 3.6.0-rc2.
(0041157)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.