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

*: Fix build and readme in llvm17 #9656

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
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
40 changes: 17 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -125,9 +132,14 @@ xcode-select --install
brew install ninja cmake [email protected] ccache

brew install llvm@17
```

Then, expose the LLVM17 toolchain as the default one in order to use it later in compile:

# check llvm version
clang --version # should be 17.0.0 or higher
```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++"
```

</details>
Expand All @@ -148,34 +160,16 @@ To build TiFlash for development:
cmake --workflow --preset dev
```

Note: In Linux, usually you need to explicitly specify to use LLVM.

```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.
Or if you don't like the preset:

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
# In the TiFlash repository root:
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++"

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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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().dt_segment_stable_pack_rows = *(unit.pack_size);
reloadDMContext();
ASSERT_EQ(dm_context->stable_pack_rows, *(unit.pack_size));
}
Expand Down