Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stonedb): To support gcc 7.5 or higher and fix up error(#11)(#12) #325

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(stonedb): To support gcc 7.5 or higher and fix up error(#11)(#12)
1: To support GCC 7.5 or higher.
2: To fix up some compilation errors.
3: To support `-DWITH_ROCKSDB` and `-DWITH_MARISA` to specify the directories
   in which rocksdb and marisa installed.
RingsC committed Aug 4, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e7ee74c40b99fa4d82cac9aa5439603b91614240
30 changes: 11 additions & 19 deletions .github/workflows/integration-compile-mtr.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ env:

jobs:
stonedb-build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
@@ -46,21 +46,6 @@ jobs:
sudo mkdir -p /stonedb56/install/log
sudo mkdir ./soft

- name: install gcc 7.3
run: |
sudo wget -c http://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz -O ./soft/gcc-7.3.0.tar.gz
sudo tar zxvf ./soft/gcc-7.3.0.tar.gz -C ./soft
pushd ./soft/gcc-7.3.0
sudo ./contrib/download_prerequisites
sudo ./configure --prefix=/usr/local/gcc7.3 --enable-bootstrap -enable-threads=posix --enable-checking=release --enable-languages=c,c++ --disable-multilib --disable-libsanitizer
sudo make -j`nproc`
sudo make install -j`nproc`
popd
sudo rm /usr/bin/gcc
sudo ln -s /usr/local/gcc7.3/bin/gcc /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/local/gcc7.3/bin/g++ /usr/bin/g++

- name: install marisa
run: |
sudo mkdir -p ./soft/marisa-trie
@@ -82,6 +67,7 @@ jobs:
sudo cmake ./ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/stonedb-gcc-rocksdb \
-DCMAKE_INSTALL_LIBDIR=/usr/local/stonedb-gcc-rocksdb \
-DWITH_JEMALLOC=ON \
-DWITH_SNAPPY=ON \
-DWITH_LZ4=ON \
@@ -102,14 +88,21 @@ jobs:
sudo wget -c https://boostorg.jfrog.io/artifactory/main/release/1.66.0/source/boost_1_66_0.tar.bz2 -O ./soft/boost_1_66_0.tar.bz2
sudo tar -jxvf ./soft/boost_1_66_0.tar.bz2 -C ./soft
sudo mkdir -p /usr/local/stonedb-boost
#for boost warning: Unnecessary parenthesis warning in gcc-8.0.0 or higher.
sudo sed -i '1 i #define BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER' ./soft/boost_1_66_0/boost/mpl/assert.hpp
pushd ./soft/boost_1_66_0
sudo ./bootstrap.sh --prefix=/usr/local/stonedb-boost
sudo ./b2 install
#in lib python, builtin_converters.cpp:51:35: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
#therefore, the simplest way to supress this error is 'DO NOT BUILD'-python libs.
sudo ./b2 install --variant=release --without-python
popd

- name: compile stonedb
run: |
sudo cmake ./ \
-DWITH_BOOST=/usr/local/stonedb-boost \
-DWITH_ROCKSDB=/usr/local/stonedb-gcc-rocksdb \
-DWITH_MARISA=/usr/local/stonedb-marisa \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_INSTALL_PREFIX=/stonedb56/install \
-DMYSQL_DATADIR=/stonedb56/install/data \
@@ -124,8 +117,7 @@ jobs:
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_BOOST=/usr/local/stonedb-boost/include
-DDEFAULT_COLLATION=utf8_general_ci
sudo make VERBOSE=1 -j`nproc`
sudo make install -j`nproc`

38 changes: 29 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -47,7 +47,6 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
# respect user wishes and do not (re)define CMAKE_BUILD_TYPE. If WITH_DEBUG{_FULL}
# is given, set CMAKE_BUILD_TYPE = Debug. Otherwise, use Relwithdebinfo.


IF(DEFINED CMAKE_BUILD_TYPE)
SET(HAVE_CMAKE_BUILD_TYPE TRUE)
ENDIF()
@@ -133,7 +132,6 @@ ENDIF()
#cmake on 64bit windows/mac/solaris doesn't set CMAKE_SYSTEM_PROCESSOR correctly
SET(MYSQL_MACHINE_TYPE ${CMAKE_SYSTEM_PROCESSOR})


# Include the platform-specific file. To allow exceptions, this code
# looks for files in order of how specific they are. If there is, for
# example, a generic Linux.cmake and a version-specific
@@ -151,7 +149,6 @@ FOREACH(_base
ENDIF()
ENDFOREACH()


IF(UNIX)
OPTION(WITH_INNODB_MEMCACHED "" OFF)
OPTION(ENABLE_MEMCACHED_SASL "Enable SASL on InnoDB Memcached" OFF)
@@ -208,6 +205,29 @@ IF(NOT WITHOUT_SERVER)
ENDIF()
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)

# Ported from mysql 5.7, add by stonedb authors
INCLUDE(cmake/boost.cmake)
#Link directories under boost, etc.
IF (WITH_BOOST)
INCLUDE_DIRECTORIES("${WITH_BOOST}/include")
LINK_DIRECTORIES("${WITH_BOOST}/lib/")
ENDIF ()

#for rocksdb, to check rocksdb
INCLUDE(cmake/rocksdb.cmake)
#Link directories under rocksdb, etc.
IF (WITH_ROCKSDB)
INCLUDE_DIRECTORIES("${WITH_ROCKSDB}" "${WITH_ROCKSDB}/include")
LINK_DIRECTORIES("${WITH_ROCKSDB}")
ENDIF ()

#for marisa, to check marisa
INCLUDE(cmake/marisa.cmake)
#Link directories under marisa, etc.
IF (WITH_MARISA)
INCLUDE_DIRECTORIES("${WITH_MARISA}" "${WITH_MARISA}/include")
LINK_DIRECTORIES("${WITH_MARISA}" "${WITH_MARISA}/lib")
ENDIF ()

include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
@@ -283,7 +303,6 @@ IF (WITH_ASAN)
ENDIF()
ENDIF()


OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
IF(ENABLE_DEBUG_SYNC)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
@@ -344,6 +363,11 @@ IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} -static-libstdc++ -static-libgcc")
ENDIF()

IF(WITH_BOOST AND WITH_ROCKSDB AND WITH_MARISA)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${WITH_BOOST}/lib;${WITH_ROCKSDB};${WITH_MARISA}/lib")
MESSAGE(STATUS "TO SET INSTALL RPATH FOR STONEDB: ${CMAKE_INSTALL_RPATH}")
ENDIF()

OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
@@ -393,7 +417,6 @@ IF(WITH_DEBUG AND NOT WIN32 AND NOT WITH_INNODB_MEMCACHED)
ENDFOREACH()
ENDIF()


# Set commonly used variables
IF(WIN32)
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}" )
@@ -432,6 +455,7 @@ INCLUDE(configure.cmake)
# Common defines and includes
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
ADD_DEFINITIONS(-DSTONEDB)
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=1)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)

# Add bundled or system zlib.
@@ -568,7 +592,6 @@ IF (UNIX)
SET(STONEDB_BUILD_TIME "Date: ${ER_BUILD_TIME}")
ENDIF()


CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
@@ -646,9 +669,6 @@ ENDIF()

INCLUDE(CPack)

# Ported from mysql 5.7, add by stonedb authors
INCLUDE(cmake/boost.cmake)

# C compiler flags consist of:
# CPPFLAGS Taken from environment, see above.
# ADD_DEFINITIONS In each individual CMakeLists.txt
12 changes: 6 additions & 6 deletions cmake/boost.cmake
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ IF (WITH_BOOST)
)
## Did we get a path name to an unzippped version?
FIND_PATH(LOCAL_BOOST_DIR
NAMES "boost/version.hpp"
NAMES "include/boost/version.hpp"
PATHS ${WITH_BOOST}
NO_DEFAULT_PATH
)
@@ -228,31 +228,31 @@ ENDIF()

# Search for the version file, first in LOCAL_BOOST_DIR or WITH_BOOST
FIND_PATH(BOOST_INCLUDE_DIR
NAMES boost/version.hpp
NAMES include/boost/version.hpp
NO_DEFAULT_PATH
PATHS ${LOCAL_BOOST_DIR}
${LOCAL_BOOST_DIR}/${BOOST_PACKAGE_NAME}
${WITH_BOOST}
)
# Then search in standard places (if not found above).
FIND_PATH(BOOST_INCLUDE_DIR
NAMES boost/version.hpp
NAMES include/boost/version.hpp
)

IF(NOT BOOST_INCLUDE_DIR)
MESSAGE(STATUS
"Looked for boost/version.hpp in ${LOCAL_BOOST_DIR} and ${WITH_BOOST}")
"Looked for include/boost/version.hpp in ${LOCAL_BOOST_DIR} and ${WITH_BOOST}")
COULD_NOT_FIND_BOOST()
ELSE()
MESSAGE(STATUS "Found ${BOOST_INCLUDE_DIR}/boost/version.hpp ")
MESSAGE(STATUS "Found ${BOOST_INCLUDE_DIR}/include/boost/version.hpp ")
ENDIF()

