You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there any plans to make a release with new M1 cpu ?
I don't want to ask only, because I started to build it with CI action as first step #203
but this cascading git submodules makes it not easier
Reacted by Gilles Piou, Bill Doughty, Piet Brauer-Kallenberg, alpercoskun, Grant Gongaware, Emiliano Mancuso and Francis Gulotta
What's more concerning is that Homebrew moved to /opt/homebrew from /usr/local on ARM. This is a nightmare because there are hundreds of hard references in the project to /usr/local. I spent an hour trying to work through it but I'm not experienced enough in Xcode or our scripts and dependencies. I suspect we need to update our dependencies to support ARM and then it won't be hard to link against them.
I spent some time looking at libgit2 and objective-git and neither seems to have any PRs or issues open around this.
Ultimately, it's unclear what the best practices are for cross platform builds with two "standard" directories now.
So the challenge is how do we support cross compiling, right? Your diff at a glance looks like what I tried to do, but this will only build on ARM, and not macs with intel brew installs.
I asked in the brew community what the intended solution is to this and they had no real answers. I'm surprised they'd make such a big change without much of a support plan, especially a change that really isn't required with Rosetta 2.
Am I missing anything? I'll give your instructions a try soon, and we can publish a beta build for M1 users.
I gave it a go! I haven't debugged this much, wondering if you encountered this issue?
λ ./Scripts/build.py debug
Building scheme GitX (debug), please wait…
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006001-000209380C04801E }
{ platform:macOS, arch:x86_64, id:00006001-000209380C04801E }
{ platform:macOS, name:Any Mac }
** BUILD FAILED **
The following build commands failed:
Ld /Users/jspiro/Coding/Github/gitx/build/Debug/ObjectiveGit.framework/Versions/A/ObjectiveGit normal (in target 'ObjectiveGit-Mac' from project 'ObjectiveGitFramework')
(1 failure)
Traceback (most recent call last):
File "./Scripts/build.py", line 40, in <module>
args.func(args)
File "./Scripts/build.py", line 31, in build_cmd
build(project)
File "./Scripts/build.py", line 14, in build
helpers.xcodebuild(project.scheme(), project.workspace(), project.current_build_config(), ["build"], project.build_base_dir())
File "/Users/jspiro/Coding/Github/gitx/Scripts/helpers.py", line 53, in xcodebuild
raise BuildError(str(e))
helpers.BuildError: Command '['xcrun', 'xcodebuild', '-workspace', u'GitX.xcworkspace', '-scheme', u'GitX', '-configuration', 'Debug', 'build', 'BUILD_DIR=/Users/jspiro/Coding/Github/gitx/build']' returned non-zero exit status 65
Not clear what's wrong. I did find more references to /usr in e.g. libgit2 and other places. Any chance there are more patches needed, or other brew packages required?
Can you try running xcrun xcodebuild -workspace GitX.xcworkspace without the build.py wrapper? I can't actually see what the error is from that output.
Cross-compiling is tricky because you will have to build everything up the dependency chain: Objective-Git, libgit2, libssh2, etc. I'm having to do this currently with pygit2 and it's a pain. Hopefully one day there will be GitHub Apple silicon runners...
<rant>Re cross-compiling, I meant moreso it's not clear how to have an xcode project, for example, that can link equally for ARM or X86, given these paths are hard-coded in hundreds of places. I suppose you'd have to duplicate all targets separately for ARM and X86 to have different paths... which is ridiculous, and breaks a decade of open source for Mac. I really don't get why brew did this–they say /usr is for Intel-only... but contextually, on an ARM system, wouldn't it just have ARM code? I'd assume the architecture would be implicit. But I digress.</>
Ah, cool, that's more useful output. I learned something! I ran this: xcrun xcodebuild -workspace ObjectiveGitFramework.xcworkspace -scheme 'ObjectiveGit Mac'
Attaching the changes I have had to make so far and the build output. It's a linker error with libssh2 not having ARM versions, despite it being ARM-native on Monterey:
lipo -archs /opt/homebrew/lib/libssh2.a
arm64
There's probably an Xcode setting I am not familiar with to select the right arch in linking. Search for the word warning and you'll see it.
So I'm wondering how it works on your system. Did you, perhaps, migrate from an Intel to M1 from a backup? I am on a new MBP with a clean install, perhaps why I cannot build it.
diff --git a/script/update_libgit2 b/script/update_libgit2
index 15123174..f26927e2 100755
--- a/script/update_libgit2
+++ b/script/update_libgit2
@@ -2,10 +2,10 @@
set -e
-# augment path to help it find cmake installed in /usr/local/bin,
-# e.g. via brew. Xcode's Run Script phase doesn't seem to honor
+# augment path to help it find cmake installed by e.g. brew.
+# Xcode's Run Script phase doesn't seem to honor
# ~/.MacOSX/environment.plist
-PATH="/usr/local/bin:$PATH"
+PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
if [ "External/libgit2.a" -nt "External/libgit2" ]
then
Not sure if all of the previous diff lines are required, but this definitely is (on my system, since cmake installs into /opt as well).
So, what do we think are next steps? Ideally we could do a Universal binary and we'd be golden. Unclear if this would work on GitHub Actions, but it's the first promising lead I found: actions/runner-images#2187 (comment)
We should get someone else with an M1 to try out the changes and test the builds. But then we need an experienced Xcode developer (maybe you!) to guide the right approach for this: we need something that is mergeable without breaking non-ARM builds.
And it's unclear what we do with ObjectiveGit along the same lines. It might be as simple as adding both /opt and /usr to the library search paths in both projects.
We can publish an ARM build ahead of that or off a branch to unblock folks moving to M1s.
I just tried the above build and got terminated (on 12.0.1)
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: /opt/homebrew/*/libcrypto.3.dylib
Referenced from: /Applications/GitX.app/Contents/Frameworks/ObjectiveGit.framework/Versions/A/ObjectiveGit
Reason: tried: '/opt/homebrew/*/libcrypto.3.dylib' (no such file), '/usr/local/lib/libcrypto.3.dylib' (no such file), '/usr/lib/libcrypto.3.dylib' (no such file)
(terminated at launch; ignore backtrace)
I assume it fails to find the library that is expected to come from homebrew - but libcrypto is not even mentioned here:
$ otool -L GitX.app/Contents/MacOS/GitX
GitX.app/Contents/MacOS/GitX:
@loader_path/../Frameworks/MGScopeBar.framework/Versions/A/MGScopeBar (compatibility version 1.0.0, current version 1.0.0)
@rpath/Sparkle.framework/Versions/A/Sparkle (compatibility version 1.6.0, current version 1.24.0)
@rpath/ObjectiveGit.framework/ObjectiveGit (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 612.1.29)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60157.30.13)
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1163.30.6)
/System/Library/Frameworks/ScriptingBridge.framework/Versions/A/ScriptingBridge (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
/System/Library/Frameworks/Quartz.framework/Versions/A/Quartz (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1141.1.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1853.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2103.13.10)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1853.0.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1557.1.1)
I just tried the above build and got terminated (on 12.0.1)
FYI my colleague @kwkwan ran into this issue today. Installation of brew OpenSSL is required to run the build provided above as it tries to load /opt/homebrew/*/libcrypto.3.dylib (as per #204 (comment)).
Activity
hannesa2 commentedon Nov 22, 2020
And I've too less Mac developer experience so I don't know why I don't see an
armtarget ?jspiro commentedon Nov 17, 2021
What's more concerning is that Homebrew moved to
/opt/homebrewfrom/usr/localon ARM. This is a nightmare because there are hundreds of hard references in the project to/usr/local. I spent an hour trying to work through it but I'm not experienced enough in Xcode or our scripts and dependencies. I suspect we need to update our dependencies to support ARM and then it won't be hard to link against them.I spent some time looking at libgit2 and objective-git and neither seems to have any PRs or issues open around this.
Ultimately, it's unclear what the best practices are for cross platform builds with two "standard" directories now.
jspiro commentedon Nov 17, 2021
GitX also won't load on an M1 due to this:
hannesa2 commentedon Nov 17, 2021
Can you share your (intermediate) work as a pull request ?
jspiro commentedon Nov 17, 2021
I ended up throwing away my attempts, it wasn't getting anywhere and I was making a mess of things 🙈
I have to figure out a way to run GitX on my M1, though. I'm lost without it 😭
simoncozens commentedon Nov 25, 2021
I got this working, but it is not easy to rework as a pull request because it requires changes to the external ObjectiveGit framework.
Here's what I did:
External/objective-git, patch the Xcodeproj file:Scripts/build.py. This should give you a debug build. (I couldn't get a release build working).hannesa2 commentedon Nov 25, 2021
@simoncozens Nice, please don't hesitate to bring the stuff to https://github.com/gitx/objective-git as well as a pull request.
In the meantime, I try to find a solution to get it merged without an active maintainer there. (I'm only a member there and no maintainer)
jspiro commentedon Nov 25, 2021
Nice work!
So the challenge is how do we support cross compiling, right? Your diff at a glance looks like what I tried to do, but this will only build on ARM, and not macs with intel brew installs.
I asked in the brew community what the intended solution is to this and they had no real answers. I'm surprised they'd make such a big change without much of a support plan, especially a change that really isn't required with Rosetta 2.
Am I missing anything? I'll give your instructions a try soon, and we can publish a beta build for M1 users.
jspiro commentedon Nov 26, 2021
I gave it a go! I haven't debugged this much, wondering if you encountered this issue?
Not clear what's wrong. I did find more references to
/usrin e.g. libgit2 and other places. Any chance there are more patches needed, or other brew packages required?simoncozens commentedon Nov 26, 2021
Can you try running
xcrun xcodebuild -workspace GitX.xcworkspacewithout the build.py wrapper? I can't actually see what the error is from that output.Cross-compiling is tricky because you will have to build everything up the dependency chain: Objective-Git, libgit2, libssh2, etc. I'm having to do this currently with pygit2 and it's a pain. Hopefully one day there will be GitHub Apple silicon runners...
jspiro commentedon Nov 26, 2021
<rant>Re cross-compiling, I meant moreso it's not clear how to have an xcode project, for example, that can link equally for ARM or X86, given these paths are hard-coded in hundreds of places. I suppose you'd have to duplicate all targets separately for ARM and X86 to have different paths... which is ridiculous, and breaks a decade of open source for Mac. I really don't get why brew did this–they say /usr is for Intel-only... but contextually, on an ARM system, wouldn't it just have ARM code? I'd assume the architecture would be implicit. But I digress.</>Ah, cool, that's more useful output. I learned something! I ran this:
xcrun xcodebuild -workspace ObjectiveGitFramework.xcworkspace -scheme 'ObjectiveGit Mac'Attaching the changes I have had to make so far and the build output. It's a linker error with libssh2 not having ARM versions, despite it being ARM-native on Monterey:
There's probably an Xcode setting I am not familiar with to select the right arch in linking. Search for the word
warningand you'll see it.diff.txt
out.txt
So I'm wondering how it works on your system. Did you, perhaps, migrate from an Intel to M1 from a backup? I am on a new MBP with a clean install, perhaps why I cannot build it.
jspiro commentedon Nov 26, 2021
I've noticed that
libgit2is building X86 libraries, perhaps this is related:jspiro commentedon Nov 26, 2021
I figured it out:
Not sure if all of the previous diff lines are required, but this definitely is (on my system, since cmake installs into /opt as well).
jspiro commentedon Nov 26, 2021
Here is a release build based on the above:
GitX.app.zip
jspiro commentedon Nov 26, 2021
So, what do we think are next steps? Ideally we could do a Universal binary and we'd be golden. Unclear if this would work on GitHub Actions, but it's the first promising lead I found:
actions/runner-images#2187 (comment)
We should get someone else with an M1 to try out the changes and test the builds. But then we need an experienced Xcode developer (maybe you!) to guide the right approach for this: we need something that is mergeable without breaking non-ARM builds.
And it's unclear what we do with ObjectiveGit along the same lines. It might be as simple as adding both /opt and /usr to the library search paths in both projects.
We can publish an ARM build ahead of that or off a branch to unblock folks moving to M1s.
1 remaining item
hannesa2 commentedon Nov 26, 2021
❤️
Please @jspiro can you make pullrequests/branches to have a chance to follow what you did exactly ?
jspiro commentedon Nov 26, 2021
Yep, I am just finding a minimal set of required changes.
jspiro commentedon Nov 26, 2021
Done:
#234
gitx/objective-git#15
tcurdt commentedon Dec 3, 2021
I just tried the above build and got terminated (on 12.0.1)
I assume it fails to find the library that is expected to come from homebrew - but
libcryptois not even mentioned here:Why that path?
hannesa2 commentedon Dec 3, 2021
@tcurdt Please try this steps #234 (comment) and tell me what you see
tcurdt commentedon Dec 3, 2021
@hannesa2 I've added the error to #234. Linking fails for me with those steps.
ronaldtse commentedon Dec 16, 2021
FYI my colleague @kwkwan ran into this issue today. Installation of brew OpenSSL is required to run the build provided above as it tries to load
/opt/homebrew/*/libcrypto.3.dylib(as per #204 (comment)).hannesa2 commentedon Dec 16, 2021
Just for your info: I already added openssl gitx/objective-git#16 but the M1 branch doesn't include it
ronaldtse commentedon Dec 16, 2021
Thank you @hannesa2 !
hannesa2 commentedon Feb 13, 2022
I applied all changes to recent master and we are able to build with x86 too, but when I try build local on my M1
xcodebuild -workspace GitX.xcworkspace -scheme GitX -archivePath ./GitX archive ARCHS="arm64"@jspiro @ronaldtse @felixpalmer @tcurdt
Please can you try this ?
Does someone knows how to get rid of it ?
hannesa2 commentedon Feb 13, 2022
After this #273 the recent master looks like this on my M1
hannesa2 commentedon Feb 13, 2022
It builds now locally with a M1 #275
Thanks a lot @claytonrcarter !
hannesa2 commentedon Feb 13, 2022
Now there is a
arm64release https://github.com/gitx/gitx/releases/tag/0.18ronaldtse commentedon Feb 14, 2022
Thank you @hannesa2 for making this available!