TiFlash Source Code Compilation Error

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tiflash源码编译报错

| username: programmer

[TiFlash Usage Environment] Linux release 8.7/linux kernel 5.18.19
[TiFlash Version] v7.3.0
[Reproduction Path] After cloning the source code, download dependencies and execute the command cmake … -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang+±14 -DCMAKE_BUILD_TYPE=RELWITHDEBINFO -DENABLE_TESTING=OFF -DENABLE_TESTS=OFF -DENABLE_FAILPOINTS=OFF -DJEMALLOC_NARENAS=-1 -Wno-dev -DUSE_CCACHE=OFF -DUSE_INTERNAL_SSL_LIBRARY=ON -DRUN_HAVE_STD_REGEX=0 -DTHINLTO_JOBS=224 -DENABLE_PCH=ON
[Encountered Problem: Phenomenon and Impact] Using the above command to compile version v6.5.1 has no issues, but it fails to compile in v7.3.0. How do you compile the TiFlash source code?
[Resource Configuration]

| username: 有猫万事足 | Original post link

Most of the contents in the contrib directory are directly referenced from other projects.
You used to be able to compile it, but now you can’t. This is because the fmtlib package originally had a bug and has since been updated.
Related issue:

I can’t see the reason why you can’t compile it now because your stack trace information is incomplete.
At least I can be sure that compile.h should not be the problem because, according to the associated fmtlib version, this file hasn’t been updated for 2 years. It’s unlikely that it suddenly stopped working.

I think you can try following the suggestion to set use -ftemplate-backtrace-limit= to see all
and see which file the final error message points to, and whether that file has been updated. This might give you some clues.

Alternatively, try compiling fmtlib separately with the current compiler parameters. If the fmtlib project compiles without issues on its own, integrating it into TiFlash should also work.

| username: programmer | Original post link

I have tried compiling fmtlib separately without any issues. The fmtlib library is also compiled during the overall compilation of TiFlash. Therefore, I suspect that the compilation halt might be due to improper function calls to the fmtlib library by other modules.

| username: 有猫万事足 | Original post link

It’s a bit strange. The error message is related to files under the dbms/src directory, and the content doesn’t even involve any calls, just a simple include. Yet, it still reports an error.

| username: 有猫万事足 | Original post link

I found a similar issue. It looks like there might be something useful at the end of the error message. :fist:

| username: ShawnYan | Original post link

Check the version of CMake, and you can organize the compilation parameters first.

| username: programmer | Original post link

Okay, thank you, I will take another look.

| username: programmer | Original post link

cmake version 3.25.2
The above compilation parameters are obtained from the tiflash/release-centos7-llvm/scripts/build-tiflash-release.sh file.

| username: ShawnYan | Original post link

I just compiled it a few days ago, maybe it will help. The official TiFlash is also constantly being compiled, but your OS/CMake/Clang versions are different. Try aligning the versions and see if it works. If it still doesn’t work, I suggest asking here: https://internals.tidb.io/

| username: programmer | Original post link

Okay, apart from the version inconsistency, all other operations remain the same, but the aforementioned issue still occurs. I’ll keep looking for the cause.

| username: redgame | Original post link

Unify the versions, and it would be best to start over in a different environment.

| username: programmer | Original post link

I found the cause of the problem. LLVM must be manually compiled and installed. Previously, I installed LLVM and its devel package through yum, but a functional library was missing after installation, which led to the above issue. :sweat:

| username: programmer | Original post link

There is another question. I have read some documents, and actually, TiFlash is derived from ClickHouse. In addition to system cache, ClickHouse can also configure application-level cache. Does TiFlash have related parameters to adjust the size of the application-level cache?

| username: ShawnYan | Original post link

The yum method doesn’t work; the version and parameters may not be correct. It’s better to compile manually.