caketop / python-starlark-go

🐍 Python bindings for starlark-go 🐍
https://python-starlark-go.readthedocs.io/
Apache License 2.0
20 stars 7 forks source link

Abandon macos universal2 builds for arch-specific builds #134

Closed colindean closed 1 year ago

colindean commented 1 year ago

After messing with #131 for too long, @jordemort suggested a simpler route: ditch universal builds and stick to separate arches. This became easier after realizing that we'd need to use some tooling to combine the arm64 and x86_64 artifacts into one universal2 binary using lipo, and that would necessitate more changes to the build than it's worth.

Closes #131

colindean commented 1 year ago

Still didn't do it.

$ file /Users/colin/Downloads/artifact/starlark_go-0.1.3.dev2-cp311-cp311-macosx_11_0_arm64/starlark_go/starlark_go.cpython-311-darwin.so
/Users/colin/Downloads/artifact/starlark_go-0.1.3.dev2-cp311-cp311-macosx_11_0_arm64/starlark_go/starlark_go.cpython-311-darwin.so: Mach-O 64-bit dynamically linked shared library x86_64
colindean commented 1 year ago

https://github.com/caketop/python-starlark-go/actions/runs/3971303726/jobs/6808045882#step:5:200 in which I attempted to set GOARCH explicitly based on the CIBW_ARCH gives me a go build error I've not seen.

jordemort commented 1 year ago

I got this working locally:

After that I was able to run cibuildwheel locally and produce what look like proper x86_64 and arm64 wheels for macOS.

Let's see if it works in CI. My Mac is an M1 Pro but I know GitHub's runners are still Intel boxes, so the cross-compiling will be happening the other way in CI.

jordemort commented 1 year ago

@colindean This seems ready-to-go; if you could grab the wheel out of https://github.com/caketop/python-starlark-go/actions/runs/3981639195 (download the "Artifacts" zip and they'll all be in there) and give me the "Works On My Machine" certification, then I'll merge this.

colindean commented 1 year ago
$ wheel unpack starlark_go-0.1.3.dev12-cp311-cp311-macosx_11_0_arm64.whl 
Unpacking to: ./starlark_go-0.1.3.dev12...OK
$ file starlark_go-0.1.3.dev12/starlark_go/starlark_go.cpython-311-darwin.so 
starlark_go-0.1.3.dev12/starlark_go/starlark_go.cpython-311-darwin.so: Mach-O 64-bit dynamically linked shared library arm64
$ rm -rf starlark_go-0.1.3.dev12
$ wheel unpack starlark_go-0.1.3.dev12-cp311-cp311-macosx_10_9_x86_64.whl
Unpacking to: ./starlark_go-0.1.3.dev12...OK
$ file starlark_go-0.1.3.dev12/starlark_go/starlark_go.cpython-311-darwin.so 
starlark_go-0.1.3.dev12/starlark_go/starlark_go.cpython-311-darwin.so: Mach-O 64-bit dynamically linked shared library x86_64

This should work!

colindean commented 1 year ago

🎉

jordemort commented 1 year ago

I put i686 builds back and went ahead and tagged 1.0.0 since this seems settled enough that I'm not going to want to upend the API any time soon. I'll write a blog post about it tomorrow.

jordemort commented 1 year ago

1.0.0 blog post here: https://jordemort.dev/blog/python-starlark-go-1.0.0/

colindean commented 1 year ago

Thanks for the mention in the write-up!