Giter Site home page Giter Site logo

Comments (13)

Kuro7070 avatar Kuro7070 commented on June 27, 2024 1

After entering your @stackotter command and trying to enter swift-format -v
I've got the following error message.
dyld[18324]: Library not loaded: '@rpath/lib_InternalSwiftSyntaxParser.dylib' Referenced from: '/usr/local/bin/swift-format' Reason: tried: '/usr/lib/swift/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/bin/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/lib/swift/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/bin/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/lib/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/lib/lib_InternalSwiftSyntaxParser.dylib' (no such file) zsh: abort swift-format -v

from swift-format.

allevato avatar allevato commented on June 27, 2024 1

I'm not sure what's causing the issues in the previous versions, but you may want to try out the just-released 508.0.0 version. It no longer depends on lib_InternalSwiftSyntaxParser.dylib nor does it have the requirement that it matches the specific version of the toolchain you're using (beyond being able to compile it in the first place).

(I don't control the Brew distribution, so you'd have to install it by downloading the release sources here and building them with swift build.)

from swift-format.

stackotter avatar stackotter commented on June 27, 2024

What commands did you use to install swift-format? My guess is that the built executable didn't get added/copied to your path. I believe you can fix that by running cp .build/release/swift-format /usr/local/bin/ inside the swift format directory. Another method would be to use Mint to install the tool, however Mint is not really being maintained anymore and I don't think it's the best to recommend it.

from swift-format.

Kuro7070 avatar Kuro7070 commented on June 27, 2024

I've used these commands
VERSION=0.50700.0 # replace this with the version you need git clone https://github.com/apple/swift-format.git cd swift-format git checkout "tags/$VERSION" swift build -c release
Yes, I also thought that my created executable could not be added to the path. I already tried to added it but it didn't work. But I have to say, I'm new to the apple universe, so maybe I did something wrong.
I will try your command, thx

from swift-format.

stackotter avatar stackotter commented on June 27, 2024

Hm had a feeling that might happen with my naive copy-to-path solution. You can installing it with Mint or replacing your command with the following (temporarily):

/path/to/repo/.build/release/swift-format lint -r -p --configuration formatConfig.json "${PROJECT_DIR}/ChatApp"

I'm interested why adding it to your path didn't work though, try running the following commands. Make sure to replace /path/to/repo with the correct absolute path to the swift format repo.

rm /usr/local/bin/swift-format
echo "\nexport PATH=\"$PATH:/path/to/repo/.build/release\"" >> ~/.zshenv

The first removes the swift-format binary we moved to your path of course, and the second adds the folder containing the built binary (and accompanying libraries) to your path.

You may need to restart Xcode for that to work.

from swift-format.

Kuro7070 avatar Kuro7070 commented on June 27, 2024

Sure, thx for the help @stackotter
If I add the complete path before the command, it works in xcode
/Users/zilke/Documents/swift-format/.build/release/swift-format lint -r -p --configuration formatConfig.json "${PROJECT_DIR}/ChatApp"

But the command swift-format stillt doesn't work
That is the command I tried. Just in case I did something wrong
echo "\nexport PATH=\"$PATH:/Users/zilke/Documents/swift-format/.build/release\"" >> ~/.zshenv

By mint, did you mean this project?
https://github.com/yonaskolb/Mint
Do you have any other ideas?

Is this a general problem or just in my case?

from swift-format.

stackotter avatar stackotter commented on June 27, 2024

If you run swift-format in terminal does that work? The issue could be that Xcode is ignoring the new addition to the path (not sure if it respects .zshenv, haven't used it in a while).

Mint is the only tool that I know of for installing Swift command line tools from source. There was talk about adding a swift install command to swiftpm, but that died away sadly.

from swift-format.

Kuro7070 avatar Kuro7070 commented on June 27, 2024

Unfortunatly the command swift-format doesn't work in the terminal.
Ok I'm going to speak to my teamleader about it.
But it is strange that it works after the installation via the brew command brew install swift-format

from swift-format.

stackotter avatar stackotter commented on June 27, 2024

Yeah that's strange, something weird is going on with your path. My only ideas for why that might be are: you're not using zsh (common on older macos versions), your terminal isn't causing ~/.zshenv to be loaded (dunno why that'd be), or the path addition command I gave you failed (you should check the contents of ~/.zshenv).

Hopefully your teamleader can help solve the issue, they should have more luck given they have access to the device 👍

from swift-format.

Wendell0817 avatar Wendell0817 commented on June 27, 2024

I'm having the same issue with XC 14.2. Other devs on my team using 14.1 have no issues with swift-format. Any updates on this @stackotter ?

from swift-format.

xavierliancw avatar xavierliancw commented on June 27, 2024

@Kuro7070, you should double check your ~/.zshenv file, checking to see if your command actually made it in. You may also have to do source ~/.zshenv or restart your computer.

The crux of your problem is that your freshly-compiled executable isn't visible to your $PATH. Adding it to your .zshenv should've done the trick though. (Although, I'm not actually sure what .zshenv does...)

I would've put into my ~/.zprofile if I wanted to modify my path (but that's not what I did).
I instead moved all relevant build artifacts to a folder I made, /Applications/Utilities/CLI/swift-format/.
Then I symlinked the main executable like so: ln -s /Applications/Utilities/CLI/swift-format/swift-format /usr/local/bin/swift-format.
That way I avoided messing with my $PATH, and it's a little closer to Linux conventions.

from swift-format.

Wendell0817 avatar Wendell0817 commented on June 27, 2024

@allevato thanks! 508.0.0 version is working for me!

from swift-format.

Kuro7070 avatar Kuro7070 commented on June 27, 2024

Hi guys, I tried again yesterday and now it works. I don't know why the command to change the bin folder didn't work for me the first time.
Solution:
enter this in your terminal
cp .build/release/swift-format /usr/local/bin/
cp .build/release/lib_InternalSwiftSyntaxParser.dylib /usr/local/bin/

And thank you for your help guys :)

from swift-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.