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

SwiftGen 6.5.1 crash (installed via Mint) #905

Closed
goodocy opened this issue Dec 1, 2021 · 7 comments
Closed

SwiftGen 6.5.1 crash (installed via Mint) #905

goodocy opened this issue Dec 1, 2021 · 7 comments

Comments

@goodocy
Copy link

goodocy commented Dec 1, 2021

Hi.
Make a good tool, so I always use it well

Crash problems are found and reported.

image.yml

xcassets:
  inputs:
    - Resource/Test.xcassets
  outputs:
    - templateName: swift5
      output: Image/Image.swift

then

SwiftGenCLI/resource_bundle_accessor.swift:11: Fatal error: could not load resource bundle: from /Users/user/.mint/bin/SwiftGen_SwiftGenCLI.bundle or /private/var/folders/hy/_f54gj0n1ns2dttw7d19rl0m0000gn/T/mint/github.com_SwiftGen_SwiftGen/.build/arm64-apple-macosx/release/SwiftGen_SwiftGenCLI.bundle
[1]    74018 trace trap  swiftgen config run --config image.yml

and i found same result ( happens anywhere (with or without swiftgen.yml ) )

swiftgen template list
SwiftGenCLI/resource_bundle_accessor.swift:11: Fatal error: could not load resource bundle: from /Users/user/.mint/bin/SwiftGen_SwiftGenCLI.bundle or /private/var/folders/hy/_f54gj0n1ns2dttw7d19rl0m0000gn/T/mint/github.com_SwiftGen_SwiftGen/.build/arm64-apple-macosx/release/SwiftGen_SwiftGenCLI.bundle
[1]    74610 trace trap  swiftgen template list

after a little analysis, I got some hints

swiftgen bin

lrwxr-xr-x  1 user  staff    80B Dec  1 19:52 swiftgen -> /Users/user/.mint/packages/github.com_SwiftGen_SwiftGen/build/6.5.1/swiftgen
/Users/user/.mint/packages/github.com_SwiftGen_SwiftGen/build/6.5.1
drwxr-xr-x  3 user  staff    96B Dec  1 19:52 SwiftGen_SwiftGenCLI.bundle
-rwxr-xr-x  1 user  staff   5.1M Dec  1 19:52 swiftgen

And after moving to the actual path

./swiftgen template list -> success
swiftgen template list -> fail

It seems that swiftgen does not properly recognize the SwiftGen_SwiftGenCLI.bundle path when installing with mint

please check

@djbe
Copy link
Member

djbe commented Dec 2, 2021

Hi @goodocy

There seems to be something wrong with your installation, the path to the bundle that Swift is trying to load is wrong. Note that SwiftGen doesn't do this, the system (Swift / SPM) does it for us.

Mint itself does not support SPM resource bundles yet, so we had to add a workaround for it with our 6.5.0 release, which was fixed in 6.5.1. See the issue here and the related Mint issue.

Make sure you're using the latest Mint version, and if needed reinstall it & SwiftGen. If the issue persists, I'd recommend creating an issue in the Mint repo.

@djbe djbe changed the title SwiftGen 6.5.1 Crash issue ( via mint ) SwiftGen 6.5.1 crash (installed via Mint) Dec 2, 2021
@djbe djbe added the duplicate label Dec 2, 2021
@psiwork
Copy link

psiwork commented Dec 14, 2021

Same problem for me.

@daidongon
Copy link

daidongon commented Dec 20, 2021

me too in 6.5.1.

@djbe
Copy link
Member

djbe commented Feb 4, 2022

As I said before, this is (afaik) a Mint issue, not a SwiftGen issue. Going to close this for now.

@djbe djbe closed this as completed Feb 4, 2022
@Fab1n
Copy link

Fab1n commented Nov 6, 2022

I think this issue still is not resolved in any way, even if it hasn't anything to do with SwiftGen. It doesn't work and we need to think about a possible fix or at least a workaround. What do you think guys?

Here is the essence of the issue:
~/.mint/bin contains a symlink called swiftgen which links to the actual bin ~/Users/letsbundle/.mint/packages/github.com_SwiftGen_SwiftGen/build/6.6.2/swiftgen.
Alongside with swiftgen in the original bin path SwiftGen_SwiftGenCLI.bundle is located.

When calling swiftgen from commandline somehow the binary/swift/spm expects SwiftGen_SwiftGenCLI.bundle to be located inside ~/.mint/bin/ where the symlink is located.

Copying the bundle to ~/.mint/bin/ solves the crash.

This needs another fix in some way.

Env:

mint --version
Version: 0.17.2
swiftgen --version
SwiftGen v6.6.2 (Stencil v0.15.1, StencilSwiftKit v2.10.1, SwiftGenKit v6.6.2)

@knox
Copy link

knox commented Mar 7, 2023

I second @Fab1n that this issue is not resolved or suffering a regression.

❯ mint --version
Version: 0.17.5
❯ swiftgen --version
SwiftGen v6.6.2 (Stencil v0.15.1, StencilSwiftKit v2.10.1, SwiftGenKit v6.6.2)

Workaround

❯ ln -s ~/.mint/packages/github.com_SwiftGen_SwiftGen/build/6.6.2/SwiftGen_SwiftGenCLI.bundle ~/.mint/bin/SwiftGen_SwiftGenCLI.bundle

@cassianomonteiro
Copy link

I'm also facing this issue. The workaround worked for me.

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

No branches or pull requests

7 participants