-
Notifications
You must be signed in to change notification settings - Fork 142
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
CNIOBoringSSL compiler error on armv6 armv7 Linux using clang 3.8 #148
Comments
@wlisac oh, this is surprising. Swift stuff will actually only work correctly if the clang used is the clang that ships with Swift. Since Swift 5.0, Your errors look like in the ARM toolchain the wrong clang is selected. Next to |
@wlisac btw, it's best to never install the host distribution's clang and always use the one that comes with Swift. |
@wlisac you might be seeing https://bugs.swift.org/browse/SR-10633 |
The problem is that no, on Linux/ARMv* we don't, same thing for libicu/libcxx, right now the stuff from the host is being used. I did a quick attempt at identifying the reason but couldn't understand why both are missing and not copied when needed (e.g. at least when SPM is being built, in the case of libicu). So, unreadable description above aside, there is something broken on linux/arm where we copy clang and a few other components like libicu and libcxx to build the toolchain. Edit: rephrased,sorry. |
@weissi yeah, hopefully we can move away from using the host system's clang in the near future, but as @uraimo mentioned this has been a non-trivial task so far on armv6 / armv7 Linux. In the meantime, it seems like BoringSSL should still be able to compile using clang 3.8, but I totally understand if fixing this is out of scope for SwiftNIO SSL. Unfortunately, for the time being, we're a bit stuck being unable to use SwiftNIO SSL on armv6 / armv7 devices where the host system uses clang 3.8. As an aside, the aarch64 (armv8 64 bit) toolchain by futurejones/swift-arm64 does include Swift's clang and SwiftNIO SSL works as expected since #141 was merged. |
@wlisac hmm, that’s really unfortunate that Swift on ARM isn’t actually a full Swift distribution. Clang 3.8 is over 3 years old and I’m not sure where we should draw the line on what’s supported and what not. The official Swift distributions all ship a clang that matches the ClangImporter that swiftc uses internally. Mixing a very recent ClangImporter (contained in swiftc) with a 3 years old clang seems very fragile and works more by accident than by design, all the sanitizers won’t work either because they require all the compilers to be updated in lockstep. I understand that this probably isn’t the answer you wanted to hear. Does vanilla BoringSSL work with these old clangs? CC @Lukasa WDYT? |
@uraimo ok, thanks for the explanation. Is there already a Swift bug for this? I feel we need to really fix Swift here rather than adding workarounds to NIO SSL. |
Vanilla BoringSSL does not work on Clang 3.8 on armv6/armv7. This is not to say that it couldn't, just that it doesn't. My gut feel is that the BoringSSL team are unlikely to do this work themselves, but they might accept a patch that does it. That's not necessarily going to be easier than trying to bring along a better clang in Swift on ARM, in particular dealing with the ASM issue which seems fairly profound. |
@weissi @Lukasa – yeah, makes sense and sounds fair to me. For clarity, the Swift on ARM toolchains for aarch64 are full Swift distributions that include clang. I think for now I can work around this on armv6 / armv7 by using Ubuntu Bionic with clang 6 or by using Debain Buster with clang 7. Thanks for taking the time to look into this and provide input 🙂 should we close this issue? |
@wlisac up to you really. It seems that the fixes need to come from the BoringSSL or Swift on armv7 teams and probably not us. But I'm also happy keeping this issue around because the title is not wrong, it just isn't in scope for us to fix. |
I'm attempting to build SwiftNIO SSL on armv6 and armv7 Linux, but I'm running into a couple compiler errors with Swift 5.1 and Swift 5.0.1.
The issue appears to be specific to using a clang 3.8 compiler. Ideally we'd be using clang 7 (which is what ships with official Swift 5 releases), but we're currently stuck using clang 3.8 with some ARM toolchains / Linux distributions.
I've discussed this a bit with @Lukasa and it looks like an issue with BoringSSL.
Steps to Reproduce
One way to reproduce the errors is to compile SwiftNIO SSL using Docker Desktop for macOS with armv6 and armv7 base images. Docker Desktop for macOS will use qemu to emulate the architecture.
I maintain Docker images for Swift on ARM at wlisac/swift-on-balena that we can use for the base images.
Dockerfile
armv7, Swift 5.1, Ubuntu Bionic, clang version 6.0.0-1ubuntu2
✅ Builds successfully.
docker build --build-arg FROM_IMAGE=wlisac/armv7hf-ubuntu-swift:5.1-bionic-build .
armv7, Swift 5.0.1, Ubuntu Bionic, clang version 6.0.0-1ubuntu2
✅ Builds successfully.
docker build --build-arg FROM_IMAGE=wlisac/armv7hf-swift-ubuntu:5.0.1-bionic-build .
armv7, Swift 5.1, Ubuntu Xenial, clang version 3.8.0-2ubuntu4
❌
hrss.c
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/armv7hf-ubuntu-swift:5.1-xenial-build .
armv7, Swift 5.0.1, Ubuntu Xenial, clang version 3.8.0-2ubuntu4
❌
hrss.c
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/armv7hf-ubuntu-swift:5.0.1-xenial-build .
armv7, Swift 5.1, Debian Stretch, clang version 3.8.1-24
❌
hrss.c
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/armv7hf-debian-swift:5.1-stretch-build .
armv7, Swift 5.0.1, Debian Stretch, clang version 3.8.1-24
❌
x25519-asm-arm
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/armv7hf-debian-swift:5.0.1-stretch-build .
armv6, Swift 5.1, Debian Stretch, clang version 3.8.1-24+rpi1
❌
x25519-asm-arm
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/rpi-swift:5.1-build .
armv6, Swift 5.0.1, Debian Stretch, clang version 3.8.1-24+rpi1
❌
x25519-asm-arm
build error (see below)docker build --build-arg FROM_IMAGE=wlisac/rpi-swift:5.0.1-build .
Errors
hrss.c
build errorx25519-asm-arm
build errorThe text was updated successfully, but these errors were encountered: