Bluetooth: Unable to compile under Swift 4.1.1 on Raspberry Pi

I am running the latest Raspbian Stretch on a Pi 3b+ with Swift 4.1.1 installed from https://packagecloud.io/swift-arm/test?page=1

I upgraded Package.swift to Swift 4, rearranged the directory structure to match, fixed few random incompatibilities (e.g. flatMap -> compactMap, etc) and encountered:

swift: /home/linaro/RaspberryPi/buildSwiftOnARM/swift/lib/Serialization/Serialization.cpp:617: TypeID swift::serialization::Serializer::addTypeRef(swift::Type): Assertion `!ty->hasError() && "Serializing error type"' failed.
[snip stack dump]
1.	While serializing type 'τ_0_1'
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: merge-module command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /usr/bin/swift-build-tool -f /home/XXXX/Bluetooth/.build/debug.yaml test -v output:

This seems to be the same compiler bug as: https://bugs.swift.org/browse/SR-6754

By playing around I think I have tracked it down to the compiler getting confused on the default static var in BluetoothHostControllerInterface, though its not clear why it would.

When I remove that variable and its definition in the protocol extension, compilation proceeds normally.

Has anyone else gotten Bluetooth compiling under swift 4.1?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I’m not sure it’s a good first issue, when the resolution is “fix the compiler” 😉

git cherry-pick -m 1 26905602f9832c2861024090b684b586883589e7 is the commit that fixes the compiler.

I can do a PR for that if its helpful.