Skip to content

Commit d56b720

Browse files
author
Tor Didriksen
committed
Bug #29641994 BACKPORT THE LIBRARY DEPENDENCY TO 5.7.25
This is a backport of the patch for: Bug#28378999 FIX LIBRARY DEPENDENCIES WHEN BUILDING ON SOLARIS Turns out there were lots of dependencies missing for our shared libraries. E.g. these were missing from libmysqlclient.so libstdc++.so.6 => /opt/developerstudio12.5/lib/compilers/CC-gcc/lib/sparcv9/libstdc++.so.6 libCrunG3.so.1 => /usr/lib/64/libCrunG3.so.1 Maintain explicit library dependencies for CMAKE_C_LINK_FLAGS CMAKE_CXX_LINK_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS QUOTED_CMAKE_CXX_LINK_FLAGS Change-Id: I7f1f9c7ece550cbfd28dcd938ecce0087214e851
1 parent 197d507 commit d56b720

File tree

4 files changed

+73
-47
lines changed

4 files changed

+73
-47
lines changed

CMakeLists.txt

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -125,6 +125,15 @@ ENDIF()
125125

126126
PROJECT(${MYSQL_PROJECT_NAME})
127127

128+
# STRING(APPEND ...) from cmake VERSION 3.4
129+
MACRO(STRING_APPEND STRING_VAR INPUT)
130+
SET(${STRING_VAR} "${${STRING_VAR}}${INPUT}")
131+
ENDMACRO()
132+
133+
MACRO(STRING_PREPEND STRING_VAR INPUT)
134+
SET(${STRING_VAR} "${INPUT}${${STRING_VAR}}")
135+
ENDMACRO()
136+
128137
SET(BUILD_IS_SINGLE_CONFIG TRUE)
129138
MESSAGE(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
130139
IF(CMAKE_GENERATOR MATCHES "Visual Studio" OR CMAKE_GENERATOR STREQUAL "Xcode")
@@ -189,6 +198,10 @@ ENDIF()
189198
INCLUDE(CheckTypeSize)
190199
CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
191200
MESSAGE(STATUS "SIZEOF_VOIDP ${SIZEOF_VOIDP}")
201+
# On some platforms, cmake may think that CMAKE_SIZEOF_VOID_P == 4
202+
# even if we have configured for 64bit build....
203+
SET(CMAKE_SIZEOF_VOID_P ${SIZEOF_VOIDP})
204+
192205
IF(WITH_DEFAULT_COMPILER_OPTIONS)
193206
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/build_configurations/compiler_options.cmake)
194207
ENDIF()

cmake/os/SunOS.cmake

+52-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,14 @@ INCLUDE(CheckCSourceRuns)
1818
INCLUDE(CheckCSourceCompiles)
1919
INCLUDE(CheckCXXSourceCompiles)
2020

21+
SET(SOLARIS 1)
22+
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
23+
SET(SOLARIS_SPARC 1)
24+
ENDIF()
25+
26+
INCLUDE(CheckTypeSize)
27+
CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
28+
2129
# We require at least GCC 7.3 or SunStudio 12.2 (CC 5.14)
2230
IF(NOT FORCE_UNSUPPORTED_COMPILER)
2331
IF(CMAKE_COMPILER_IS_GNUCC)
@@ -175,6 +183,48 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4
175183
ENDIF()
176184

177185
# This is used for the version_compile_machine variable.
178-
IF(CMAKE_SIZEOF_VOID_P MATCHES 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
186+
IF(SIZEOF_VOIDP MATCHES 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
179187
SET(MYSQL_MACHINE_TYPE "x86_64")
180188
ENDIF()
189+
190+
191+
MACRO(DIRNAME IN OUT)
192+
GET_FILENAME_COMPONENT(${OUT} ${IN} PATH)
193+
ENDMACRO()
194+
195+
# We assume that developer studio runtime libraries are installed.
196+
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
197+
CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
198+
DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH)
199+
200+
SET(LIBRARY_SUFFIX "lib/compilers/CC-gcc/lib")
201+
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
202+
SET(LIBRARY_SUFFIX "${LIBRARY_SUFFIX}/sparcv9")
203+
ENDIF()
204+
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
205+
SET(LIBRARY_SUFFIX "${LIBRARY_SUFFIX}/amd64")
206+
ENDIF()
207+
FIND_LIBRARY(STL_LIBRARY_NAME
208+
NAMES "stdc++"
209+
PATHS ${CXX_PATH}/../${LIBRARY_SUFFIX}
210+
NO_DEFAULT_PATH
211+
)
212+
MESSAGE(STATUS "STL_LIBRARY_NAME ${STL_LIBRARY_NAME}")
213+
IF(STL_LIBRARY_NAME)
214+
DIRNAME(${STL_LIBRARY_NAME} STL_LIBRARY_PATH)
215+
SET(LRFLAGS " -L${STL_LIBRARY_PATH} -R${STL_LIBRARY_PATH}")
216+
SET(QUOTED_CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
217+
218+
STRING_APPEND(CMAKE_C_LINK_FLAGS "${LRFLAGS}")
219+
STRING_APPEND(CMAKE_CXX_LINK_FLAGS "${LRFLAGS}")
220+
STRING_APPEND(CMAKE_MODULE_LINKER_FLAGS "${LRFLAGS}")
221+
STRING_APPEND(CMAKE_SHARED_LINKER_FLAGS "${LRFLAGS}")
222+
STRING_APPEND(QUOTED_CMAKE_CXX_LINK_FLAGS "${LRFLAGS}")
223+
ENDIF()
224+
225+
STRING_APPEND(CMAKE_C_LINK_FLAGS " -lc")
226+
STRING_APPEND(CMAKE_CXX_LINK_FLAGS " -lstdc++ -lgcc_s -lCrunG3 -lc")
227+
STRING_APPEND(CMAKE_MODULE_LINKER_FLAGS " -lstdc++ -lgcc_s -lCrunG3 -lc")
228+
STRING_APPEND(CMAKE_SHARED_LINKER_FLAGS " -lstdc++ -lgcc_s -lCrunG3 -lc")
229+
STRING_APPEND(QUOTED_CMAKE_CXX_LINK_FLAGS " -lstdc++ -lgcc_s -lCrunG3 -lc ")
230+
ENDIF()

configure.cmake

+1-40
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -81,45 +81,6 @@ int main()
8181
#endif
8282
}" HAVE_LLVM_LIBCPP)
8383

84-
MACRO(DIRNAME IN OUT)
85-
GET_FILENAME_COMPONENT(${OUT} ${IN} PATH)
86-
ENDMACRO()
87-
88-
89-
# We assume that developer studio runtime libraries are installed.
90-
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
91-
CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
92-
DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH)
93-
94-
SET(LIBRARY_SUFFIX "lib/compilers/CC-gcc/lib")
95-
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
96-
SET(LIBRARY_SUFFIX "${LIBRARY_SUFFIX}/sparcv9")
97-
ENDIF()
98-
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
99-
SET(LIBRARY_SUFFIX "${LIBRARY_SUFFIX}/amd64")
100-
ENDIF()
101-
FIND_LIBRARY(STL_LIBRARY_NAME
102-
NAMES "stdc++"
103-
PATHS ${CXX_PATH}/../${LIBRARY_SUFFIX}
104-
NO_DEFAULT_PATH
105-
)
106-
MESSAGE(STATUS "STL_LIBRARY_NAME ${STL_LIBRARY_NAME}")
107-
IF(STL_LIBRARY_NAME)
108-
DIRNAME(${STL_LIBRARY_NAME} STL_LIBRARY_PATH)
109-
SET(QUOTED_CMAKE_CXX_LINK_FLAGS
110-
"${CMAKE_CXX_LINK_FLAGS} -L${STL_LIBRARY_PATH} -R${STL_LIBRARY_PATH}")
111-
SET(CMAKE_CXX_LINK_FLAGS
112-
"${CMAKE_CXX_LINK_FLAGS} -L${STL_LIBRARY_PATH} -R${STL_LIBRARY_PATH}")
113-
SET(CMAKE_C_LINK_FLAGS
114-
"${CMAKE_C_LINK_FLAGS} -L${STL_LIBRARY_PATH} -R${STL_LIBRARY_PATH}")
115-
ENDIF()
116-
SET(CMAKE_C_LINK_FLAGS
117-
"${CMAKE_C_LINK_FLAGS} -lc")
118-
SET(CMAKE_CXX_LINK_FLAGS
119-
"${CMAKE_CXX_LINK_FLAGS} -lstdc++ -lgcc_s -lCrunG3 -lc")
120-
SET(QUOTED_CMAKE_CXX_LINK_FLAGS
121-
"${QUOTED_CMAKE_CXX_LINK_FLAGS} -lstdc++ -lgcc_s -lCrunG3 -lc ")
122-
ENDIF()
12384

12485
IF(CMAKE_COMPILER_IS_GNUCXX)
12586
IF (CMAKE_EXE_LINKER_FLAGS MATCHES " -static "

scripts/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -318,14 +318,16 @@ MACRO(EXTRACT_LINK_LIBRARIES target var)
318318
# Filter out "general", it is not a library, just CMake hint
319319
IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ")
320320
IF (lib MATCHES "^\\-l")
321-
SET(${var} "${${var}} ${lib} ")
321+
SET(${var} "${${var}} ${lib} ")
322+
ELSEIF (lib MATCHES "^\\-L")
323+
SET(${var} "${${var}} ${lib} ")
322324
ELSEIF(lib MATCHES "^/")
323325
# Full path, convert to just filename, strip "lib" prefix and extension
324326
GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
325327
STRING(REGEX REPLACE "^lib" "" lib "${lib}")
326-
SET(${var} "${${var}}-l${lib} " )
328+
SET(${var} "${${var}}-l${lib} " )
327329
ELSE()
328-
SET(${var} "${${var}}-l${lib} " )
330+
SET(${var} "${${var}}-l${lib} " )
329331
ENDIF()
330332
ENDIF()
331333
ENDFOREACH()

0 commit comments

Comments
 (0)