# Verify version number. Version information looks like:
# // BOOST_VERSION % 100 is the patch level
# // BOOST_VERSION / 100 % 1000 is the minor version
# // BOOST_VERSION / 100000 is the major version
# #define BOOST_VERSION 105900
FILE(STRINGS "${BOOST_INCLUDE_DIR}/boost/version.hpp"
FILE(STRINGS "${BOOST_INCLUDE_DIR}/include/boost/version.hpp"
BOOST_VERSION_NUMBER
REGEX "^#define[\t ]+BOOST_VERSION[\t ][0-9]+.*"
)
139 changes: 139 additions & 0 deletions cmake/marisa.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Copyright (c) 2014, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

# We want marisa in order to build our stonedb code.
# The marisa tarball is fairly big, and takes several minutes
# to download. So we recommend downloading/unpacking it
# only once, in a place visible from any bzr sandbox.
# We use only header files, so there should be no binary dependencies.

# Invoke with -DWITH_MARISA=<directory> or set WITH_MARISA in environment.
# If WITH_MARISA is *not* set, or is set to the special value "system",
# we assume that the correct version (see below)
# is installed on the compile host in the standard location.

SET(MARISA_PACKAGE_NAME "marisa-trie")
SET(MARISA_DOWNLOAD_URL
"https://github.com/s-yata/marisa-trie.gi"
)
SET(MARISA_TARBALL "${MARISA_PACKAGE_NAME}")

SET(OLD_PACKAGE_NAMES "")

MACRO(RESET_MARISA_VARIABLES)
UNSET(MARISA_INCLUDE_DIR)
UNSET(MARISA_INCLUDE_DIR CACHE)
UNSET(LOCAL_MARISA_DIR)
UNSET(LOCAL_MARISA_DIR CACHE)
ENDMACRO()

MACRO(ECHO_MARISA_VARIABLES)
MESSAGE(STATUS "MARISA_INCLUDE_DIR ${MARISA_INCLUDE_DIR}")
MESSAGE(STATUS "LOCAL_MARISA_DIR ${LOCAL_MARISA_DIR}")
ENDMACRO()

MACRO(COULD_NOT_FIND_MARISA)
ECHO_MARISA_VARIABLES()
RESET_MARISA_VARIABLES()
MESSAGE(STATUS "Could not find (the correct version of) marisa.")
MESSAGE(STATUS "MySQL currently requires ${MARISA_PACKAGE_NAME}\n")
MESSAGE(FATAL_ERROR
"You can download it, install it, then specify the marisa path "
"with -DWITH_MARISA=<director>\n"
"This CMake script will look for marisa in <directory>. "
)
ENDMACRO()

# Pick value from environment if not set on command line.
IF(DEFINED ENV{WITH_MARISA} AND NOT DEFINED WITH_MARISA)
SET(WITH_MARISA "$ENV{WITH_MARISA}")
ENDIF()

# Pick value from environment if not set on command line.
IF(DEFINED ENV{MARISA_ROOT} AND NOT DEFINED WITH_MARISA)
SET(WITH_MARISA "$ENV{MARISA_ROOT}")
ENDIF()

IF(WITH_MARISA AND WITH_MARISA STREQUAL "system")
UNSET(WITH_MARISA)
UNSET(WITH_MARISA CACHE)
ENDIF()

# Update the cache, to make it visible in cmake-gui.
SET(WITH_MARISA ${WITH_MARISA} CACHE PATH
"Path to marisa sources: a directory, or a tarball to be unzipped.")

# If the value of WITH_MARISA changes, we must unset all dependent variables:
IF(OLD_WITH_MARISA)
IF(NOT "${OLD_WITH_MARISA}" STREQUAL "${WITH_MARISA}")
RESET_MARISA_VARIABLES()
ENDIF()
ENDIF()

SET(OLD_WITH_MARISA ${WITH_MARISA} CACHE INTERNAL
"Previous version of WITH_MARISA" FORCE)

IF (WITH_MARISA)
## Did we get a path name to an unzippped version?
FIND_PATH(LOCAL_MARISA_DIR
NAMES "include/marisa.h"
PATHS ${WITH_MARISA}
NO_DEFAULT_PATH
)
IF(LOCAL_MARISA_DIR)
MESSAGE(STATUS "Local marisa dir ${LOCAL_MARISA_DIR}")
ENDIF()
ENDIF()

# Search for the header file, first in LOCAL_MARISA_DIR or WITH_MARISA
FIND_PATH(MARISA_INCLUDE_DIR
NAMES "include/marisa.h"
NO_DEFAULT_PATH
PATHS ${LOCAL_MARISA_DIR}
${LOCAL_MARISA_DIR}/${MARISA_PACKAGE_NAME}
${WITH_MARISA}
)
MESSAGE("found MARISA_INCLUDE_DIR:${MARISA_INCLUDE_DIR}")
# Then search in standard places (if not found above).
FIND_PATH(MARISA_INCLUDE_DIR
NAMES include/marisa.h
)
IF(NOT MARISA_INCLUDE_DIR)
MESSAGE(STATUS
"Looked for include/marisa.h in ${LOCAL_MARISA_DIR} and ${WITH_MARISA}")
COULD_NOT_FIND_MARISA()
ELSE()
MESSAGE(STATUS "Found ${MARISA_INCLUDE_DIR}/include/marisa.h ")
ENDIF()

MESSAGE(STATUS "MARISA_INCLUDE_DIR ${MARISA_INCLUDE_DIR}")

# Bug in sqrt(NaN) on 32bit platforms
IF(SIZEOF_VOIDP EQUAL 4)
ADD_DEFINITIONS(-DMARISA_GEOMETRY_SQRT_CHECK_FINITENESS)
ENDIF()

IF(LOCAL_MARISA_DIR OR LOCAL_MARISA_ZIP)
SET(USING_LOCAL_MARISA 1)
ELSE()
SET(USING_SYSTEM_MARISA 1)
ENDIF()
Loading