Skip to content

Conversation

@Ninja3047
Copy link
Collaborator

build_dependencies.sh works locally for when cross compiling to x64 from an M1
hopefully it just works in the other direction as well

@Ninja3047 Ninja3047 linked an issue Aug 4, 2022 that may be closed by this pull request
@Ninja3047 Ninja3047 force-pushed the will/cross-compile-for-m1-in-ci branch 6 times, most recently from 46f4dfa to a87a94c Compare August 4, 2022 18:07
@Ninja3047 Ninja3047 marked this pull request as draft August 4, 2022 20:10
@Ninja3047 Ninja3047 added the ci Continuous integration label Aug 4, 2022
@Ninja3047 Ninja3047 force-pushed the will/cross-compile-for-m1-in-ci branch 3 times, most recently from 3d3065a to 400f9a9 Compare August 5, 2022 17:53
Ninja3047 and others added 4 commits August 8, 2022 11:59
update workflow to cross compile for m1

add arm64-osx-rel triplet

temporarily remove aws runners
Host triplet is really only used for providing tools that need to be run
on the host, so Debug doesn't really make sense.

This also saves a lot of disk space and compile time
@Ninja3047 Ninja3047 force-pushed the will/cross-compile-for-m1-in-ci branch 2 times, most recently from 4960800 to 5192b45 Compare August 8, 2022 20:53
@Ninja3047 Ninja3047 force-pushed the will/cross-compile-for-m1-in-ci branch from 5192b45 to 49f015e Compare August 8, 2022 21:06
@ekilmer
Copy link
Collaborator

ekilmer commented Aug 24, 2022

@Ninja3047 Have you tested whether this PR works with the latest commit using my fixes for protobuf cross compilation?

I have an x86 mac but I don't have an ARM mac to test the built product.

If this works for you, then I want to submit the fixes upstream to vcpkg.

@Ninja3047
Copy link
Collaborator Author

cat ~/Projects/cxx-export/vcpkg_macos-11_llvm-14_xcode-13.0_arm64/installed/arm64-osx-rel/share/flatbuffers/FlatbuffersConfig.cmake

include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersTargets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersSharedTargets.cmake" OPTIONAL)

include("${CMAKE_CURRENT_LIST_DIR}/../../../x64-osx-rel/share/flatbuffers/FlatcTargets.cmake")

hrmm flatbuffers appears to have an issue

@Ninja3047
Copy link
Collaborator Author

@Ninja3047
Copy link
Collaborator Author

Ninja3047 commented Aug 25, 2022

  Target "Runtime" links to:

    gRPC::upb

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

get this error when building a library that links grpc using the exported artifacts
works fine with the natively compiled install directory

@ekilmer
Copy link
Collaborator

ekilmer commented Aug 29, 2022

Thanks for testing and investigating... I believe we're in uncharted territory, so there will be bugs like this.

I'll remove the line you mentioned here #958 (comment)

@ekilmer
Copy link
Collaborator

ekilmer commented Aug 29, 2022

  Target "Runtime" links to:

    gRPC::upb

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

get this error when building a library that links grpc using the exported artifacts works fine with the natively compiled install directory

Hmmmm. I'll have to investigate this a bit more. gRPC is patched to use a separate upb package but I haven't dug into much yet. The patch is likely missing some additional fixes.

@Ninja3047 Ninja3047 force-pushed the will/cross-compile-for-m1-in-ci branch from 1e78ff6 to 13391c2 Compare September 1, 2022 15:23
@Ninja3047
Copy link
Collaborator Author

tested on M1 with Rellic/Anvill and Remill

@Ninja3047 Ninja3047 marked this pull request as ready for review September 1, 2022 18:34
@Ninja3047 Ninja3047 requested a review from ekilmer September 1, 2022 18:35
Copy link
Collaborator

@ekilmer ekilmer left a comment

Choose a reason for hiding this comment

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

Looks good aside from using the vcpkg fork!

@CLAassistant
Copy link

CLAassistant commented Sep 29, 2022

CLA assistant check
All committers have signed the CLA.

@Ninja3047 Ninja3047 requested a review from ekilmer September 30, 2022 14:15
@ekilmer
Copy link
Collaborator

ekilmer commented Oct 12, 2022

The LLVM 15 error is coming due to LLVM using the wrong libzstd. I reproduced locally and it's not using zstd from vcpkg, so it produces an error

ld: warning: ignoring file /usr/local/lib/libzstd.1.5.2.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:

Copy link
Collaborator

@ekilmer ekilmer left a comment

Choose a reason for hiding this comment

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

LGTM! Waiting on CI

@ekilmer ekilmer merged commit 3c1932d into master Oct 13, 2022
@ekilmer ekilmer deleted the will/cross-compile-for-m1-in-ci branch October 13, 2022 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross compile for M1 in CI

4 participants