Problem Description
make
may be reported when building 061401e4cbb368
Building C object storage/myisam/CMakeFiles/myisam.dir/mi_rfirst.c.o
In file included from /path/to/mysql-5.7.35/storage/perfschema/cursor_by_account.cc:28:
In file included from /path/to/mysql-5.7.35/include/my_global.h:57:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/math.h:309:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/type_traits:417:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:37:
/path/to/mysql-5.7.35/version:1:1: error: expected unqualified-id
MYSQL_VERSION_MAJOR=5
^
/path/to/mysql-5.7.35/include/my_config.h:404:29: note: expanded from macro 'MYSQL_VERSION_MAJOR'
#define MYSQL_VERSION_MAJOR 5
^
Cause investigation
Through Homebrew's mysql@5.7.rb , I found a PATCH.
Find the answer in MySQL Commit record Bug #31466846 RENAME THE VERSION FILE TO MYSQL_VERSION
Bug #31466846 RENAME THE VERSION FILE TO MYSQL_VERSION
With new versions of boost, the build is broken on windows.
<version> is a header file which is part of C++11, but on win we
include our own VERSION instead, and the build breaks.
The solution is 'git mv VERSION MYSQL_VERSION', and adapt
cmake code accordingly.
Change-Id: I5211cf41fa83e879a25d4110dbb8933cd58da2f9
8.0
mysql-cluster-8.0.26 mysql-cluster-8.0.25 mysql-cluster-8.0.24 mysql-cluster-8.0.23 mysql-cluster-8.0.22 mysql-8.0.26 mysql-8.0.25 mysql-8.0.24 mysql-8.0.23 mysql-8.0.22
Tor Didriksen committed on 10 Jun 2020
1 parent 6653b43 commit 51675ddb41661163c23e802a3e5eedb1344ce023
Probably means:
version
isC++11
, but MySQL used to useVERSION
. When the file was imported, macOS did not distinguish between the case of the file, which caused a conflict, which caused an error to be interrupted during compilation.
In macOS Big Sur 11.5
SDK is MacOSX11.3.sdk
, indeed include
presence version
so header file:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/version
But in MacOSX11.1.sdk
and older versions, there is no such file.
For each version of the Mac SDK, you can refer to this project:
So the conditions for the problem are:
MacOSX11.1.sdk
MySQL 8.0.21
and older versions (including5.7.*
) in 061401e4cbb546 and below systems no problem ;MacOSX11.3.sdk
MySQL 8.0.22
and later versions in no problem ;- But
MacOSX11.3.sdk
and above compiledMySQL 8.0.21
and older versions (including5.7.*
time), have a problem ;
The SDK version is related to XCode
or xcode-select
.
You can determine the SDK version /Library/Developer/CommandLineTools/SDKs
solution
MySQL 8.0.22
and newer versions have been officially modified, but what about the old version? Just modify it in the official way.
Before executing cmake
, modify 2 places:
- File
VERSION
is renamed toMYSQL_VERSION
- 2 codes in file
cmake/mysql_version.cmake
VERSION
replaced withMYSQL_VERSION
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index 43d731e..3031258 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -31,7 +31,7 @@ SET(DOT_FRM_VERSION "6")
# Generate "something" to trigger cmake rerun when VERSION changes
CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/VERSION
+ ${CMAKE_SOURCE_DIR}/MYSQL_VERSION
${CMAKE_BINARY_DIR}/VERSION.dep
)
@@ -39,7 +39,7 @@ CONFIGURE_FILE(
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
- FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
+ FILE (STRINGS ${CMAKE_SOURCE_DIR}/MYSQL_VERSION str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
STRING(REGEX REPLACE "[ ].*" "" str "${str}")
Use the written script directly:
mv VERSION MYSQL_VERSION
sed -i '' 's|${CMAKE_SOURCE_DIR}/VERSION|${CMAKE_SOURCE_DIR}/MYSQL_VERSION|g' cmake/mysql_version.cmake
Reference
- Homebrew/homebrew-core/Formula/mysql@5.7.rb
- mysql/mysql-server@Bug #31466846 RENAME THE VERSION FILE TO MYSQL_VERSION
Thank you for reading, think the content is good, please like it 😆
Original address: https://shockerli.net/post/mysql-source-version-conflict-in-cpp-11/
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。