-
Notifications
You must be signed in to change notification settings - Fork 10.5k
A recent reorganization of the libc++ module map that shipped in NDK 27 broke building the Swift compiler and other C++ Interop #76325
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
Comments
We are in the process of significantly rewriting our modulemap in libc++: llvm/llvm-project#107638 This will yield significant compilation time speedups when using modules. IMO what we should do here (as far as trunk libc++ is concerned) is to keep moving towards that change and make sure that it doesn't break interop (in fact ideally it would fix the issues you're seeing). If we need to backport a partial fix to an already-released version of libc++, that's another story and I would tackle that separately. Do you see problems when using libc++ as it shipped with LLVM 19? Perhaps the NDK doesn't ship such a recent version yet? |
I have not tried it, but I see no differences in LLVM 19 using the
It doesn't. I saw your rewrite pull above soon after I opened this issue: I hope it fixes this. However, you all don't see this issue now when building the Swift toolchain with libc++ on other platforms? I don't see why this would only affect libc++ on Android. |
I will let Swift / interop folks answer this since I do not build the Swift toolchain myself. |
I just dumped some libc++ module maps from recent Xcode versions on the github CI, and it appears that this libc++ reorg commit was first shipped with Xcode 15.3 six months ago. Checking the macOS CI for which Xcode it uses to build this This suggests this has not hit macOS yet only because the CI is using an older libc++ module map, but once the CI updates to Xcode 15.3 or later, building the Swift compiler and C++ interop is going to break on macOS too. @shahmishal, just letting you know, perhaps you've already seen this problem. |
Can confirm also hitting this exact issue on FreeBSD 14.1, which ships clang/libc++ 18.1.5
I'm also able to work around this issue by applying the same patch to libc++ modulemap (at |
Description
I just tried building the Swift 6.1 trunk Sep.4 source snapshot natively on Android 13 AArch64 with the new Android NDK 27 sysroot and it failed with this linker error:
Modifying the libc++ module map like this got it to build again:
This worked fine when building the Aug. 6 trunk source snapshot with the NDK 26b sysroot last month, so I looked into it and that NDK did not ship with @ian-twilightcoder's reorganization of the libc++ module map from last summer, llvm/llvm-project@571178a21. NDK 27 ships with a lightly-patched version of that upstream libc++ module map, but I don't see anything when comparing their changes to the version in swiftlang/llvm-project that would cause this error.
I also see 11 newly failing C++ Interop tests from the Swift compiler validation suite, which all worked fine last month with NDK 26b:
Since the upstream libc++ reorg shipped with the LLVM 17 release last fall and there don't appear to be any fixes merged for this issue since, I assume this doesn't affect clang/C++, only Swift->C++ Interop, so I filed the issue here.
Reproduction
See commands pasted above
Expected behavior
No linker errors
Environment
Android 13 AArch64 in the Termux app
Additional information
I'll see what other module map changes get those 11 failing C++ Interop tests to build again. In the meantime, aren't there other environments using Swift with libc++ also that fail in this way?
@egorzhdan or @ldionne, in addition to Ian, let me know what you think.
The text was updated successfully, but these errors were encountered: