I'm on Fedora 43 and trying to get Swift to work. Even basic commands like swift package resolve on a fresh project error. Here's the full set of commands I ran (starting in /home/bbrk24/workspace):
mkdir swift-test
cd swift-test
swift package init
swift package resolve -v
I see that the linker is blowing up with "cannot find -lgcc_s", but shouldn't it be parsing that as a flag and looking for something like /lib*/libgcc_s.so*, not a file called -lgcc_s in the current directory? In fact I do have both /lib/libgcc_s.so.1 and /lib64/libgcc_s.so.1.
(This particular output is if I install Swift via Swiftly and tell it to set up as if for Fedora 39. If I instead sudo dnf install swift-lang, I get a very similar error, but the output isn't identical -- the linker it chooses is different, but it still says "cannot find -lgcc_s".)
Thank you both for the suggestions! I'm not at my computer right now but I'll be able to test it later today.
Some relevant information I didn't include in the original post:
I'll have to double-check that I have everything on that list. swift repl works now, but it didn't at first -- I had to manually install Python. So it's very probable I'm missing another package on that list as well.
If I install Swift through dnf, I see the warnings mentioned in the other post in addition to the error I mentioned here. The output above, which does not include those warnings, is what I see iff I install it via swiftly.
The SwiftPM build of the package manifest is failing to find a fairly basic binutils object file, which suggests either something wrong with your local installation of those tool dependencies or how swiftly is using it.
Ok, so the problem is with the Swift clang install interacting with the system libraries, nothing specific to Swift here. There was some work in swift-driver to delegate to the system clang by @etcwilde, I wonder if that would help here: try installing the system clang package and check if it has the same problem, and if not, try SwiftPM again and see if it picks up the system clang instead.
Thanks for checking that. I went back and looked at Evan's pulls and it appears that while the intention was to defer to the system clang, they ended up just using the Swift clang, as there was a system clang that invoked the bfd linker instead, which doesn't work with the Swift runtime. Obviously, when the Swift clang is misconfigured like this, that won't help.
This is obviously a bit of a complicated question, ie when it is better to defer to the system clang versus the Swift-forked clang and Swiftly has not figured out the balance on newer Fedora.
Maybe paste your log output on that Swiftly issue, and chip in on fixing it if you have the time and knowledge.
Just wanted to add to all of this. I did a brand new Fedora 43 install on my machine with Swiftly 1.1.1 and got the RHEL UBI 9 toolchain installed. It seems to work fine….so I’m guessing something on your environment is being used which must be causing your issues…
Just got back to my computer. Changing it from Fedora 39 to RHEL 9 and reinstalling Swift didn't help. I'll take a look at the links @Finagolfin provided aboce.