Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
UltimaTerra opened this issue Sep 3, 2024 · 7 comments
Open

Comments

@UltimaTerra
Copy link

UltimaTerra commented Sep 3, 2024

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
Copy link
Member

furby-tm commented Sep 3, 2024

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
Copy link
Author

UltimaTerra commented Sep 3, 2024

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 🤷

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
Copy link
Author

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
Copy link
Member

furby-tm commented Sep 5, 2024

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
Copy link
Member

furby-tm commented Sep 5, 2024

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

@furby-tm furby-tm changed the title Malformed input json; plugin declared with buildtool but doesnt conform to buildtoolplugin Arch Linux: Malformed input json; plugin declared with buildtool but doesnt conform to buildtoolplugin Sep 5, 2024
@furby-tm furby-tm changed the title Arch Linux: Malformed input json; plugin declared with buildtool but doesnt conform to buildtoolplugin Arch Linux: Swift bug; malformed input json, build tool plugins Sep 5, 2024
@furby-tm
Copy link
Member

furby-tm commented Sep 5, 2024

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.

@UltimaTerra
Copy link
Author

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.

I am sorry for getting back to you late, I totally understand. Yeah, to be honest, I kind of am/still struggling with the swift package manager. Not just with this project, I am also on a new system so I can try a rebuild soon.
I am not sure if I can fix it, since I am kind of just lost on the swift pm in general. I will see if I can get help with the forums , since the more I try to use it, the more hurdles I get.
I think since there isn't anything I can do to try and fix since 'I don't know', Can one of us close this? If I get it rebuilding, i will let you know either on discord or, uhh elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants