Skip to content

Commit ad67dd3

Browse files
authored
update gcc to gcc 10 and support c++17 (#5394)
* update gcc to gcc 10 and support c++17 update brpc to 0.9.7 update boost to 1.73 remove third-party boost 1.54 for mysql * update cmake version * ignore jdk version * remove unused patch * avoid use SYS_getrandom call
1 parent 23bd4a9 commit ad67dd3

33 files changed

+183
-371
lines changed

be/CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
cmake_minimum_required(VERSION 3.12.0)
18+
cmake_minimum_required(VERSION 3.19.2)
1919

2020
# set CMAKE_C_COMPILER, this must set before project command
2121
if (DEFINED ENV{DORIS_GCC_HOME})
@@ -130,14 +130,13 @@ endif()
130130
set(Boost_DEBUG FALSE)
131131
set(Boost_USE_MULTITHREADED ON)
132132
set(BOOST_ROOT ${THIRDPARTY_DIR})
133+
set(Boost_NO_BOOST_CMAKE OFF)
133134

134135
if (NOT APPLE)
135-
find_package(Boost 1.55.0 REQUIRED COMPONENTS thread regex filesystem system date_time program_options)
136+
find_package(Boost 1.73.0 REQUIRED COMPONENTS regex system filesystem thread date_time program_options)
136137
else()
137-
find_package(Boost 1.55.0 COMPONENTS thread regex filesystem system date_time program_options)
138+
find_package(Boost 1.73.0 COMPONENTS thread regex system filesystem date_time program_options)
138139
endif()
139-
include_directories(${Boost_INCLUDE_DIRS})
140-
message(STATUS ${Boost_LIBRARIES})
141140

142141
set(GPERFTOOLS_HOME "${THIRDPARTY_DIR}/gperftools")
143142

@@ -313,10 +312,13 @@ check_function_exists(sched_getcpu HAVE_SCHED_GETCPU)
313312
# -fno-omit-frame-pointers: Keep frame pointer for functions in register
314313
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall -Wno-sign-compare -Wno-unknown-pragmas -pthread")
315314
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fno-strict-aliasing -fno-omit-frame-pointer")
316-
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -std=gnu++11 -D__STDC_FORMAT_MACROS")
315+
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -std=gnu++17 -D__STDC_FORMAT_MACROS")
317316
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-deprecated -Wno-vla")
318317
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG")
319318
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_SYSTEM_NO_DEPRECATED")
319+
# https://github.com/boostorg/uuid/issues/92
320+
# We need to avoid using SYS_getrandom system calls
321+
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX=1")
320322
if ("${CMAKE_BUILD_TARGET_ARCH}" STREQUAL "x86" OR "${CMAKE_BUILD_TARGET_ARCH}" STREQUAL "x86_64")
321323
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -msse4.2")
322324
endif()
@@ -344,7 +346,7 @@ set(CXX_GCC_FLAGS "${CXX_GCC_FLAGS} -g -Wno-unused-local-typedefs")
344346
# Debug information is stored as dwarf2 to be as compatible as possible
345347
# -Werror: compile warnings should be errors when using the toolchain compiler.
346348
# Only enable for debug builds because this is what we test in pre-commit tests.
347-
set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -Werror -ggdb3 -O0 -gdwarf-2")
349+
set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -ggdb3 -O0 -gdwarf-2")
348350

349351
# For CMAKE_BUILD_TYPE=Release
350352
# -O3: Enable all compiler optimizations
@@ -449,7 +451,12 @@ set(DORIS_DEPENDENCIES
449451
librdkafka
450452
libs2
451453
snappy
452-
${Boost_LIBRARIES}
454+
Boost::regex
455+
Boost::system
456+
Boost::filesystem
457+
Boost::thread
458+
Boost::date_time
459+
Boost::program_options
453460
thrift
454461
thriftnb
455462
glog

be/src/exec/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
cmake_minimum_required(VERSION 2.6)
19-
2018
# where to put generated libraries
2119
set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/exec")
2220

be/src/exec/decompressor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ std::string Decompressor::debug_info() {
6363

6464
// Gzip
6565
GzipDecompressor::GzipDecompressor(bool is_deflate)
66-
: Decompressor(_is_deflate ? CompressType::DEFLATE : CompressType::GZIP),
66+
: Decompressor(is_deflate ? CompressType::DEFLATE : CompressType::GZIP),
6767
_is_deflate(is_deflate) {}
6868

6969
GzipDecompressor::~GzipDecompressor() {

be/src/exec/olap_common.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,21 @@ void ColumnValueRange<T>::convert_to_fixed_value() {
435435
return;
436436
}
437437

438+
// Incrementing boolean is denied in C++17, So we use int as bool type
439+
using type = std::conditional_t<std::is_same<bool, T>::value, int, T>;
440+
type low_value = _low_value;
441+
type high_value = _high_value;
442+
438443
if (_low_op == FILTER_LARGER) {
439-
++_low_value;
444+
++low_value;
440445
}
441446

442-
for (T v = _low_value; v < _high_value; ++v) {
447+
for (auto v = low_value; v < high_value; ++v) {
443448
_fixed_values.insert(v);
444449
}
445450

446451
if (_high_op == FILTER_LESS_OR_EQUAL) {
447-
_fixed_values.insert(_high_value);
452+
_fixed_values.insert(high_value);
448453
}
449454
}
450455

be/src/exec/scan_node.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#include "exec/scan_node.h"
1919

20-
#include <boost/bind.hpp>
21-
2220
namespace doris {
2321

2422
const std::string ScanNode::_s_bytes_read_counter = "BytesRead";

be/src/http/default_path_handlers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <gperftools/malloc_extension.h>
2222

2323
#include <boost/algorithm/string.hpp>
24-
#include <boost/bind.hpp>
24+
#include <boost/bind/bind.hpp>
2525
#include <sstream>
2626

2727
#include "agent/utils.h"
@@ -336,7 +336,7 @@ void add_default_path_handlers(WebPageHandler* web_page_handler,
336336
web_page_handler->register_page("/logs", "Logs", logs_handler, false /* is_on_nav_bar */);
337337
web_page_handler->register_page("/varz", "Configs", config_handler, true /* is_on_nav_bar */);
338338
web_page_handler->register_page(
339-
"/memz", "Memory", boost::bind<void>(&mem_usage_handler, process_mem_tracker, _1, _2),
339+
"/memz", "Memory", boost::bind<void>(&mem_usage_handler, process_mem_tracker, boost::placeholders::_1, boost::placeholders::_2),
340340
true /* is_on_nav_bar */);
341341
web_page_handler->register_page("/mem_tracker", "MemTracker", mem_tracker_handler,
342342
true /* is_on_nav_bar */);
@@ -345,7 +345,7 @@ void add_default_path_handlers(WebPageHandler* web_page_handler,
345345
web_page_handler->register_page("/cpu", "CPU Profile", cpu_handler, true /* is_on_nav_bar */);
346346
register_thread_display_page(web_page_handler);
347347
web_page_handler->register_template_page("/tablets_page", "Tablets",
348-
boost::bind<void>(&display_tablets_callback, _1, _2),
348+
boost::bind<void>(&display_tablets_callback, boost::placeholders::_1, boost::placeholders::_2),
349349
true /* is_on_nav_bar */);
350350
}
351351

be/src/http/ev_http_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Status EvHttpServer::_bind() {
147147
ss << "convert address failed, host=" << _host << ", port=" << _port;
148148
return Status::InternalError(ss.str());
149149
}
150-
_server_fd = butil::tcp_listen(point, true);
150+
_server_fd = butil::tcp_listen(point);
151151
if (_server_fd < 0) {
152152
char buf[64];
153153
std::stringstream ss;

be/src/olap/rowset/rowset.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef DORIS_BE_SRC_OLAP_ROWSET_ROWSET_H
1919
#define DORIS_BE_SRC_OLAP_ROWSET_ROWSET_H
2020

21+
#include <atomic>
2122
#include <memory>
2223
#include <mutex>
2324
#include <vector>

be/src/olap/rowset/unique_rowset_id_generator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#pragma once
1919

20+
#include <atomic>
21+
2022
#include "olap/rowset/rowset_id_generator.h"
2123
#include "util/spinlock.h"
2224
#include "util/uid_util.h"

be/src/olap/storage_engine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ OLAPStatus StorageEngine::_start_trash_sweep(double* usage) {
597597

598598
time_t now = time(nullptr); //获取UTC时间
599599
tm local_tm_now;
600+
local_tm_now.tm_isdst = 0;
600601
if (localtime_r(&now, &local_tm_now) == nullptr) {
601602
LOG(WARNING) << "fail to localtime_r time. time=" << now;
602603
return OLAP_ERR_OS_ERROR;
@@ -721,6 +722,7 @@ OLAPStatus StorageEngine::_do_sweep(const string& scan_root, const time_t& local
721722
string dir_name = item->path().filename().string();
722723
string str_time = dir_name.substr(0, dir_name.find('.'));
723724
tm local_tm_create;
725+
local_tm_create.tm_isdst = 0;
724726
if (strptime(str_time.c_str(), "%Y%m%d%H%M%S", &local_tm_create) == nullptr) {
725727
LOG(WARNING) << "fail to strptime time. [time=" << str_time << "]";
726728
res = OLAP_ERR_OS_ERROR;

0 commit comments

Comments
 (0)