一个人是否信守承诺,往往鲜明地反映和预示着他的为人风范、精神品位和生活艺术的优劣,以及未来的人生走向。
了解一个产品的最好的方法,就是阅读它的源码!
本人不是很聪明,也不是什么大牛,一出来就接触到什么牛逼产品开发!
生活所迫,没办法!需要oracle,就努力研究oracle。如今主流mysql数据库,为了深入了解其中原理,只能去死磕一下源码!
1,基本环境
cmake软件:
bison软件:
mysql5.7源码包,官网下载,下载指定source code:
2,初始化下载bootst
在源码包中创建BLD目录,cmd进入源码包目录:
C:\WINDOWS\system32>cd F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD
cmake(windows 64位,需要指定 -G "Visual Studio 12 Win64"参数),bootst也可以自己下载。
F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD>cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="F:\数据库资料\mysql\源码包\mysql-5.7.27\boost" -G "Visual Studio 12 Win64"
cmake日志如下:
F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD>cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="F:\数据库资料\mysql\源码包\mysql-5.7.27\boost" -G "Visual Studio 12 Win64"
CMake Deprecation Warning at CMakeLists.txt:28 (CMAKE_POLICY):
The OLD behavior for policy CMP0018 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:34 (CMAKE_POLICY):
The OLD behavior for policy CMP0022 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:41 (CMAKE_POLICY):
The OLD behavior for policy CMP0045 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:42 (CMAKE_POLICY):
The OLD behavior for policy CMP0042 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Running cmake version 3.13.2
-- Found Git: E:/Program Files (x86)/Git/cmd/git.exe (found version "2.21.0.windows.1")
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_GENERATOR: Visual Studio 12 2013 Win64
-- Looking for sys/types.h
CMake Warning (dev) at E:/program files/CMake/share/cmake-3.13/Modules/CheckIncludeFile.cmake:70 (message):
Policy CMP0075 is not set: Include file check macros honor
CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
CMAKE_REQUIRED_LIBRARIES is set to:
ws2_32
For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
E:/program files/CMake/share/cmake-3.13/Modules/CheckTypeSize.cmake:225 (check_include_file)
CMakeLists.txt:199 (CHECK_TYPE_SIZE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- SIZEOF_VOIDP 8
-- MySQL 5.7.27
-- Packaging as: mysql-5.7.27-winx64
-- Downloading boost_1_59_0.tar.gz to F:/数据库资料/mysql/源码包/mysql-5.7.27/boost
-- [download 100% complete]
-- [download 86% complete]
-- [download 100% complete]
-- [download 0% complete]
-- [download 1% complete]
-- [download 2% complete]
-- [download 3% complete]
-- [download 4% complete]
-- [download 5% complete]
-- [download 6% complete]
-- [download 7% complete]
-- [download 8% complete]
-- [download 9% complete]
-- [download 10% complete]
-- [download 11% complete]
-- [download 12% complete]
-- [download 13% complete]
-- [download 14% complete]
-- [download 15% complete]
-- [download 16% complete]
-- [download 17% complete]
-- [download 18% complete]
-- [download 19% complete]
-- [download 20% complete]
-- [download 21% complete]
-- [download 22% complete]
-- [download 23% complete]
-- [download 24% complete]
-- [download 25% complete]
-- [download 26% complete]
-- [download 27% complete]
-- [download 28% complete]
-- [download 29% complete]
-- [download 30% complete]
-- [download 31% complete]
-- [download 32% complete]
-- [download 33% complete]
-- [download 34% complete]
-- [download 35% complete]
-- [download 36% complete]
-- [download 37% complete]
-- [download 38% complete]
-- [download 39% complete]
-- [download 40% complete]
-- [download 41% complete]
-- [download 42% complete]
-- [download 43% complete]
-- [download 44% complete]
-- [download 45% complete]
-- [download 46% complete]
-- [download 47% complete]
-- [download 48% complete]
-- [download 49% complete]
-- [download 50% complete]
-- [download 51% complete]
-- [download 52% complete]
-- [download 53% complete]
-- [download 54% complete]
-- [download 55% complete]
-- [download 56% complete]
-- [download 57% complete]
-- [download 58% complete]
-- [download 59% complete]
-- [download 60% complete]
-- [download 61% complete]
-- [download 62% complete]
-- [download 63% complete]
-- [download 64% complete]
-- [download 65% complete]
-- [download 66% complete]
-- [download 67% complete]
-- [download 68% complete]
-- [download 69% complete]
-- [download 70% complete]
-- [download 71% complete]
-- [download 72% complete]
-- [download 73% complete]
-- [download 74% complete]
-- [download 75% complete]
-- [download 76% complete]
-- [download 77% complete]
-- [download 78% complete]
-- [download 79% complete]
-- [download 80% complete]
-- [download 81% complete]
-- [download 82% complete]
-- [download 83% complete]
-- [download 84% complete]
-- [download 85% complete]
-- [download 86% complete]
-- [download 87% complete]
-- [download 88% complete]
-- [download 89% complete]
-- [download 90% complete]
-- [download 91% complete]
-- [download 92% complete]
-- [download 93% complete]
-- [download 94% complete]
-- [download 95% complete]
-- [download 96% complete]
-- [download 97% complete]
-- [download 98% complete]
-- [download 99% complete]
-- [download 100% complete]
-- cd F:/数据库资料/mysql/源码包/mysql-5.7.27/boost; tar xfz F:/数据库资料/mysql/源码包/mysql-5.7.27/boost/boost_1_59_0.tar.gz
-- Found F:/数据库资料/mysql/源码包/mysql-5.7.27/boost/boost_1_59_0/boost/version.hpp
-- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105900
-- BOOST_INCLUDE_DIR F:/数据库资料/mysql/源码包/mysql-5.7.27/boost/boost_1_59_0
-- Found Threads: TRUE
-- Looking for include file crypt.h
-- Looking for include file crypt.h - not found
-- Looking for getnameinfo
-- Looking for getnameinfo - found
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- Looking for log2
-- Looking for log2 - found
-- Looking for isinf
-- Looking for isinf - found
-- Performing Test HAVE_CXX_ISINF
-- Performing Test HAVE_CXX_ISINF - Success
-- Check size of struct timespec
-- Check size of struct timespec - failed
-- Performing Test HAVE_VISIBILITY_HIDDEN
-- Performing Test HAVE_VISIBILITY_HIDDEN - Success
-- Check size of struct sockaddr_in6
-- Check size of struct sockaddr_in6 - done
-- Check size of struct in6_addr
-- Check size of struct in6_addr - done
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING - Success
-- Looking for chown
-- Looking for chown - not found
-- Looking for include file numa.h
-- Looking for include file numa.h - not found
-- Looking for include file numaif.h
-- Looking for include file numaif.h - not found
-- NUMA library missing or required version not available
-- Check size of socklen_t
-- Check size of socklen_t - failed
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Performing Test HAVE_STRINGOP_OVERFLOW
-- Performing Test HAVE_STRINGOP_OVERFLOW - Failed
-- Performing Test HAVE_NO_UNUSED_CONST_VAR
-- Performing Test HAVE_NO_UNUSED_CONST_VAR - Failed
-- Found Git: E:/Program Files (x86)/Git/cmd/git.exe
-- Looking for __GNU_LIBRARY__
-- Looking for __GNU_LIBRARY__ - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - not found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - not found
-- Looking for netinet/in6.h
-- Looking for netinet/in6.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for netdb.h
-- Looking for netdb.h - not found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - not found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - not found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for poll.h
-- Looking for poll.h - not found
-- Looking for port.h
-- Looking for port.h - not found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for stdarg.h
-- Looking for stdarg.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/devpoll.h
-- Looking for sys/devpoll.h - not found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - not found
-- Looking for sys/eventfd.h
-- Looking for sys/eventfd.h - not found
-- Looking for sys/event.h
-- Looking for sys/event.h - not found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - not found
-- Looking for sys/param.h
-- Looking for sys/param.h - not found
-- Looking for sys/queue.h
-- Looking for sys/queue.h - not found
-- Looking for sys/select.h
-- Looking for sys/select.h - not found
-- Looking for sys/sendfile.h
-- Looking for sys/sendfile.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for sys/uio.h
-- Looking for sys/uio.h - not found
-- Looking for include files sys/types.h, ifaddrs.h
-- Looking for include files sys/types.h, ifaddrs.h - not found
-- Looking for mach/mach_time.h
-- Looking for mach/mach_time.h - not found
-- Looking for netinet/tcp.h
-- Looking for netinet/tcp.h - not found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - not found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - not found
-- Looking for sys/sysctl.h
-- Looking for sys/sysctl.h - not found
-- Looking for sys/timerfd.h
-- Looking for sys/timerfd.h - not found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for epoll_create
-- Looking for epoll_create - not found
-- Looking for epoll_ctl
-- Looking for epoll_ctl - not found
-- Looking for eventfd
-- Looking for eventfd - not found
-- Looking for clock_gettime
-- Looking for clock_gettime - not found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for getaddrinfo
-- Looking for getaddrinfo - found
-- Looking for getnameinfo
-- Looking for getnameinfo - found
-- Looking for gettimeofday
-- Looking for gettimeofday - not found
-- Looking for getprotobynumber
-- Looking for getprotobynumber - found
-- Looking for getservbyname
-- Looking for getservbyname - found
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- Looking for inet_pton
-- Looking for inet_pton - found
-- Looking for kqueue
-- Looking for kqueue - not found
-- Looking for mmap
-- Looking for mmap - not found
-- Looking for pipe
-- Looking for pipe - not found
-- Looking for pipe2
-- Looking for pipe2 - not found
-- Looking for poll
-- Looking for poll - not found
-- Looking for port_create
-- Looking for port_create - not found
-- Looking for sendfile
-- Looking for sendfile - not found
-- Looking for sigaction
-- Looking for sigaction - not found
-- Looking for signal
-- Looking for signal - not found
-- Looking for splice
-- Looking for splice - not found
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for strsep
-- Looking for strsep - not found
-- Looking for strtok_r
-- Looking for strtok_r - not found
-- Looking for strtoll
-- Looking for strtoll - found
-- Looking for vasprintf
-- Looking for vasprintf - not found
-- Looking for sysctl
-- Looking for sysctl - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for arc4random_buf
-- Looking for arc4random_buf - not found
-- Looking for epoll_create1
-- Looking for epoll_create1 - not found
-- Looking for getegid
-- Looking for getegid - not found
-- Looking for geteuid
-- Looking for geteuid - not found
-- Looking for getifaddrs
-- Looking for getifaddrs - not found
-- Looking for issetugid
-- Looking for issetugid - not found
-- Looking for mach_absolute_time
-- Looking for mach_absolute_time - not found
-- Looking for nanosleep
-- Looking for nanosleep - not found
-- Looking for usleep
-- Looking for usleep - not found
-- Looking for timeradd
-- Looking for timeradd - not found
-- Looking for timerclear
-- Looking for timerclear - not found
-- Looking for timercmp
-- Looking for timercmp - not found
-- Looking for timerfd_create
-- Looking for timerfd_create - not found
-- Looking for timerisset
-- Looking for timerisset - not found
-- Looking for putenv
-- Looking for putenv - found
-- Looking for setenv
-- Looking for setenv - not found
-- Looking for setrlimit
-- Looking for setrlimit - not found
-- Looking for umask
-- Looking for umask - not found
-- Looking for unsetenv
-- Looking for unsetenv - not found
-- Looking for gethostbyname_r
-- Looking for gethostbyname_r - not found
-- Check size of uint8_t
-- Check size of uint8_t - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of uint64_t
-- Check size of uint64_t - done
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of unsigned
-- Check size of unsigned - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of long
-- Check size of long - done
-- Check size of long long
-- Check size of long long - done
-- Performing Test HAVE_INLINE
-- Performing Test HAVE_INLINE - Failed
-- Looking for TAILQ_FOREACH
-- Looking for TAILQ_FOREACH - not found
-- Looking for CTL_KERN
-- Looking for CTL_KERN - not found
-- Looking for KERN_ARND
-- Looking for KERN_ARND - not found
-- Looking for KERN_RANDOM
-- Looking for KERN_RANDOM - not found
-- Looking for RANDOM_UUID
-- Looking for RANDOM_UUID - not found
-- Looking for F_SETFD
-- Looking for F_SETFD - not found
-- Check size of fd_mask
-- Check size of fd_mask - failed
-- Check size of size_t
-- Check size of size_t - done
-- Check size of off_t
-- Check size of off_t - done
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Check size of SSIZE_T
-- Check size of SSIZE_T - done
-- Check size of socklen_t
-- Check size of socklen_t - done
-- Check size of pid_t
-- Check size of pid_t - failed
-- Check size of pthread_t
-- Check size of pthread_t - failed
-- Check size of uintptr_t
-- Check size of uintptr_t - done
-- Check size of void *
-- Check size of void * - done
-- Performing Test EVENT__HAVE_WAITPID_WITH_WNOWAIT
-- Performing Test EVENT__HAVE_WAITPID_WITH_WNOWAIT - Failed
-- Looking for _MINIX
-- Looking for _MINIX - not found
-- Looking for _POSIX_1_SOURCE
-- Looking for _POSIX_1_SOURCE - not found
-- Looking for _POSIX_SOURCE
-- Looking for _POSIX_SOURCE - not found
-- Check size of struct addrinfo
-- Check size of struct addrinfo - done
-- Check size of struct in6_addr
-- Check size of struct in6_addr - done
-- Performing Test EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16
-- Performing Test EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 - Failed
-- Performing Test EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32
-- Performing Test EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 - Failed
-- Check size of sa_family_t
-- Check size of sa_family_t - failed
-- Check size of struct sockaddr_in6
-- Check size of struct sockaddr_in6 - done
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN - Failed
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - Failed
-- Check size of struct sockaddr_storage
-- Check size of struct sockaddr_storage - done
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY - Success
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
-- Performing Test EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY - Failed
-- LIBEVENT_INCLUDE_DIRS F:/数据库资料/mysql/源码包/mysql-5.7.27/extra/libevent/include;F:/数据库资料/mysql/源码包/mysql-5.7.27/BLD/extra/libevent/include
-- LIBEVENT_LIBRARIES event
-- Cannot find system sasl libraries.
-- WITH_PROTOBUF=bundled
-- Performing Test HAVE_NO_SIGN_COMPARE
-- Performing Test HAVE_NO_SIGN_COMPARE - Failed
-- Performing Test HAVE_NO_UNUSED_TYPEDEFS
-- Performing Test HAVE_NO_UNUSED_TYPEDEFS - Failed
-- Performing Test HAVE_NO_IGNORED_QUALIFIERS
-- Performing Test HAVE_NO_IGNORED_QUALIFIERS - Failed
-- Performing Test HAVE_NO_RETURN_TYPE
-- Performing Test HAVE_NO_RETURN_TYPE - Failed
-- Performing Test HAVE_NO_UNUSED_FUNCTION
-- Performing Test HAVE_NO_UNUSED_FUNCTION - Failed
-- Performing Test HAVE_MAYBE_UNINITIALIZED
-- Performing Test HAVE_MAYBE_UNINITIALIZED - Failed
-- Performing Test HAVE_UNUSED_BUT_SET
-- Performing Test HAVE_UNUSED_BUT_SET - Failed
-- protobuf version is 2.6
-- Performing Test HAVE_SYS_THREAD_SELFID
-- Performing Test HAVE_SYS_THREAD_SELFID - Failed
-- Performing Test HAVE_SYS_GETTID
-- Performing Test HAVE_SYS_GETTID - Failed
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Performing Test HAVE_INTEGER_PTHREAD_SELF
-- Performing Test HAVE_INTEGER_PTHREAD_SELF - Failed
-- Performing Test HAVE_STRINGOP_TRUNCATION
-- Performing Test HAVE_STRINGOP_TRUNCATION - Failed
-- Creating LDAP authentication SASL client library.
-- You need to set WITH_SASL path to build LDAP SASL client authentication plugin.
-- Library mysqlclient depends on OSLIBS ws2_32;Secur32
-- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlclient
-- MERGE_CONVENIENCE_LIBRARIES LIBS clientlib;dbug;strings;vio;mysys;mysys_ssl;zlib;yassl;taocrypt;auth_win_client
-- MERGE_CONVENIENCE_LIBRARIES MYLIBS clientlib;dbug;strings;vio;mysys;mysys_ssl;zlib;yassl;taocrypt;auth_win_client
-- Looking for include file endian.h
-- Looking for include file endian.h - not found
-- Check size of long long
-- Check size of long long - done
-- Check size of long
-- Check size of long - done
-- Check size of int
-- Check size of int - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Performing Test HAVE_CAST_FUNCTION_TYPE
-- Performing Test HAVE_CAST_FUNCTION_TYPE - Failed
-- Using cmake version 3.13.2
-- Not building NDB
-- Performing Test HAVE_UNUSED_TYPEDEFS
-- Performing Test HAVE_UNUSED_TYPEDEFS - Failed
-- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN
-- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN - Failed
-- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME
-- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME - Failed
-- Performing Test HAVE_XDR_OPS_X_PUTINT32
-- Performing Test HAVE_XDR_OPS_X_PUTINT32 - Success
-- Performing Test HAVE_XDR_OPS_X_GETINT32
-- Performing Test HAVE_XDR_OPS_X_GETINT32 - Success
-- Performing Test HAVE___CONST
-- Performing Test HAVE___CONST - Success
-- Performing Test HAVE_RPC_INLINE_T
-- Performing Test HAVE_RPC_INLINE_T - Failed
-- Using Boost headers from F:/数据库资料/mysql/源码包/mysql-5.7.27/boost/boost_1_59_0
-- Performing Test CXX_HAVE_SIGN_COMPARE
-- Performing Test CXX_HAVE_SIGN_COMPARE - Failed
-- Performing Test CXX_HAVE_UNUSED_VARIABLE
-- Performing Test CXX_HAVE_UNUSED_VARIABLE - Failed
-- MYSQLX - Text log of protobuf messages enabled
-- Performing Test HAVE_UNUSED_PARAMETER
-- Performing Test HAVE_UNUSED_PARAMETER - Failed
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
-- Performing Test HAVE_MISLEADING_INDENTATION
-- Performing Test HAVE_MISLEADING_INDENTATION - Failed
-- Performing Test HAVE_NO_BUILTIN_MEMCMP
-- Performing Test HAVE_NO_BUILTIN_MEMCMP - Success
-- executable target mysqld debug_target F:/数据库资料/mysql/源码包/mysql-5.7.27/BLD/sql/Debug/mysqld.exe
-- Library mysqlserver depends on OSLIBS ws2_32
-- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlserver
-- MERGE_CONVENIENCE_LIBRARIES LIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser;sql_embedded
-- MERGE_CONVENIENCE_LIBRARIES MYLIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser;sql_embedded
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files/WiX Toolset V3.8
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files/WiX Toolset V3.8/bin
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files (x86)/WiX Toolset V3.8
-- WIX_DIR WIX_DIR-NOTFOUND path C:\Program Files (x86)/WiX Toolset V3.8/bin
-- WIX_DIR WIX_DIR-NOTFOUND looked at
-- Cannot find wix 3, installer project will not be generated
-- COMPILE_DEFINITIONS: _WIN32_WINNT=0x0601;WIN32_LEAN_AND_MEAN;NOGDI;NOMINMAX;HAVE_CONFIG_H;HAVE_LIBEVENT2
-- CMAKE_C_FLAGS: /DWIN32 /D_WINDOWS /W3 /MP /wd4800 /wd4805 /wd4996
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP /wd4800 /wd4805 /wd4996 /we4099
-- CMAKE_C_LINK_FLAGS:
-- CMAKE_CXX_LINK_FLAGS:
-- CMAKE_C_FLAGS_DEBUG: /MDd /Z7 /Ob1 /Od /RTC1 /EHsc -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- CMAKE_CXX_FLAGS_DEBUG: /MDd /Z7 /Ob1 /Od /RTC1 /EHsc -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- CMAKE_C_FLAGS_RELWITHDEBINFO: /MD /Z7 /O2 /Ob1 /DNDEBUG /EHsc -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: /MD /Z7 /O2 /Ob1 /DNDEBUG /EHsc -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: F:/数据库资料/mysql/源码包/mysql-5.7.27/BLD
3,修改配置
修改sql/sql_locale.cc编码格式,文件另存为UTF-8格式(其他文件还有:源码目录\strings\ctype-czech.c ;源码目录\strings\ctype-latin1.c ;源码目录\strings\decimal.c ;源码目录\mysys\thr_mutex.c ;源码目录\storage\innobase\include\ut0mem.h; 源码目录\sql\sql_locale.cc)
4,编译
F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD>cmake --build . --config relwithdebinfo --target package
编译成功!(由于日志太多,就只贴出结尾一部分日志)
”,可能丢失数据 [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\storage\perfschema\unittest\pfs-t.vcxproj]
F:\数据库资料\mysql\源码包\mysql-5.7.27\storage\perfschema\pfs_buffer_container.h(987): warning C4244: “初始化”: 从“__int64”转换到“u
int”,可能丢失数据 [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\storage\perfschema\unittest\pfs-t.vcxproj]
F:\数据库资料\mysql\源码包\mysql-5.7.27\storage\perfschema\pfs_buffer_container.h(999): warning C4267: “=”: 从“size_t”转换到“uint
”,可能丢失数据 [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\storage\perfschema\unittest\pfs-t.vcxproj]
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\package.vcxproj”(默认目标) (1) ->
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\ALL_BUILD.vcxproj”(默认目标) (3) ->
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\sql\sqlgunitlib.vcxproj”(默认目标) (156) ->
cl : 命令行 warning D9002: 忽略未知选项“-fno-builtin-memcmp” [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\sql\sqlgunitlib.vcxproj]
F:\数据库资料\mysql\源码包\mysql-5.7.27\sql-common\sql_string.cc(754): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 (F:\数据库
资料\mysql\源码包\mysql-5.7.27\sql-common\sql_string.cc) [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\sql\sqlgunitlib.vcxproj]
F:\数据库资料\mysql\源码包\mysql-5.7.27\sql-common\sql_string.cc(832): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 (F:\数据库资
料\mysql\源码包\mysql-5.7.27\sql-common\sql_string.cc) [F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\sql\sqlgunitlib.vcxproj]
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\package.vcxproj”(默认目标) (1) ->
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\ALL_BUILD.vcxproj”(默认目标) (3) ->
“F:\数据库资料\mysql\源码包\mysql-5.7.27\BLD\extra\zlib_decompress.vcxproj”(默认目标) (185) ->
F:\数据库资料\mysql\源码包\mysql-5.7.27\extra\zlib_decompress.cc(71): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 [F:\数据库资
料\mysql\源码包\mysql-5.7.27\BLD\extra\zlib_decompress.vcxproj]
自此,mysql5.7源码编译成功,我在本地可以用visual studio 2012打开。接下来就是可以进入深入调试学习了!
1,找到sql\mysqld.cc中的test_lc_time_sz()函数,将其中的DBUG_ASSERT(0)改为DBUG_ASSERT(1)
2,编译过程中有free函数老报错,可以修改下名字,主要是plugin/keyring/buffer.h,plugin/keyring/buffer.cc,socket_events.c
3,运行mysqld.exe --initialize-insecure,时间可能有点长(如果出现错误,看一下是不是data目录不存在,可以手动创建)
4,运行mysqld.exe --console进行调试
欢迎大家关注以下公众号进行数据库方面知识探讨: