agardnerIT / tracepusher

Generate and push OpenTelemetry Trace data to an OTEL collector in JSON format
Apache License 2.0
53 stars 11 forks source link

Building universal2 binary on MacOS errors #60

Closed agardnerIT closed 1 year ago

agardnerIT commented 1 year ago

Background

Mac now offers two architectures: Intel-based chips and "apple silicon" aka M1 / M2 architecture.

PyInstaller offers the ability to build a universal2 binary which works on both architecture.

Problem

When building on arm mac with:

python3 -m PyInstaller --onefile tracepusher.py --target-arch universal2

I get this:

PyInstaller.utils.osx.IncompatibleBinaryArchError: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so is not a fat binary!

Research led me to this thread and in particular, this helpful thread where @machawk1 did lots of investigation (thanks!).

TLDR: Pinning chartset-normalizer < 3.0 fixes this. I also had to brew remove python then install Python via the universal2 binary from their website (this is mentioned on this page of the PyInstaller docs - search for "homebrew")

Related to #57