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

cibuildwheel: Add macOS arm64 support #7727

Draft
wants to merge 1 commit into
base: RC_2_0
Choose a base branch
from

Conversation

xavier2k6
Copy link
Contributor

@xavier2k6 xavier2k6 commented Aug 9, 2024

Closes #7308.
Closes #7536.
Closes #7650.
Closes #7683.
Closes #7729.

@xavier2k6
Copy link
Contributor Author

Note/Review: pypa/cibuildwheel#1926 (comment)

@xavier2k6 xavier2k6 force-pushed the wheel_macos_arm64 branch 3 times, most recently from b8a644f to 2519f14 Compare August 9, 2024 16:42
@xavier2k6
Copy link
Contributor Author

@qstokkink Can you give the created wheels a test?

@xavier2k6
Copy link
Contributor Author

@xavier2k6 xavier2k6 force-pushed the wheel_macos_arm64 branch 2 times, most recently from 6934d07 to bc511c5 Compare August 9, 2024 21:49
@qstokkink
Copy link

@qstokkink Can you give the created wheels a test?

Works on my machine. 👍

On behalf of the Tribler team, I would like to request you to keep {"os": "macos-12", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "x86_64"} in the workflow dispatch matrix though.

@xavier2k6
Copy link
Contributor Author

@qstokkink

  1. I've added macOS-12/x86_x64 architecture with Python 3.9 to pull_request matrix for testing purposes (this can probably be removed again, once you've tested)
  2. Have included macOS-12/x86_x64 architecture with Python * to workflow dispatch unless of course You/Tribler team only want Python 3.9/x86_x64 on macOS-12??

@xavier2k6 xavier2k6 force-pushed the wheel_macos_arm64 branch 2 times, most recently from fc34c3a to c8add64 Compare August 10, 2024 18:16
@xavier2k6 xavier2k6 marked this pull request as ready for review August 11, 2024 19:56
@qstokkink
Copy link

qstokkink commented Aug 12, 2024

Thanks 👍 and, "correct" to 2: I copied the wrong string.

@xavier2k6
Copy link
Contributor Author

@qstokkink Just so the Tribler team are aware macOS-12 images are considered Deprecated & will be Removed by end of year!
See: actions/runner-images#9255 or screenshot below.


300882082-ac6ef1f1-8e18-4af1-a97f-d38cf82885df

@qstokkink
Copy link

🤔 that's sad. It would be nice to get a PyPI release before that gets killed though.

@qstokkink
Copy link

@xavier2k6 considering the other closed issues, it looks like you can add #7729 to your "Closes" list.

@xavier2k6
Copy link
Contributor Author

manylinux2014 image may be dropped in a upcoming PR too by "cibuildwheel" repo., so may need to change to manylinux_2_28 but this may also drop older python versions but that is already on the cards by "cibuildwheel" repo.

@xavier2k6
Copy link
Contributor Author

@arvidn Regarding to OpenSSL 1.1.1 End Of Life


  1. Should wheels for Python <3.10 be dropped?

  1. What minimum OpenSSL 3.x.x version should be declared for below?

export OPENSSL_ROOT=openssl-1.1.1l
export OPENSSL_HASH=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1


  1. FORTIFY_SOURCE may be bumped to 3 if images are newer/all conditions/requirements are met.

MANYLINUX_CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2"

@xavier2k6 xavier2k6 force-pushed the wheel_macos_arm64 branch 10 times, most recently from 6069880 to 1c08548 Compare August 28, 2024 15:12
@DjLegolas
Copy link

@xavier2k6 please re-add MacOS to the pull request matrix (MATRIX_PULL_REQUEST) as the libtorrent must be also validated on it.

@xavier2k6
Copy link
Contributor Author

@DjLegolas I only removed macOS from pull request matrix to reduce building time while I test as I know they work.

When I am done, they will be re-added - don't worry.

@xavier2k6 xavier2k6 marked this pull request as draft September 6, 2024 09:27
Comment on lines +66 to +70
{"os": "windows-latest", "CIBW_BUILD": "cp*-win32"},
{"os": "windows-latest", "CIBW_BUILD": "cp*-win_amd64"}
Copy link
Owner

Choose a reason for hiding this comment

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

using windows-latest means that CI will probably break when that version changes. Is there a good reason to use this rather than the specific version of the runner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GHA CI use the latest (2) server editions....so 2019/2022 - latest = 2022, latest will eventually become 2025 a few months after being GA & 2019 will become obsolete/removed....at some stage the CI will eventually have to migrate away from obsolete/deprecated OS runners provided by github.

