MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0015673 | CMake | CMake | public | 2015-07-30 11:58 | 2016-01-04 11:51 |
|
Reporter | Xan López | |
Assigned To | Brad King | |
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | CMake 3.2.3 | |
Target Version | CMake 3.4 | Fixed in Version | CMake 3.4 | |
|
Summary | 0015673: CMAKE_C_COMPILER is used to link a CXX shared library on Solaris |
Description | The SunOS.cmake file has the following:
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
The end result is that CMAKE_C_COMPILER (gcc) is used to link C++ shared libraries in Solaris. This results in numerous errors. I assume this is just a typo, and the attached patch just fixes things for me.
This can be reproduced 100% of the time trying to compile LLVM/clang from SVN HEAD, LTO and clang libs will fail to compile. |
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | 0001-SunOS-use-CXX-compiler-to-link-CXX-shared-libraries.patch (1,095) 2015-07-30 11:58 https://public.kitware.com/Bug/file/5496/0001-SunOS-use-CXX-compiler-to-link-CXX-shared-libraries.patch
0001-SunOS-drop-special-case-to-link-shared-libraries.patch (1,235) 2015-07-30 14:10 https://public.kitware.com/Bug/file/5498/0001-SunOS-drop-special-case-to-link-shared-libraries.patch |
|
Issue History |
Date Modified | Username | Field | Change |
2015-07-30 11:58 | Xan López | New Issue | |
2015-07-30 11:58 | Xan López | File Added: 0001-SunOS-use-CXX-compiler-to-link-CXX-shared-libraries.patch | |
2015-07-30 13:56 | Brad King | Note Added: 0039202 | |
2015-07-30 13:56 | Brad King | Assigned To | => Brad King |
2015-07-30 13:56 | Brad King | Status | new => assigned |
2015-07-30 13:56 | Brad King | Target Version | => CMake 3.4 |
2015-07-30 13:58 | Brad King | Note Edited: 0039202 | bug_revision_view_page.php?bugnote_id=39202#r1854 |
2015-07-30 14:10 | Xan López | Note Added: 0039203 | |
2015-07-30 14:10 | Xan López | File Added: 0001-SunOS-drop-special-case-to-link-shared-libraries.patch | |
2015-07-30 14:24 | Brad King | Note Added: 0039206 | |
2015-07-30 14:24 | Brad King | Status | assigned => resolved |
2015-07-30 14:24 | Brad King | Resolution | open => fixed |
2015-07-30 14:24 | Brad King | Fixed in Version | => CMake 3.4 |
2016-01-04 11:51 | Robert Maynard | Note Added: 0040100 | |
2016-01-04 11:51 | Robert Maynard | Status | resolved => closed |
Notes |
|
(0039202)
|
Brad King
|
2015-07-30 13:56
(edited on: 2015-07-30 13:58) |
|
It was not a typo. The change was first made here:
... Just use gcc -shared, even for C++ libraries.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=284071e3 [^]
IIRC at the time g++ did not know how to link shared libraries on Sun. I'm sure that has long since been fixed so we can probably just drop the whole special case. Please try:
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index aaa79c4..77946f2 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -7,14 +7,6 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
endif()
-if(CMAKE_COMPILER_IS_GNUCXX)
- if(CMAKE_COMPILER_IS_GNUCC)
- set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>
<SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
- else()
- # Take default rule from CMakeDefaultMakeRuleVariables.cmake.
- endif()
-endif()
include(Platform/UnixPaths)
# Add the compiler's implicit link directories.
|
|
|
(0039203)
|
Xan López
|
2015-07-30 14:10
|
|
Yep, you are right, removing the whole thing has the same effect. Updated patch attached. |
|
|
(0039206)
|
Brad King
|
2015-07-30 14:24
|
|
|
|
(0040100)
|
Robert Maynard
|
2016-01-04 11:51
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|