File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
test/Interop/Cxx/stdlib/overlay Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,13 @@ add_swift_target_library(swiftstd ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_OVE
139
139
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
140
140
-Xfrontend -enable-experimental-cxx-interop
141
141
-Xfrontend -module-interface-preserve-types-as-written
142
-
143
- LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS} " -lc++
144
- TARGET_SDKS ALL_APPLE_PLATFORMS # TODO: support other platforms as well
142
+ # GCC on Linux is usually located under `/usr`.
143
+ # However, Ubuntu 20.04 ships with another GCC installation under `/`, which does not include libstdc++.
144
+ # Swift build scripts pass `--sysroot=/` to Clang. By default, Clang tries to find GCC installation under sysroot,
145
+ # and if it doesn't exist, under `{sysroot}/usr`. On Ubuntu 20.04 and newer, it attempts to use the GCC without the
146
+ # C++ stdlib, which causes a build failure. To fix that, we tell Clang explicitly to use GCC from `/usr`.
147
+ -Xcc --gcc-toolchain=/usr
148
+
149
+ LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS} "
150
+ TARGET_SDKS ALL_APPLE_PLATFORMS LINUX # TODO: support other platforms as well
145
151
INSTALL_IN_COMPONENT sdk-overlay )
Original file line number Diff line number Diff line change 1
1
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-cxx-interop)
2
2
//
3
3
// REQUIRES: executable_test
4
- // REQUIRES: OS=macosx
4
+ // REQUIRES: OS=macosx || OS=linux-gnu
5
5
6
6
import StdlibUnittest
7
7
import std
You can’t perform that action at this time.
0 commit comments