Skip to content

Commit fe8b702

Browse files
[Tool] Build VelocyPack with C++17 on macOS (#76142)
Signed-off-by: alvin-phoenix-ai <alvin.zhao@phoenixdata.ai>
1 parent 0e0b80c commit fe8b702

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

be/src/column/arrow/arrow_to_json_converter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <memory>
2121
#include <string>
22+
#include <string_view>
2223

2324
#include "arrow/array.h"
2425
#include "arrow/type.h"

be/src/exprs/cast_expr_json.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <velocypack/Exception.h>
1616

17+
#include <string_view>
18+
1719
#include "column/array_column.h"
1820
#include "column/column_builder.h"
1921
#include "column/column_visitor_adapter.h"
@@ -103,14 +105,7 @@ class CastColumnItemVisitor final : public ColumnVisitorAdapter<CastColumnItemVi
103105

104106
Status do_visit(const BinaryColumn& col) {
105107
Slice slice = col.get_slice(_row);
106-
#ifdef __APPLE__
107-
// On macOS, velocypack's template overload resolution may not correctly
108-
// match std::string_view constructor, causing "Must give a string or char const*" error.
109-
// Use std::string explicitly to avoid type ambiguity.
110-
_add_element(std::string(slice.data, slice.size));
111-
#else
112108
_add_element(std::string_view(slice.data, slice.size));
113-
#endif
114109
return {};
115110
}
116111

@@ -276,4 +271,4 @@ StatusOr<std::string> cast_type_to_json_str(const ColumnPtr& column, int idx, bo
276271
return result;
277272
}
278273

279-
} // namespace starrocks
274+
} // namespace starrocks

thirdparty/build-thirdparty-darwin.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ build_vpack() {
921921
-DCMAKE_BUILD_TYPE=Release \
922922
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" \
923923
-DCMAKE_INSTALL_LIBDIR=lib \
924+
-DCMAKE_CXX_STANDARD=17 \
925+
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
924926
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
925927
-DBUILD_SHARED_LIBS=OFF \
926928
-DCMAKE_CXX_FLAGS="$(append_flags "${CXXFLAGS}" "-D_LIBCPP_HAS_NO_HASH_MEMORY=1")" \

thirdparty/build-thirdparty.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,10 +1290,12 @@ build_aws_cpp_sdk() {
12901290
build_vpack() {
12911291
check_if_source_exist $VPACK_SOURCE
12921292
cd $TP_SOURCE_DIR/$VPACK_SOURCE
1293+
rm -rf build
12931294
mkdir -p build
12941295
cd build
12951296
$CMAKE_CMD .. \
12961297
-DCMAKE_CXX_STANDARD="17" \
1298+
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
12971299
-G "${CMAKE_GENERATOR}" \
12981300
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TP_INSTALL_DIR} \
12991301
-DCMAKE_CXX_COMPILER=$STARROCKS_GCC_HOME/bin/g++ -DCMAKE_C_COMPILER=$STARROCKS_GCC_HOME/bin/gcc

0 commit comments

Comments
 (0)