Browse Source
With newer xcode (12+, I think), the default behaviour is to build universal binaries that include native code for both arm64 and x86_64. On older xcode, the default was to only target x86_64. I am not sure why, but "hid.cpython-310-darwin.so" is not built reproducibly when it is "universal". (Even for consecutive builds done on the same machine.) ``` - + diff='Files /tmp/electrum_compare_dmg/signed_app/Electrum.app/Contents/MacOS/hid.cpython-310-darwin.so and /tmp/electrum_compare_dmg/dmg2/Electrum.app/Contents/MacOS/hid.cpython-310-darwin.so differ ``` This commit works around the reproducibly issue by making clang only build for the x86_64 target. The binary should still be able to run on arm64 macs using rosetta (same with previous versions of Electrum). ----- The `lipo` tool can tell what archs a shared object is built for, e.g.: ``` $ lipo -info /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so Non-fat file: /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so is architecture: x86_64 ``` For quick testing, we don't need to build the whole .app, only hid.so: ``` source /Users/vagrant/electrum/contrib/osx/build-venv/bin/activate export CFLAGS="-g0" python3 -m pip install -I --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location hidapi==0.14.0 strip -x /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so cp /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so /Users/vagrant/wspace/tmp/try7/hid10.so ``` Re ARCHFLAGS env var, see https://stackoverflow.com/a/5808548 ----- Note: I've found several xcode build settings that looked relevant but in the end were not useful, e.g. ARCHS, ONLY_ACTIVE_ARCH, EXCLUDED_ARCHS, VALID_ARCHS. - see https://developer.apple.com/documentation/technotes/tn3117-resolving-build-errors-for-apple-silicon - see https://stackoverflow.com/a/64422757master
1 changed files with 4 additions and 0 deletions
Loading…
Reference in new issue