forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tool] Fix function glibc dispatch error (StarRocks#50790)
Signed-off-by: stdpain <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
15 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
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 |
---|---|---|
@@ -1,18 +1,22 @@ | ||
option(WITH_CLANG_TIDY "Use clang-tidy static analyzer" OFF) | ||
|
||
if (${WITH_CLANG_TIDY}) | ||
find_program (CLANG_TIDY_CACHE_BIN NAMES "clang-tidy-cache") | ||
find_program (CLANG_TIDY_BIN NAMES "clang-tidy-17" "clang-tidy-16" "clang-tidy-15" "clang-tidy-14" "clang-tidy-13" "clang-tidy") | ||
if(${WITH_CLANG_TIDY}) | ||
find_program(CLANG_TIDY_CACHE_BIN NAMES "clang-tidy-cache") | ||
find_program( | ||
CLANG_TIDY_BIN NAMES "clang-tidy-17" "clang-tidy-16" "clang-tidy-15" | ||
"clang-tidy-14" "clang-tidy-13" "clang-tidy") | ||
|
||
if (CLANG_TIDY_CACHE_BIN) | ||
set (CLANG_TIDY_PATH "${CLANG_TIDY_CACHE_BIN};${CLANG_TIDY_BIN}" CACHE STRING "Cache for clang-tidy") | ||
else() | ||
set (CLANG_TIDY_PATH "${CLANG_TIDY_BIN}") | ||
endif () | ||
if(CLANG_TIDY_CACHE_BIN) | ||
set(CLANG_TIDY_PATH | ||
"${CLANG_TIDY_CACHE_BIN};${CLANG_TIDY_BIN}" | ||
CACHE STRING "Cache for clang-tidy") | ||
else() | ||
set(CLANG_TIDY_PATH "${CLANG_TIDY_BIN}") | ||
endif() | ||
|
||
if (CLANG_TIDY_PATH) | ||
message (STATUS "Find clang-tidy: ${CLANG_TIDY_PATH}.") | ||
else () | ||
message (FATAL_ERROR "clang-tidy is not found") | ||
endif () | ||
if(CLANG_TIDY_PATH) | ||
message(STATUS "Find clang-tidy: ${CLANG_TIDY_PATH}.") | ||
else() | ||
message(FATAL_ERROR "clang-tidy is not found") | ||
endif() | ||
endif() |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# check glibc version, assign to GLIBC_VERSION | ||
|
||
set(CHECK_C_SOURCE_CODE | ||
" | ||
#include <stdio.h> | ||
#include <gnu/libc-version.h> | ||
int main() { | ||
const char* version = gnu_get_libc_version(); | ||
printf(\"%s\\n\", version); | ||
return 0; | ||
} | ||
") | ||
file(WRITE ${CMAKE_BINARY_DIR}/check_c_source.c "${CHECK_C_SOURCE_CODE}") | ||
execute_process( | ||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_BINARY_DIR}/check_c_source.c -o | ||
${CMAKE_BINARY_DIR}/check_c_source RESULT_VARIABLE compile_result) | ||
if(compile_result EQUAL 0) | ||
execute_process( | ||
COMMAND ${CMAKE_BINARY_DIR}/check_c_source | ||
OUTPUT_VARIABLE GLIBC_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
message("GLIBC version: ${GLIBC_VERSION}") | ||
else() | ||
message(FATAL_ERROR "Failed to get the glibc version") | ||
endif() |