I only seem to be able to install Swift 5.1.5 on Raspbian GNU/Linux 10 (buster) so have set my dependency on NIO as .upToNextMinor(from: "2.29.0") since 2.30.0 requires 5.2. But when I build I get compile errors for missing symbols:
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:393:43: error: use of unresolved identifier 'SO_RCVTIMEO'
NIOBSDSocket.Option(rawValue: SO_RCVTIMEO)
^~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:404:43: error: use of unresolved identifier 'SO_TIMESTAMP'
NIOBSDSocket.Option(rawValue: SO_TIMESTAMP)
^~~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:393:43: error: use of unresolved identifier 'SO_RCVTIMEO'
NIOBSDSocket.Option(rawValue: SO_RCVTIMEO)
^~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:404:43: error: use of unresolved identifier 'SO_TIMESTAMP'
NIOBSDSocket.Option(rawValue: SO_TIMESTAMP)
^~~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:393:43: error: use of unresolved identifier 'SO_RCVTIMEO'
NIOBSDSocket.Option(rawValue: SO_RCVTIMEO)
^~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:404:43: error: use of unresolved identifier 'SO_TIMESTAMP'
NIOBSDSocket.Option(rawValue: SO_TIMESTAMP)
^~~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:393:43: error: use of unresolved identifier 'SO_RCVTIMEO'
NIOBSDSocket.Option(rawValue: SO_RCVTIMEO)
^~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:404:43: error: use of unresolved identifier 'SO_TIMESTAMP'
NIOBSDSocket.Option(rawValue: SO_TIMESTAMP)
^~~~~~~~~~~~
.build/checkouts/swift-nio/Sources/NIO/BSDSocketAPI.swift:393:43: error: use of unresolved identifier 'SO_RCVTIMEO'
NIOBSDSocket.Option(rawValue: SO_RCVTIMEO)
Any clues on what is missing for these symbols? TIA
What's the concern with installing later Swift versions on Raspbian?
pi@raspberrypi4:~ $ sudo apt upgrade swift5
Reading package lists... Done
Building dependency tree
Reading state information... Done
swift5 is already the newest version (5.1.5-v0.1).
I've tried upgrading via packagecloud but admit I'm not that familiar with apt and can't get it to install.
But it does look like I should be able to patch in this change, no?
Patching that in I get it to build on the Pi, but it fails before the bind on the Pi where it works ok on Mac.
init(port: UInt) {
listeningPort = port
// Set up the server using a Bootstrap
let bootstrap = ServerBootstrap(group: group)
// Define backlog and enable SO_REUSEADDR options atethe server level
.serverChannelOption(ChannelOptions.backlog, value: 256)
.serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
// Handler Pipeline: handlers that are processing events from accepted Channels
// To demonstrate that we can have several reusable handlers we start with a Swift-NIO default
// handler that limits the speed at which we read from the client if we cannot keep up with the
// processing through EchoHandler.
// This is to protect the server from overload.
.childChannelInitializer { channel in
channel.pipeline.addHandlers([BackPressureHandler(),TCPSocketClientHandler(channels: self.connectedChannels)])
}
// Enable common socket options at the channel level (TCP_NODELAY and SO_REUSEADDR).
// These options are applied to accepted Channels
.childChannelOption(ChannelOptions.socket(IPPROTO_TCP, TCP_NODELAY), value: 1)
.childChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
// Message grouping
.childChannelOption(ChannelOptions.maxMessagesPerRead, value: 16)
// Let Swift-NIO adjust the buffer size, based on actual trafic.
.childChannelOption(ChannelOptions.recvAllocator, value: AdaptiveRecvByteBufferAllocator())
// Bind the port and run the server
do {
channel = try bootstrap.bind(host: "0.0.0.0", port: Int(listeningPort)).wait()
print("Server started and listening on \(channel!.localAddress!)")
}
catch let error {
print("Server failed to start: \(error.localizedDescription)")
channel = nil
}
}
I simply get an Illegal Instruction before the binding call.
Hi. this is the first time I've ever able to offer help on this forum. I'm developing a server app on a Raspberry Pi 4, but I installed RaspiOS Lite Arm 64 Beta raspberrypi.org and everything I need is working just fine. Of course, this might has nothing to do with your Vapor problem.
I doubt this is a 32-bit vs 64-bit issue, I'm pretty sure you're hitting a fatalError of some kind. Can I recommend running this under a debugger and printing out the crashing call stack?