This will be the same for macOS-12 & also your linux CI will have to be changed as Ubuntu-20.04 will be removed soon too.

@xavier2k6
Copy link
Contributor Author

The only real show stopper here is the windows 32bit failure & to then re-instate the builds I took out while testing.

@qstokkink
Copy link

C:\Program Files\OpenSSL\lib\libcrypto.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files\OpenSSL\lib\libssl.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

Apparently, the 64-bit OpenSSL is found. AFAIK, GitHub Actions runners do not have 32-bit OpenSSL by default. So, you would need to make sure that the 32-bit version is downloaded and installed from somewhere.

Judging from the paths in /Jamfile (in rule openssl-lib-path and rule openssl-include-path), installing a 32-bit OpenSSL in C:/Program Files (x86)/OpenSSL-Win32 could magically fix this. If not, you would need to conditionally update the OPENSSL_LIB and OPENSSL_INCLUDE paths in the /Jamfile.

@xavier2k6
Copy link
Contributor Author

@arvidn I'll leave the OpenSSL 32bit installation to you, do you still want to support 32bit??

We also now have a definitive timeline for the deprecation of the macOS-12 runner
The macOS 12 Actions runner image will begin deprecation on 10/7/24 and will be fully unsupported by 12/3/24

@qstokkink
Copy link

@xavier2k6 Do you have time to experiment a bit with the win32 build? If we're lucky, it could be as simple as inserting the following at line 106 of cibuildwheel.yml:

- name: Install OpenSSL
  if: ${{ endsWith(matrix.CIBW_BUILD, 'win32') }}
  run: choco install openssl

If all checks are green/passing, it would be easier to merge this PR, I guess.

@xavier2k6
Copy link
Contributor Author

xavier2k6 commented Oct 8, 2024

@qstokkink i'll be able to give that a try in about 3hrs (got a spare few mins now to do it), action needs to be updated too & python 3.13 is gone GA.

@xavier2k6 xavier2k6 force-pushed the wheel_macos_arm64 branch 4 times, most recently from 0413058 to 1687adb Compare October 8, 2024 18:48
@xavier2k6
Copy link
Contributor Author

vcpkg is on the windows runners, this could be used to install openssl perhaps.....

@qstokkink
Copy link

@xavier2k6 Thanks for putting some time into this. Using vcpkg should also work, but the current setup was made for chocolatey:

libtorrent/Jamfile

Lines 442 to 446 in 790b662

# the de-facto windows installer is https://slproweb.com/products/Win32OpenSSL.html, which installs to c:\Program Files\OpenSSL-Win{32,64}.
# chocolatey appears to use this installer.
local address_model = [ feature.get-values <address-model> : $(properties) ] ;
OPENSSL_LIB += "C:/Program Files/OpenSSL-Win$(address_model)/lib" ;
OPENSSL_LIB += "C:/Program Files (x86)/OpenSSL-Win$(address_model)/lib" ;

libtorrent/Jamfile

Lines 473 to 474 in 790b662

OPENSSL_INCLUDE += "C:/Program Files/OpenSSL-Win$(address_model)/include" ;
OPENSSL_INCLUDE += "C:/Program Files (x86)/OpenSSL-Win$(address_model)/include" ;


Using your log output, switching the four paths to this should work:

if address_model = 32
{
    OPENSSL_LIB += "C:/vcpkg/packages/openssl_x86-windows-static-md/lib" ;
} else {
    OPENSSL_LIB += "C:/vcpkg/packages/openssl_x64-windows-static-md/lib" ;
}
if address_model = 32
{
    OPENSSL_INCLUDE += "C:/vcpkg/packages/openssl_x86-windows-static-md/include" ;
}  else {
    OPENSSL_INCLUDE += "C:/vcpkg/packages/openssl_x64-windows-static-md/include" ;
}

My Jam language is a bit rusty. So, this might need to be address_model = "32".

@xavier2k6
Copy link
Contributor Author

xavier2k6 commented Oct 9, 2024

@qstokkink Will make some changes later, will also need to make sure we use the right package as there's 3x release options I believe:
openssl:x86-windows-static
openssl:x86-windows-static-md
openssl:x86-windows

I'll have to look at vcpkg port/json files etc.

vcpkg gets updated each time there's a newer windows runner image released so that will bring newer versions of OpenSSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants