Brendonovich / swift-rs

Call Swift functions from Rust with ease!
Apache License 2.0
246 stars 28 forks source link

[Add] --arch flag to swift build command. #58

Closed MarvelousAnything closed 9 months ago

MarvelousAnything commented 9 months ago

I was having issues building Spacedrive. It was building libsd-desktop-macos.a to swift-rs/sd-desktop-macos/x86_64-apple-macosx instead of swift-rs/sd-desktop-macos/arm64-apple-macosx. This prevented it from linking. I did also confirm that it was compiling for arm64, not x86. I eventually found that adding the --arch flag to the swift build command in swift-rs fixed it. I have tested compiling it on an x86 and m1 Mac, and it does not break it.

Brendonovich commented 9 months ago

This is probably a good idea, but I'm curious whether you had the x86_64 rust toolchain on your m1 mac

MarvelousAnything commented 9 months ago

Yes. I do. I will try to build it after uninstalling the x86_64 toolchain. I will update you when I am done with that. If that fixes it, I will be more confused.

MarvelousAnything commented 9 months ago

Just recompiled it after uninstalling the x86_64 toolchain. My only toolchain now is aarch64-apple-darwin. It failed with the same issue. I did some debugging yesterday on this and narrowed it down to the specific swift build command. The funny thing is when I manually ran the command, it worked fine.