Uncommon / Xit

Mac OS X Git GUI
Other
981 stars 46 forks source link

Crash on launch - missing libssh2.dylib #479

Open undecoded-coder opened 2 years ago

undecoded-coder commented 2 years ago

This project looks really interesting. Unfortunately, downloading 1.0b16 from the Releases page I am unable to launch the application.

From the crash report:

...
Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: /usr/local/opt/libssh2/lib/libssh2.1.dylib
Referenced from: /Applications/Xit.app/Contents/MacOS/Xit
Reason: tried: '/usr/local/opt/libssh2/lib/libssh2.1.dylib' (no such file), '/usr/local/lib/libssh2.1.dylib' (no such file), '/usr/lib/libssh2.1.dylib' (no such file)
(terminated at launch; ignore backtrace)

Application Specific Information:
Library not loaded: /usr/local/opt/libssh2/lib/libssh2.1.dylib
Referenced from: /Applications/Xit.app/Contents/MacOS/Xit
Reason: tried: '/usr/local/opt/libssh2/lib/libssh2.1.dylib' (no such file), '/usr/local/lib/libssh2.1.dylib' (no such file), '/usr/lib/libssh2.1.dylib' (no such file)
...

If there is something I missed in order for it to run I would appreciate any help (though I couldn't find anything specific in the README or Issues).

Uncommon commented 2 years ago

Which version of macOS are you running?

Uncommon commented 2 years ago

It looks like I have libssh2 installed via Homebrew. I'll look into incorporating that into the build. Sorry about that.

undecoded-coder commented 2 years ago

Which version of macOS are you running?

macOS 12.2.1 (latest)

undecoded-coder commented 2 years ago

I’ll look into installing libssh2 later then. I did install libgit2 via Homebrew per the CONTRIBUTING instructions (though that is for building the source of course, not running it) since it seemed related but it didn’t have any effect.

undecoded-coder commented 2 years ago

As a follow up, it turns out I did have libssh2 installed (as a dependency of libgit2), however it was not in one the expected search paths, nor compatible when I tried copying it to one, both due to being installed for ARM64 (on an M1 Mac), while Xit is running through Rosetta and expects an x86 dylib.

After installing Homebrew for the x86 architecture and installing the x86 version of libssh2 the app finally launches. 🎉

Uncommon commented 2 years ago

Glad you got it working!

I'm still puzzling over this because it shouldn't have been looking for the dylib in the first place. The Xcode project explicitly links to libssh2.a, not .dylib, and fails to build without it.

On the other hand, libgit2 apparently builds with a reference to the dylib. So I just don't fully understand the linking situation.

barijaona commented 2 years ago

For the record, to build Xib, I had to install cmake and libssh2 through Homebrew. (macOS Monterey).

JanX2 commented 2 years ago

otool -L Xit.app/Contents/MacOS/Xit shows that a Xit build depends on this (experimental M1 build): "/opt/homebrew/opt/libssh2/lib/libssh2.1.dylib" This likely is similar on x86_64. Maybe we can get cmake/the linker to use "/opt/homebrew/lib/libssh2.a" or equivalent instead?

The reason for this is likely instructing cmake to "-DLIBSSH2_INCLUDE_DIRS:PATH=/opt/homebrew/include/" (or equivalent).