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

build in linux with clang toolchain #1789

Merged
merged 1 commit into from
Jul 22, 2023
Merged
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
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-DOS_MACOSX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -ldl -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++ -fuse-ld=lld -lc++ -lc++abi ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_CXX_FLAGS "-stdlib=libc++ -pthread ${CMAKE_CXX_FLAGS}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(CMAKE_CXX_FLAGS "-pthread -Wl,--no-as-needed -ldl")
Expand Down Expand Up @@ -223,7 +224,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
LOG_INSTALL
1
CONFIGURE_COMMAND
<SOURCE_DIR>/configure --prefix=${STAGED_INSTALL_PREFIX} --enable-minidebuginfo=no --enable-zlibdebuginfo=no
<SOURCE_DIR>/configure --prefix=${STAGED_INSTALL_PREFIX} --enable-minidebuginfo=no --enable-zlibdebuginfo=no --enable-shared=no
BUILD_IN_SOURCE
1
BUILD_COMMAND
Expand Down Expand Up @@ -487,6 +488,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DGPERFTOOLS_BUILD_STATIC=ON
-DEFAULT_BUILD_MINIMAL=ON
-Dgperftools_build_benchmark=OFF
BUILD_COMMAND
make -j${CPU_CORE}
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review:

  1. Line 62: In the elseif condition for GNU CXX compiler, it sets CMAKE_CXX_FLAGS with -pthread -Wl,--no-as-needed -ldl. This line seems fine.

  2. Lines 59-61: In the if condition for Clang CXX compiler on Linux, it sets CMAKE_EXE_LINKER_FLAGS and CMAKE_CXX_FLAGS. The changes include adding -stdlib=libc++ and -fuse-ld=lld, which specify the C++ standard library and linker respectively. These changes should be fine if you intend to use libc++ and lld as the standard library and linker for Clang.

  3. Lines 223-224: It adds the --enable-shared=no flag during the configure step in the Linux section. This flag disables building shared libraries. If this is the desired behavior, then it is fine.

  4. Lines 487-488: It adds the -Dgperftools_build_benchmark=OFF flag during the configuration of GPerftools build on Linux. This flag disables building the benchmark component of GPerftools. If you don't need the benchmark, it is fine.

Overall, the code changes appear reasonable and seem to address specific requirements based on the platforms and dependencies being used. However, without additional context or knowledge of specific bug risks or improvement goals, it is challenging to provide more detailed suggestions.

Expand Down
Loading