Is @lukasa 's latest upload is faulty? I'm suddenly getting this error...
pi@satserver:~/SatServer $ swift build
Fetching https://github.com/curuvar/SwiftyGPIO.git from cache
Fetched https://github.com/curuvar/SwiftyGPIO.git (0.91s)
Fetching https://github.com/apple/swift-nio.git from cache
Skipping cache due to an error: Couldn’t fetch updates from remote repositories:
Fetching origin
error: object file ./objects/b2/195f797354eddd4c76804654d75b138e1affb1 is empty
error: object file ./objects/b2/195f797354eddd4c76804654d75b138e1affb1 is empty
fatal: loose object b2195f797354eddd4c76804654d75b138e1affb1 (stored in ./objects/b2/195f797354eddd4c76804654d75b138e1affb1) is corrupt
error: Could not fetch origin
Fetched https://github.com/apple/swift-nio.git (14.38s)
Computing version for https://github.com/apple/swift-nio.git
Computed https://github.com/apple/swift-nio.git at 2.38.0 (1.07s)
Creating working copy for https://github.com/apple/swift-nio.git
Working copy of https://github.com/apple/swift-nio.git resolved at 2.38.0
Creating working copy for https://github.com/curuvar/SwiftyGPIO.git
Working copy of https://github.com/curuvar/SwiftyGPIO.git resolved at Safe-I2C
[5/29] Compiling CNIOLinux shim.c
This appears to be an issue in your connection to GitHub: I'm not having any of the same issues. Can you try throwing away your .build directory and rebuilding clean?
So I wonder what my problem is. I do know I damaged 6 GPIOs, but that was over a week ago and I've built many times since then, including yesterday. I guess you won't be able to help me any further, so thank you for responding so quickly.
SwiftPM has a relatively new global cache. The default location for it is ~/.swiftpm which includes a link to ~/Library/Caches/org.swift.swiftpm. You might want to try to delete that cache and try again.
Thank you @dnadobba for your suggestion. My ~/.swiftpm points to /home/pi/.cache/org.swift.swiftpm. The build still hangs at 5/29] Compiling CNIOLinux shim.c.
Next I tried removing ~/.cache and ~/.swiftpm which was not a good idea...
pi@satserver:~/SatServer $ swift build
error: unexpected top-level node
error: unable to load build file
warning: failed to load the cached build description: fatalError
pi@satserver:~/SatServer $
I suppose the next step is to re-install Swift and see what else I can screw up.
Oh, I'm sorry for the tip that destroyed your Swift installation. I don't have any experience with Swift on a raspberry pi but @fabianfett might be able to give you some advice.
Don't worry about that. It was probably when I became more advantageous. Set backs like these are always frustrating, but they do force one to learn a little more.
For what it's worth, a very simple way to "install" swift on linux is to download the right tarball from Swift.org - Download Swift depending on your OS, and then just unzip it It is ready to use from there, you can move the files to / since the directory structure matches it (/usr etc).
We want to make the installation experience easier but for now that's probably the simplest.
At the time I started this project I tried all the various versions of Ubuntu, but I couldn't figure out which version I should use and if they would work with I2C and 1-Wire. I decided to use the upcoming beta 64bit Bullseye, with the knowledge that it would be 100% compatible with a Raspberry Pi 4B.
But since discovering GPIO has moved into the linux kernel, my view could change - if and when someone writes a Swift binding for this. Python has one, but Python is far more popular than Swift. SWift.org are hoping to change the server World without realising there are far more Raspberrys out there than data centres - something Apple lost interest in many years ago.
I chose Swift because it's new and exciting, but also because SwiftUi on a Mac looks far better than any Python UI I've seen. It's just unfortunate that it's incredibly slow when the screen is bigger that an iPhone.