-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*: Fix build and readme in llvm17 (#9656)
ref #6233 Fix README instruction for MacOS Fix build unit test failure in LLVM17 + MacOS Signed-off-by: Wish <[email protected]> Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> Co-authored-by: JaySon <[email protected]> Co-authored-by: Liqi Geng <[email protected]>
- Loading branch information
1 parent
58bbc48
commit 6c86929
Showing
2 changed files
with
18 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [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> | ||
|
@@ -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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters