This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 64c7f80ac64 [chore] Add GCC 15 and Clang 20 Support (#52835)
64c7f80ac64 is described below

commit 64c7f80ac64f0cd64f222a7fb5b0fc9d2c491f22
Author: Amos Bird <[email protected]>
AuthorDate: Mon Jul 7 23:35:43 2025 +0800

    [chore] Add GCC 15 and Clang 20 Support (#52835)
    
    This PR adds support to compile Doris backend with GCC 15 and Clang 20.
    (ldb_toolchain v0.25)
    
    I'm unable to address build errors in CLucene. I'll leave the fix to the
    community.
    
    ```
    modified   src/ext/for/CMakeLists.txt
    @@ -9,7 +9,7 @@ if(NOT CMAKE_BUILD_TYPE)
     endif()
    
     set(DEBUG "-DNDEBUG -g -O3")
    -set(OPT "-w -Wall -fstrict-aliasing -falign-loops -Wno-int-conversion")
    +set(OPT "-w -Wall -fstrict-aliasing -falign-loops -Wno-int-conversion 
-Wno-incompatible-pointer-types")
    
     if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
         set(SSE "-msse4.2")
    ```
    
    BTW, TurboPFor is licensed under GPLv2-only, which makes it incompatible
    with the Apache License and therefore prohibited for inclusion in Apache
    Doris/Clucene, as per [ASF
    policy](https://www.apache.org/legal/resolved.html#prohibited).
    
    While the library employs some interesting integer encoding techniques,
    its feature set is broader than necessary for our use case, and the code
    style is unconventional. Reimplementing the subset we need in modern C++
    should be straightforward.
---
 be/src/olap/bitmap_filter_predicate.h                |  2 ++
 be/src/olap/bloom_filter_predicate.h                 |  2 ++
 be/src/service/point_query_executor.h                |  7 ++++---
 be/src/util/hash_util.hpp                            |  4 ++--
 be/src/util/jsonb_document.h                         | 14 --------------
 .../vec/data_types/data_type_date_or_datetime_v2.cpp | 13 +++++++++++++
 be/src/vec/functions/date_time_transforms.h          | 13 +++++++++++++
 .../vec/functions/function_datetime_floor_ceil.cpp   | 13 +++++++++++++
 be/src/vec/functions/function_string.h               |  1 -
 thirdparty/build-thirdparty.sh                       | 20 +++++++++++++-------
 .../patches/thrift-0.16-fix_mutex_include.patch      |  9 +++++++++
 11 files changed, 71 insertions(+), 27 deletions(-)

diff --git a/be/src/olap/bitmap_filter_predicate.h 
b/be/src/olap/bitmap_filter_predicate.h
index c1488869a04..64923f6e768 100644
--- a/be/src/olap/bitmap_filter_predicate.h
+++ b/be/src/olap/bitmap_filter_predicate.h
@@ -64,6 +64,8 @@ public:
         return _specific_filter->contains_any(min_value, max_value);
     }
 
+    using ColumnPredicate::evaluate;
+
     Status evaluate(BitmapIndexIterator*, uint32_t, roaring::Roaring*) const 
override {
         return Status::OK();
     }
diff --git a/be/src/olap/bloom_filter_predicate.h 
b/be/src/olap/bloom_filter_predicate.h
index b0d2b33a562..4fed6ac3ce0 100644
--- a/be/src/olap/bloom_filter_predicate.h
+++ b/be/src/olap/bloom_filter_predicate.h
@@ -43,6 +43,8 @@ public:
 
     PredicateType type() const override { return PredicateType::BF; }
 
+    using ColumnPredicate::evaluate;
+
     Status evaluate(BitmapIndexIterator* iterators, uint32_t num_rows,
                     roaring::Roaring* roaring) const override {
         return Status::OK();
diff --git a/be/src/service/point_query_executor.h 
b/be/src/service/point_query_executor.h
index 9bd1139202e..ffddfe86db5 100644
--- a/be/src/service/point_query_executor.h
+++ b/be/src/service/point_query_executor.h
@@ -138,9 +138,10 @@ public:
         // Encode to a flat binary which can be used as LRUCache's key
         std::string encode() const {
             std::string full_key;
-            full_key.resize(sizeof(int64_t) + key.size);
-            int8store(&full_key.front(), tablet_id);
-            memcpy((&full_key.front()) + sizeof(tablet_id), key.data, 
key.size);
+            full_key.reserve(sizeof(int64_t) + key.size);
+            const char* tid = reinterpret_cast<const char*>(&tablet_id);
+            full_key.append(tid, tid + sizeof(int64_t));
+            full_key.append(key.data, key.size);
             return full_key;
         }
     };
diff --git a/be/src/util/hash_util.hpp b/be/src/util/hash_util.hpp
index 39901e22200..ba47e51a4bc 100644
--- a/be/src/util/hash_util.hpp
+++ b/be/src/util/hash_util.hpp
@@ -240,7 +240,7 @@ public:
                 k |= (uint64_t)data[6] << 48;
                 k |= (uint64_t)data[7] << 56;
             } else if constexpr (std::endian::native == std::endian::little) {
-                k = *((uint64_t*)data);
+                memcpy(&k, data, sizeof(k));
             } else {
                 static_assert(std::endian::native == std::endian::big ||
                                       std::endian::native == 
std::endian::little,
@@ -398,4 +398,4 @@ struct std::hash<std::pair<First, Second>> {
         size_t h2 = std::hash<Second>()(p.second);
         return util_hash::HashLen16(h1, h2);
     }
-};
\ No newline at end of file
+};
diff --git a/be/src/util/jsonb_document.h b/be/src/util/jsonb_document.h
index 913506b60ec..b1eca4e2d3d 100644
--- a/be/src/util/jsonb_document.h
+++ b/be/src/util/jsonb_document.h
@@ -537,8 +537,6 @@ public:
     static const int sMaxKeyId = 65535;
     using keyid_type = uint16_t;
 
-    JsonbKeyValue() = delete;
-
     static const uint8_t sMaxKeyLen = 64;
 
     // size of the key. 0 indicates it is stored as id
@@ -695,8 +693,6 @@ struct JsonbValue {
     // }
 
     int128_t int_val() const;
-
-    JsonbValue() = delete;
 };
 
 // inline ObjectVal* JsonbDocument::operator->() {
@@ -715,7 +711,6 @@ template <typename T>
     requires std::is_integral_v<T> || std::is_floating_point_v<T>
 struct NumberValT {
 public:
-    NumberValT() = delete;
     T val() const { return num; }
 
     static unsigned int numPackedBytes() { return sizeof(JsonbValue) + 
sizeof(T); }
@@ -745,7 +740,6 @@ template <JsonbDecimalType T>
 struct JsonbDecimalVal {
 public:
     using NativeType = typename T::NativeType;
-    JsonbDecimalVal() = delete;
 
     // get the decimal value
     NativeType val() const {
@@ -782,8 +776,6 @@ public:
 
     uint32_t size;
     char payload[0];
-
-    JsonbBinaryVal() = delete;
 };
 
 /*
@@ -792,7 +784,6 @@ public:
  */
 struct JsonbStringVal : public JsonbBinaryVal {
 public:
-    JsonbStringVal() = delete;
     /*
     This function return the actual size of a string. Since for
     a string, it can be null-terminated with null paddings or it
@@ -846,8 +837,6 @@ struct ContainerVal {
 
     uint32_t size;
     char payload[0];
-
-    ContainerVal() = delete;
 };
 
 /*
@@ -860,8 +849,6 @@ struct ObjectVal : public ContainerVal {
     using iterator = JsonbFwdIteratorT<pointer, ObjectVal>;
     using const_iterator = JsonbFwdIteratorT<const_pointer, ObjectVal>;
 
-    ObjectVal() = delete;
-
     const_iterator search(const char* key, hDictFind handler = nullptr) const {
         return const_cast<ObjectVal*>(this)->search(key, handler);
     }
@@ -1018,7 +1005,6 @@ struct ArrayVal : public ContainerVal {
     using iterator = JsonbFwdIteratorT<pointer, ArrayVal>;
     using const_iterator = JsonbFwdIteratorT<const_pointer, ArrayVal>;
 
-    ArrayVal() = delete;
     // get the JSONB value at index
     JsonbValue* get(int idx) const {
         if (idx < 0) {
diff --git a/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp 
b/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp
index cc049ea0ce5..b36eb68d0f8 100644
--- a/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp
+++ b/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp
@@ -42,6 +42,15 @@ class IColumn;
 } // namespace vectorized
 } // namespace doris
 
+// FIXME: This file contains widespread UB due to unsafe type-punning casts.
+//        These must be properly refactored to eliminate reliance on 
reinterpret-style behavior.
+//
+// Temporarily suppress GCC 15+ warnings on user-defined type casts to allow 
build to proceed.
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-user-defined"
+#endif
+
 namespace doris::vectorized {
 bool DataTypeDateV2::equals(const IDataType& rhs) const {
     return typeid(rhs) == typeid(*this);
@@ -253,3 +262,7 @@ DataTypePtr create_datetimev2(UInt64 scale_value) {
 }
 
 } // namespace doris::vectorized
+
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic pop
+#endif
diff --git a/be/src/vec/functions/date_time_transforms.h 
b/be/src/vec/functions/date_time_transforms.h
index 71c7735bd81..0a13a33c384 100644
--- a/be/src/vec/functions/date_time_transforms.h
+++ b/be/src/vec/functions/date_time_transforms.h
@@ -36,6 +36,15 @@
 #include "vec/runtime/vdatetime_value.h"
 #include "vec/utils/util.hpp"
 
+// FIXME: This file contains widespread UB due to unsafe type-punning casts.
+//        These must be properly refactored to eliminate reliance on 
reinterpret-style behavior.
+//
+// Temporarily suppress GCC 15+ warnings on user-defined type casts to allow 
build to proceed.
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-user-defined"
+#endif
+
 namespace doris::vectorized {
 #include "common/compile_check_begin.h"
 
@@ -476,3 +485,7 @@ struct DateTimeTransformImpl {
 
 #include "common/compile_check_end.h"
 } // namespace doris::vectorized
+
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic pop
+#endif
diff --git a/be/src/vec/functions/function_datetime_floor_ceil.cpp 
b/be/src/vec/functions/function_datetime_floor_ceil.cpp
index a9369020922..f92f93ae83c 100644
--- a/be/src/vec/functions/function_datetime_floor_ceil.cpp
+++ b/be/src/vec/functions/function_datetime_floor_ceil.cpp
@@ -59,6 +59,15 @@ namespace doris {
 class FunctionContext;
 } // namespace doris
 
+// FIXME: This file contains widespread UB due to unsafe type-punning casts.
+//        These must be properly refactored to eliminate reliance on 
reinterpret-style behavior.
+//
+// Temporarily suppress GCC 15+ warnings on user-defined type casts to allow 
build to proceed.
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-user-defined"
+#endif
+
 namespace doris::vectorized {
 struct DayCeil;
 struct DayFloor;
@@ -825,3 +834,7 @@ void 
register_function_datetime_floor_ceil(SimpleFunctionFactory& factory) {
 #undef FLOOR
 #undef CEIL
 } // namespace doris::vectorized
+
+#if defined(__GNUC__) && (__GNUC__ >= 15)
+#pragma GCC diagnostic pop
+#endif
diff --git a/be/src/vec/functions/function_string.h 
b/be/src/vec/functions/function_string.h
index a0908f4da67..17cd9d101d2 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -24,7 +24,6 @@
 #include <array>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/locale.hpp>
-#include <boost/multiprecision/cpp_dec_float.hpp>
 #include <climits>
 #include <cmath>
 #include <cstddef>
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index cdd5bec050c..a935437f638 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -165,6 +165,12 @@ if [[ "${CC}" == *gcc ]]; then
     warning_array_parameter='-Wno-array-parameter'
     warning_narrowing='-Wno-narrowing'
     warning_dangling_reference='-Wno-dangling-reference'
+
+    gcc_major_version=$("${CC}" -dumpversion | cut -d. -f1)
+    if [[ "${gcc_major_version}" -ge 15 ]]; then
+        warning_deprecated_literal_operator='-Wno-deprecated-literal-operator'
+    fi
+
     boost_toolset='gcc'
 elif [[ "${CC}" == *clang ]]; then
     warning_uninitialized='-Wno-uninitialized'
@@ -758,10 +764,10 @@ build_mysql() {
     fi
 
     if [[ "${KERNEL}" != 'Darwin' ]]; then
-        cflags='-static -pthread -lrt'
+        cflags='-static -pthread -lrt -std=gnu89'
         cxxflags='-static -pthread -lrt'
     else
-        cflags='-pthread'
+        cflags='-pthread -std=gnu89'
         cxxflags='-pthread'
     fi
 
@@ -875,7 +881,7 @@ build_cyrus_sasl() {
     check_if_source_exist "${CYRUS_SASL_SOURCE}"
     cd "${TP_SOURCE_DIR}/${CYRUS_SASL_SOURCE}"
 
-    CFLAGS="-fPIC -Wno-implicit-function-declaration" \
+    CFLAGS="-fPIC -std=gnu89 -Wno-implicit-function-declaration" \
         CPPFLAGS="-I${TP_INCLUDE_DIR}" \
         LDFLAGS="-L${TP_LIB_DIR}" \
         LIBS="-lcrypto" \
@@ -919,7 +925,7 @@ build_odbc() {
 
     cd "${TP_SOURCE_DIR}/${ODBC_SOURCE}"
 
-    CFLAGS="-I${TP_INCLUDE_DIR} -Wno-int-conversion 
-Wno-implicit-function-declaration" \
+    CFLAGS="-I${TP_INCLUDE_DIR} -Wno-int-conversion -std=gnu89 
-Wno-implicit-function-declaration" \
         LDFLAGS="-L${TP_LIB_DIR}" \
         ./configure --prefix="${TP_INSTALL_DIR}" --with-included-ltdl 
--enable-static=yes --enable-shared=no
 
@@ -1352,7 +1358,7 @@ build_aws_sdk() {
         -DCMAKE_PREFIX_PATH="${TP_INSTALL_DIR}" -DBUILD_SHARED_LIBS=OFF 
-DENABLE_TESTING=OFF \
         -DCURL_LIBRARY_RELEASE="${TP_INSTALL_DIR}/lib/libcurl.a" 
-DZLIB_LIBRARY_RELEASE="${TP_INSTALL_DIR}/lib/libz.a" \
         -DBUILD_ONLY="core;s3;s3-crt;transfer;identity-management;sts" \
-        -DCMAKE_CXX_FLAGS="-Wno-nonnull -Wno-deprecated-declarations 
${warning_dangling_reference}" -DCPP_STANDARD=17
+        -DCMAKE_CXX_FLAGS="-Wno-nonnull ${warning_deprecated_literal_operator} 
-Wno-deprecated-declarations ${warning_dangling_reference}" -DCPP_STANDARD=17
 
     cd "${BUILD_DIR}"
 
@@ -1471,7 +1477,7 @@ build_krb5() {
         with_crypto_impl='--with-crypto-impl=openssl'
     fi
 
-    CFLAGS="-fcommon -fPIC -I${TP_INSTALL_DIR}/include" 
LDFLAGS="-L${TP_INSTALL_DIR}/lib" \
+    CFLAGS="-fcommon -fPIC -I${TP_INSTALL_DIR}/include -std=gnu89" 
LDFLAGS="-L${TP_INSTALL_DIR}/lib" \
         ../configure --prefix="${TP_INSTALL_DIR}" --disable-shared 
--enable-static \
         --without-keyutils ${with_crypto_impl:+${with_crypto_impl}}
 
@@ -1747,7 +1753,7 @@ build_jsoncpp() {
     rm -rf "${BUILD_DIR}"
     mkdir -p "${BUILD_DIR}"
     cd "${BUILD_DIR}"
-    "${CMAKE_CMD}" -G "${GENERATOR}" -DBUILD_STATIC_LIBS=ON 
-DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" ..
+    "${CMAKE_CMD}" -G "${GENERATOR}" -DJSONCPP_WITH_TESTS=OFF 
-DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" ..
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
 }
diff --git a/thirdparty/patches/thrift-0.16-fix_mutex_include.patch 
b/thirdparty/patches/thrift-0.16-fix_mutex_include.patch
new file mode 100644
index 00000000000..ca4315fde3a
--- /dev/null
+++ b/thirdparty/patches/thrift-0.16-fix_mutex_include.patch
@@ -0,0 +1,9 @@
+--- a/lib/cpp/src/thrift/concurrency/Mutex.h
++++ b/lib/cpp/src/thrift/concurrency/Mutex.h
+@@ -19,4 +19,5 @@
+ #ifndef _THRIFT_CONCURRENCY_MUTEX_H_
+ #define _THRIFT_CONCURRENCY_MUTEX_H_ 1
+
++#include <cstdint>
+ #include <memory>
+ #include <thrift/TNonCopyable.h>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to