Skip to content

Apple Silicon support (it builds local too) - #25

Merged
hannesa2 merged 2 commits into
masterfrom
M1
Feb 9, 2022
Merged

hannesa2 merged 2 commits into
masterfrom
M1

Conversation

@hannesa2

@hannesa2 hannesa2 commented Feb 6, 2022

Copy link
Copy Markdown

Because there is no M1 runner, currently only a local build is possible.
It's based on #15

@hannesa2

hannesa2 commented Feb 6, 2022

Copy link
Copy Markdown
Author

This local build work on my side

@hannesa2 hannesa2 changed the title Apple Silicon support (builds local) Apple Silicon support (it builds local) Feb 6, 2022
@hannesa2
hannesa2 force-pushed the M1 branch 3 times, most recently from d0cdf64 to 2f14eff Compare February 6, 2022 15:30
@claytonrcarter

Copy link
Copy Markdown

I don't know much about xcode or these builds, but the link you posted me to UTM was very help to getting CI set up for gitx. FWIW, they appear to be building for arm64, and it looks like they're doing it via the build matrix and explicitly passing -arch ${{ matrix.arch }} to xcodebuild. Something like this:

      matrix:
        arch: [ x86_64 ]
        xcode: [ Xcode_12.5, Xcode_13.1, Xcode_13.2.1, Xcode_13.0, Xcode_12.4 ]
        include:
          - arch: arm64
            xcode: Xcode_13.2.1
...
      - name: Build project
        run: xcodebuild -workspace ObjectiveGitFramework.xcworkspace -scheme "ObjectiveGit Mac" -arch ${{ matrix.arch }} archive

I'm sure they're more to it, but perhaps this might be helpful?

@claytonrcarter

Copy link
Copy Markdown

Actually, they're doing 2 builds:

Both of those call into https://github.com/utmapp/UTM/blob/master/scripts/build_utm.sh, which looks like it ends up calling xcodebuild with -arch x86_64 -arch arm64 for the universal build. (ie it passes both -arch flags)

Again, I'm in over my head on this, and I don't even use an M1, but perhaps this will be helpful to you.

LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/usr/local/opt/openssl/lib,
/opt/homebrew/opt/openssl/lib,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all appear to be lists of locations to search. Instead of changing /usr/local/opt/openssl/lib to /opt/homebrew/opt/openssl/lib, can you just add it (to all of these locations) so that both are present? That way way the linker might be able to build using /usr/local/opt/openssl/lib but then load /opt/homebrew/opt/openssl/lib @ runtime. Perhaps this could help us get the gitx CI builds to run on x86 and M1?

Comment on lines +1699 to +1700
/usr/local/lib/libssh2.a,
/opt/homebrew/lib/libssh2.a,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about trying something like -lssh2, -L/usr/local/lib, -L/opt/homebrew/lib in these OTHER_LDFLAGS declarations?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm glad you got something to work.

@hannesa2 hannesa2 changed the title Apple Silicon support (it builds local) Apple Silicon support (it builds local too) Feb 9, 2022
@hannesa2

hannesa2 commented Feb 9, 2022 •

Copy link
Copy Markdown
Author

I moved to similar approach like with libgit2.a and it build locally with M1 as well.
If we find a better solution, we can change this anytime

@hannesa2
hannesa2 force-pushed the M1 branch 2 times, most recently from dcf6ca1 to d5795c6 Compare February 9, 2022 08:45
@hannesa2
hannesa2 merged commit 7db1fac into master Feb 9, 2022
@hannesa2
hannesa2 deleted the M1 branch February 9, 2022 09:00
@hannesa2 hannesa2 mentioned this pull request Feb 9, 2022
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

Successfully merging this pull request may close these issues.

2 participants