View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015673CMakeCMakepublic2015-07-30 11:582016-01-04 11:51
ReporterXan López 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.2.3 
Target VersionCMake 3.4Fixed in VersionCMake 3.4 
Summary0015673: CMAKE_C_COMPILER is used to link a CXX shared library on Solaris
DescriptionThe 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.
TagsNo tags attached.
Attached Filespatch file icon 0001-SunOS-use-CXX-compiler-to-link-CXX-shared-libraries.patch [^] (1,095 bytes) 2015-07-30 11:58 [Show Content]
patch file icon 0001-SunOS-drop-special-case-to-link-shared-libraries.patch [^] (1,235 bytes) 2015-07-30 14:10 [Show Content]

 Relationships

  Notes
(0039202)
Brad King (manager)
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 (reporter)
2015-07-30 14:10

Yep, you are right, removing the whole thing has the same effect. Updated patch attached.
(0039206)
Brad King (manager)
2015-07-30 14:24

Thanks for testing. Actually I already had the commit ready on a branch locally. I've now pushed it out:

 SunOS: Drop special case for linking C++ shared libraries with gcc
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60fe4b54 [^]
(0040100)
Robert Maynard (manager)
2016-01-04 11:51

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

 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
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


Copyright © 2000 - 2018 MantisBT Team