From ef2bae19884635cb3dcea910b9cf777ae0ef119e Mon Sep 17 00:00:00 2001 From: Wish Date: Tue, 19 Nov 2024 23:10:03 +0800 Subject: [PATCH 1/4] readme: Fix MacOS instructions Signed-off-by: Wish --- README.md | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e0cf1117d89..681fabf3649 100644 --- a/README.md +++ b/README.md @@ -158,20 +158,11 @@ export CXX="/usr/bin/clang++-17" In MacOS, if you install llvm clang, you need to explicitly specify to use llvm clang. Add the following lines to your shell environment, e.g. `~/.bash_profile`. -```shell -export PATH="$(brew --prefix)/opt/llvm/bin:$PATH" -export CC="$(brew --prefix)/opt/llvm/bin/clang" -export CXX="$(brew --prefix)/opt/llvm/bin/clang++" -``` -Or use `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` to specify the compiler, like this: ```shell -mkdir cmake-build-debug -cd cmake-build-debug - -cmake .. -GNinja -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER="$(brew --prefix)/opt/llvm/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix)/opt/llvm/bin/clang++" - -ninja tiflash +export PATH="$(brew --prefix)/opt/llvm@17/bin:$PATH" +export CC="$(brew --prefix)/opt/llvm@17/bin/clang" +export CXX="$(brew --prefix)/opt/llvm@17/bin/clang++" ``` After building, you can get TiFlash binary in `dbms/src/Server/tiflash` in the `cmake-build-debug` directory. From 125e2463295f88bafedbbc7c9107caf422826b32 Mon Sep 17 00:00:00 2001 From: Wish Date: Tue, 19 Nov 2024 23:38:38 +0800 Subject: [PATCH 2/4] Fix build Signed-off-by: Wish --- dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp index 00c855f59ee..62ba7c8c6a5 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp @@ -125,7 +125,7 @@ class SegmentBitmapFilterTest : public SegmentTestBasic SegmentTestBasic::writeSegment(SEG_ID, end - begin, begin); if (unit.pack_size) { - db_context->getSettingsRef().set("dt_segment_stable_pack_rows", *(unit.pack_size)); + db_context->getSettingsRef().set("dt_segment_stable_pack_rows", static_cast(*(unit.pack_size))); reloadDMContext(); ASSERT_EQ(dm_context->stable_pack_rows, *(unit.pack_size)); } From f47f6c4d7c8fff8f78a198cfde546d10f4d9c4e2 Mon Sep 17 00:00:00 2001 From: Wish Date: Wed, 20 Nov 2024 11:23:29 +0800 Subject: [PATCH 3/4] Polish Signed-off-by: Wish --- README.md | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 681fabf3649..f93414509ea 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,13 @@ sudo ./llvm.sh 17 all sudo apt install -y cmake ninja-build zlib1g-dev libcurl4-openssl-dev ccache ``` +Then, expose the LLVM17 toolchain as the default one in order to use it later in compile: + +```shell +export CC="/usr/bin/clang-17" +export CXX="/usr/bin/clang++-17" +``` + **Note for Ubuntu 18.04 and Ubuntu 20.04:** The default installed cmake may be not recent enough. You can install a newer cmake from the [Kitware APT Repository](https://apt.kitware.com): @@ -125,9 +132,14 @@ xcode-select --install brew install ninja cmake openssl@1.1 ccache brew install llvm@17 +``` -# check llvm version -clang --version # should be 17.0.0 or higher +Then, expose the LLVM17 toolchain as the default one in order to use it later in compile: + +```shell +export PATH="$(brew --prefix)/opt/llvm@17/bin:$PATH" +export CC="$(brew --prefix)/opt/llvm@17/bin/clang" +export CXX="$(brew --prefix)/opt/llvm@17/bin/clang++" ``` @@ -148,25 +160,16 @@ To build TiFlash for development: cmake --workflow --preset dev ``` -Note: In Linux, usually you need to explicitly specify to use LLVM. +Or if you don't like the preset: ```shell -export CC="/usr/bin/clang-17" -export CXX="/usr/bin/clang++-17" -``` - -In MacOS, if you install llvm clang, you need to explicitly specify to use llvm clang. - -Add the following lines to your shell environment, e.g. `~/.bash_profile`. - -```shell -export PATH="$(brew --prefix)/opt/llvm@17/bin:$PATH" -export CC="$(brew --prefix)/opt/llvm@17/bin/clang" -export CXX="$(brew --prefix)/opt/llvm@17/bin/clang++" +# In the TiFlash repository root: +mkdir cmake-build-debug +cd cmake-build-debug +cmake .. -GNinja -DCMAKE_BUILD_TYPE=DEBUG +ninja tiflash ``` -After building, you can get TiFlash binary in `dbms/src/Server/tiflash` in the `cmake-build-debug` directory. - ### Build Options TiFlash has several CMake build options to tweak for development purposes. These options SHOULD NOT be changed for production usage, as they may introduce unexpected build errors and unpredictable runtime behaviors. From 6b6edfe7dd97b14b9de2a94ea208fc1cb6aaa9d3 Mon Sep 17 00:00:00 2001 From: JaySon Date: Wed, 20 Nov 2024 17:40:29 +0800 Subject: [PATCH 4/4] Update dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp Co-authored-by: Liqi Geng --- dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp index 62ba7c8c6a5..226760ff9c4 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_segment_bitmap.cpp @@ -125,7 +125,7 @@ class SegmentBitmapFilterTest : public SegmentTestBasic SegmentTestBasic::writeSegment(SEG_ID, end - begin, begin); if (unit.pack_size) { - db_context->getSettingsRef().set("dt_segment_stable_pack_rows", static_cast(*(unit.pack_size))); + db_context->getSettingsRef().dt_segment_stable_pack_rows = *(unit.pack_size); reloadDMContext(); ASSERT_EQ(dm_context->stable_pack_rows, *(unit.pack_size)); }