Skip to content

Commit 18941d4

Browse files
authored
Merge pull request #21087 from drodriguez/avoid-double-cxx-linking-5.0
[android] Avoid linking twice with C++
2 parents 1a3637c + 035c8db commit 18941d4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ function(_add_variant_link_flags)
428428
list(APPEND result "-Wl,-Bsymbolic")
429429
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
430430
list(APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift")
431+
# We provide our own C++ below, so we ask the linker not to do it. However,
432+
# we need to add the math library, which is linked implicitly by libc++.
433+
list(APPEND result "-nostdlib++" "-lm")
431434
if("${LFLAGS_ARCH}" MATCHES armv7)
432435
list(APPEND result "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so")
433436
elseif("${LFLAGS_ARCH}" MATCHES aarch64)

0 commit comments

Comments
 (0)