Skip to content

Commit

Permalink
build: fix static build error when compiling with Clang on Linux
Browse files Browse the repository at this point in the history
This patch fixes the following error when building tarantool statically
with Clang compiler on a Linux system:

    error: argument unused during compilation: '-static-libstdc++'

Fixes tarantool#9646

NO_DOC=build issue
NO_TEST=build issue
NO_CHANGELOG=build issue
  • Loading branch information
ylobankov committed Feb 5, 2024
1 parent d29234a commit 64afe49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmake/CheckDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ elseif(UNIX)
libgcc_s
libpthread
libsvace
libstdc++
)
else()
message(FATAL_ERROR "Unknown platform")
Expand Down
8 changes: 4 additions & 4 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ endif()
option(ENABLE_BUNDLED_LIBUNWIND "Bundled libunwind will be built"
${ENABLE_BUNDLED_LIBUNWIND_DEFAULT})

# On macOS there is no '-static-libstdc++' flag and it's use will
# raise following error:
# error: argument unused during compilation: '-static-libstdc++'
if(BUILD_STATIC AND NOT TARGET_OS_DARWIN)
# In Clang there is no '-static-libstdc++' flag and its use will raise
# the following error:
# clang: error: argument unused during compilation: '-static-libstdc++'
if(BUILD_STATIC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Static linking for c++ routines
add_compile_flags("C;CXX" "-static-libstdc++")
endif()
Expand Down

0 comments on commit 64afe49

Please sign in to comment.