wabiverse / SwiftUSD

Pixar's universal scene description for swift and the open source metaverse.
https://wabiverse.github.io/SwiftUSD/documentation/pixarusd/
Other
55 stars 4 forks source link

Arch Linux: Swift bug; malformed input json, build tool plugins #15

Open UltimaTerra opened 1 week ago

UltimaTerra commented 1 week ago

Description of Issue

It seems after all the checkouts, the last part of the build stage flops on linux becuase of bad json data.

Steps to Reproduce

  1. I don't think I can reproduce, this looks like a build failure. (Maybe because I am using Arch Linux?) I did try package clean as a first step to troubleshoot, the build produces a similar error.

(Possibly?) I could cross-compare the package.swift, I have never seen the linking strategy the project uses. Usually, it is a var Cxx linker that binds the c/c++ .h or .hpp files.

System Information (OS, Hardware)

I am on Arch Linux, Garuda specifically. I am on an i5 7600k and x86. This could just be as simple as 'I am not supported on Linux'. (lts 6.6.47) and using XCFE on 4.18. Also in my experienced, build tools with my swift install have not been pleasant, hence the issue. Maybe the protocol just doesn't specify linux/windows? (even though I tried in the past to specify these versions in the past and the swift PM does not work.

Package Versions

I am using the most recent version with Swift 5.10

Build Log

/run/media/nicolt/853438f4-0e84-4b7b-afa3-c1fe74a31ff1/EXIT/MAIN PROJECTS/Sh7rine/Zahard/.build/checkouts/MetaverseKit/Package.swift:1661:16: note: did you mean 'Windows'?

elseif os(visionOS)

           ^~~~~~~~
           Windows

error: Malformed input JSON: Plugin declared with buildTool capability but doesn't conform to BuildToolPlugin protocol error: build stopped due to build-tool plugin failures

So if you run swift package clean and try to build again, you get this. 'rainbow': /run/media/nicolt/853438f4-0e84-4b7b-afa3-c1fe74a31ff1/EXIT/MAIN PROJECTS/Sh7rine/Zahard/.build/repositories/Rainbow-64aa5363 is not valid git repository for 'https://github.com/onevcat/Rainbow.git', will fetch again. warning: 'swift-syntax': /run/media/nicolt/853438f4-0e84-4b7b-afa3-c1fe74a31ff1/EXIT/MAIN PROJECTS/Sh7rine/Zahard/.build/repositories/swift-syntax-463e60c9 is not valid git repository for 'https://github.com/apple/swift-syntax.git', will fetch again.

(rainbow/swift syntax are valid repos though, so not sure what is about)

Edit: My deepest apologies, I know this is basically 'this doesnt work on my machine!', This might be an impatience issue on my part. I do have no idea what I am doing though. I could fork and try to build a local copy, see if something similar is produced.

EDIT 2: Okay, so this is what I get for not reading documentation. So if I read the SPM right, basically this is having trouble build in general with newer swift package manager? Is there a script instead I use?

furby-tm commented 1 week ago

Hey! Thanks for your interest in the SwiftUSD project.

This should build fine on Linux, however it’s quite a strange error that you’ve run into on Arch Linux! Out of curiosity what is the output of:

swift —-version

Perhaps you can get away with simply commenting out the plugin tool(s) [I believe there’s two] in the Package.swift manifest, but I’d like to ensure this works “out of the box” on Arch Linux as it does on Ubuntu and CentOS, so hopefully we can find a solution if this is a widespread issue occurring on Arch.

UltimaTerra commented 1 week ago

Hey! Thanks for your interest in the SwiftUSD project.

This should build fine on Linux, however it’s quite a strange error that you’ve run into on Arch Linux! Out of curiosity what is the output of:

swift —-version

Perhaps you can get away with simply commenting out the build plugin tool in the Package.swift manifest, but I’d like to ensure this works “out of the box” on Arch Linux as it does on Ubuntu and CentOS, so hopefully we can find a solution if this is a widespread issue occurring on Arch.

Totally understandable! Swift version 5.10.1 (swift-5.10.1-RELEASE) Target: x86_64-unknown-linux-gnu

What I should do is take the fork of the project and try to rebuild. I think it should be to try that to test. Gets me an excuse as well to try and build the same copy, but using git instead of swift :shrug:

I believe so too btw, strange error. I took it out of my personal package pm right now, but It literally built everything until it got to that part so that was just...odd. Anyway, let me know for any more insight!

EDIT: Update, so I decided to do a naive fork and swift build see what might tell me more about how the project is structured. This popped out much earlier, I don't want to copy all the errors yet, it would just be spam otherwise. fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. [38/3070] Compiling zstd_lazy.c (and then it exists terminal)

UltimaTerra commented 1 week ago

I tried to do a few things on my own repo, but to not luck. Do you have a community or are part of a swift community I can link with? I genuinely want to help

So I figured galah might be tripping the compiler since A. I am 5.10 and B. I think the swift pm does not build macros well (just my opinion, this isnt my first problem with the PM with specifically a macro or build tool on linux, god help me if I tried on Windows.) So I commented out, got way worse, so I am going to see what that is about. I am going to see and hope for this applemas that Swift 6 gets stable, then I can follow you up with more building. I think this is an issue with PM configuration specifically with an unknown linux target. I could be wrong. I noticed you use swift-bridge, so I tried 'cargo build' and hilariously (or ominously) i got the same errors from the swift PM, so I dont think it is an FFI or linking issue. This was expected behavior to me, iirc, swift-bridge is a rust+swift C glue generator, right? So all it should do is bind to USD c/c++ libs, I believe.

furby-tm commented 1 week ago

Do you have a community or are part of a swift community I can link with? I genuinely want to help

There is the ASWF slack, then go to the wg-swift channel.

And/or Swift Discord.

furby-tm commented 1 week ago

@UltimaTerra much easier to talk through those communities linked above than over GitHub.

furby-tm commented 1 week ago

I also reviewed your fork revision, I noticed a couple issues with your commenting out of the Package.swift manifest file that SwiftPM is now timing out and giving you that error message because the manifest syntax from that edit is incorrect.

With these massive SwiftPM Package.swift manifest files, you get almost zero help from the compiler or linter when errors do exist, which tends to add some confusion.