Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to create arm prebuilds #96

Merged
merged 55 commits into from
Oct 30, 2022
Merged

Try to create arm prebuilds #96

merged 55 commits into from
Oct 30, 2022

Conversation

martenrichter
Copy link
Member

No description provided.

@martenrichter martenrichter linked an issue Oct 29, 2022 that may be closed by this pull request
@achingbrain
Copy link
Contributor

Well this is tedious - https://boringssl.googlesource.com/boringssl/+/546093ca4a6b2bf9b7c29018687d53f8a2ad428a/CMakeLists.txt#300

In the olden times (e.g. during the ppc -> intel switch) you'd use a tool called lipo to make a universal binary from a ppc and an intel build. If boringssl only supports building one arch at a time that might be necessary?

@martenrichter
Copy link
Member Author

Well this is tedious - https://boringssl.googlesource.com/boringssl/+/546093ca4a6b2bf9b7c29018687d53f8a2ad428a/CMakeLists.txt#300

In the olden times (e.g. during the ppc -> intel switch) you'd use a tool called lipo to make a universal binary from a ppc and an intel build. If boringssl only supports building one arch at a time that might be necessary.

Well, I have a problem, the lines did not turn cmake into multi-arch. So if boring does not support it anyway, I should cross-compile..., ok, I try again..... (sadly I did not find if one can access the arm GitHub runner beta test)

@achingbrain
Copy link
Contributor

achingbrain commented Oct 29, 2022

Ok so lipo is still bundled with XCode.

Certainly if I build this module locally I can create a universal binary from the arm64 version npm build creates and the x64 version downloaded from the latest release (I renamed the built webtransport.node file to webtransport_arm.node and the downloaded version to webtransport_x64.node to make it easier for me):

$ lipo -create webtransport_arm.node webtransport_x64.node -output webtransport.node
$ file webtransport.node 
webtransport.node: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
webtransport.node (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64
webtransport.node (for architecture arm64):     Mach-O 64-bit dynamically linked shared library arm64

The universal binary works for running the tests in this module (previously needing an arm64 build for me locally) and also in my libp2p test harness which for tedious reasons runs through rosetta so needs a x86_64 build.

@martenrichter
Copy link
Member Author

Ok so lipo is still bundled with XCode.

Certainly if I build this module locally I can create a universal binary from the arm64 version npm build creates and the x64 version downloaded from the latest release (I renamed the built webtransport.node file to webtransport_arm.node and the downloaded version to webtransport_x64.node to make it easier for me):

$ lipo -create webtransport_arm.node webtransport_x64.node -output webtransport.node
$ file webtransport.node 
webtransport.node: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
webtransport.node (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64
webtransport.node (for architecture arm64):     Mach-O 64-bit dynamically linked shared library arm64

The universal binary works for running the tests in this module (previously needing an arm64 build for me locally) and also in my libp2p test harness which for tedious reasons runs through rosetta so needs a x86_64 build.

I try now if I can cross-compile, but than we will have separate binaries.

@martenrichter martenrichter changed the title Try to create universal binaries for mac Try to create arm prebuilds Oct 30, 2022
@martenrichter
Copy link
Member Author

Should work now...

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.

Building on M1/M2 Macs
2 participants