From 4f4eab5376d094cb376bc1690568299b325dae30 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:25:42 -0700 Subject: [PATCH 01/14] enable apple silicon builds --- .github/workflows/build_wheels.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 06c9e6029..94ff90e03 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -25,16 +25,16 @@ jobs: cibw-build: "cp311-manylinux_x86_64" - os: macos-11 python-version: "3.8" - cibw-build: "cp38-macosx_x86_64" + cibw-build: "cp38-macosx*" - os: macos-11 python-version: "3.9" - cibw-build: "cp39-macosx_x86_64" + cibw-build: "cp39-macosx*" - os: macos-11 python-version: "3.10" - cibw-build: "cp310-macosx_x86_64" + cibw-build: "cp310-macosx*" - os: macos-11 python-version: "3.11" - cibw-build: "cp311-macosx_x86_64" + cibw-build: "cp311-macosx*" steps: - uses: actions/checkout@v3 @@ -60,6 +60,9 @@ jobs: # bundle aws runner with linux wheel, remove environment variable TUPLEX_LAMBDA_ZIP to remove runner. CIBW_ENVIRONMENT_LINUX: "TUPLEX_LAMBDA_ZIP='./tuplex/python/tuplex/other/tplxlam.zip' CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' LD_LIBRARY_PATH=/usr/local/lib:/opt/lib" + # enable builds for both Intel and Apple Silicon based machines + CIBW_ARCHS_MACOS: x86_64 arm64 + # requires macOS 10.13 at least to build because of C++17 features. CIBW_ENVIRONMENT_MACOS: "CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' JAVA_HOME=${JAVA_HOME_11_X64}" From 549a6a76e3162be007cf301cad447cfc5949a107 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:28:26 -0700 Subject: [PATCH 02/14] restrict Apple Silicon builds to Python3.9+ --- .github/workflows/build_wheels.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 94ff90e03..e165cc98b 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -25,16 +25,25 @@ jobs: cibw-build: "cp311-manylinux_x86_64" - os: macos-11 python-version: "3.8" - cibw-build: "cp38-macosx*" + cibw-build: "cp38-macosx_x86_64" - os: macos-11 python-version: "3.9" - cibw-build: "cp39-macosx*" + cibw-build: "cp39-macosx_x86_64" - os: macos-11 python-version: "3.10" - cibw-build: "cp310-macosx*" + cibw-build: "cp310-macosx_x86_64" - os: macos-11 python-version: "3.11" - cibw-build: "cp311-macosx*" + cibw-build: "cp311-macosx_x86_64" + - os: macos-11 + python-version: "3.9" + cibw-build: "cp39-macosx_arm64" + - os: macos-11 + python-version: "3.10" + cibw-build: "cp310-macosx_arm64" + - os: macos-11 + python-version: "3.11" + cibw-build: "cp311-macosx_arm64" steps: - uses: actions/checkout@v3 @@ -60,9 +69,6 @@ jobs: # bundle aws runner with linux wheel, remove environment variable TUPLEX_LAMBDA_ZIP to remove runner. CIBW_ENVIRONMENT_LINUX: "TUPLEX_LAMBDA_ZIP='./tuplex/python/tuplex/other/tplxlam.zip' CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' LD_LIBRARY_PATH=/usr/local/lib:/opt/lib" - # enable builds for both Intel and Apple Silicon based machines - CIBW_ARCHS_MACOS: x86_64 arm64 - # requires macOS 10.13 at least to build because of C++17 features. CIBW_ENVIRONMENT_MACOS: "CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' JAVA_HOME=${JAVA_HOME_11_X64}" From 72a907f18750b2fc9e941c6727f6892486b8392a Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:30:36 -0700 Subject: [PATCH 03/14] hw matrix setup --- .github/workflows/build_wheels.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index e165cc98b..747a6c192 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -10,40 +10,52 @@ jobs: matrix: os: [ ubuntu-20.04, macos-11 ] python-version: ["3.8", "3.9", "3.10", "3.11"] + hw: ["x86_64", "arm64"] include: - os: ubuntu-20.04 python-version: "3.8" cibw-build: "cp38-manylinux_x86_64" + hw: "x86_64" - os: ubuntu-20.04 python-version: "3.9" cibw-build: "cp39-manylinux_x86_64" + hw: "x86_64" - os: ubuntu-20.04 python-version: "3.10" cibw-build: "cp310-manylinux_x86_64" + hw: "x86_64" - os: ubuntu-20.04 python-version: "3.11" cibw-build: "cp311-manylinux_x86_64" + hw: "x86_64" - os: macos-11 python-version: "3.8" cibw-build: "cp38-macosx_x86_64" + hw: "x86_64" - os: macos-11 python-version: "3.9" cibw-build: "cp39-macosx_x86_64" + hw: "x86_64" - os: macos-11 python-version: "3.10" cibw-build: "cp310-macosx_x86_64" + hw: "x86_64" - os: macos-11 python-version: "3.11" cibw-build: "cp311-macosx_x86_64" + hw: "x86_64" - os: macos-11 python-version: "3.9" cibw-build: "cp39-macosx_arm64" + hw: "arm64" - os: macos-11 python-version: "3.10" cibw-build: "cp310-macosx_arm64" + hw: "arm64" - os: macos-11 python-version: "3.11" cibw-build: "cp311-macosx_arm64" + hw: "arm64" steps: - uses: actions/checkout@v3 From 509406ece486bba5dcead7677ede697915da77ca Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:31:11 -0700 Subject: [PATCH 04/14] print status --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 747a6c192..441ce919c 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch] jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} - py ${{ matrix.python-version }} + name: Build wheel on ${{ matrix.os }} - py ${{ matrix.python-version }} - ${{ matrix.hw }} runs-on: ${{ matrix.os }} strategy: matrix: From 1a096f4616c6b00d3558495879e15fa476a89e59 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:34:03 -0700 Subject: [PATCH 05/14] matrix magic --- .github/workflows/build_wheels.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 441ce919c..e23748c2c 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -11,6 +11,12 @@ jobs: os: [ ubuntu-20.04, macos-11 ] python-version: ["3.8", "3.9", "3.10", "3.11"] hw: ["x86_64", "arm64"] + exclude: + - os: ubuntu-20.04 + hw: "arm64" + - os: macos-11 + python-version: "3.8"" + hw: "arm64" include: - os: ubuntu-20.04 python-version: "3.8" From 7b2239b28cb6c34ba595435c71fa566a96f79102 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sat, 14 Oct 2023 17:34:30 -0700 Subject: [PATCH 06/14] yaml fix --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index e23748c2c..141af55f4 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -15,7 +15,7 @@ jobs: - os: ubuntu-20.04 hw: "arm64" - os: macos-11 - python-version: "3.8"" + python-version: "3.8" hw: "arm64" include: - os: ubuntu-20.04 From c63d3db7547782e523addb7cd0e08e34c2bded42 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sun, 15 Oct 2023 20:44:49 -0700 Subject: [PATCH 07/14] test --- .github/workflows/build_wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 141af55f4..c2443db17 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -4,13 +4,13 @@ on: [push, pull_request, workflow_dispatch] jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} - py ${{ matrix.python-version }} - ${{ matrix.hw }} + name: Build wheel for ${{ matrix.cibw-build }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-20.04, macos-11 ] python-version: ["3.8", "3.9", "3.10", "3.11"] - hw: ["x86_64", "arm64"] + hw: [arm64"] #["x86_64", "arm64"] exclude: - os: ubuntu-20.04 hw: "arm64" @@ -52,7 +52,7 @@ jobs: hw: "x86_64" - os: macos-11 python-version: "3.9" - cibw-build: "cp39-macosx_arm64" + cibw-build: "cp38-macosx_arm64" hw: "arm64" - os: macos-11 python-version: "3.10" @@ -96,4 +96,4 @@ jobs: - uses: actions/upload-artifact@v3 with: path: | - ./wheelhouse/*.whl \ No newline at end of file + ./wheelhouse/*.whl From d2861b7e7a424f7884d1586298154745c25d8e00 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sun, 15 Oct 2023 20:48:35 -0700 Subject: [PATCH 08/14] test --- .github/workflows/build_wheels.yml | 103 +++++++++++++++-------------- 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index c2443db17..ea73a6508 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -8,60 +8,61 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, macos-11 ] - python-version: ["3.8", "3.9", "3.10", "3.11"] - hw: [arm64"] #["x86_64", "arm64"] - exclude: - - os: ubuntu-20.04 - hw: "arm64" - - os: macos-11 - python-version: "3.8" - hw: "arm64" + # os: [ ubuntu-20.04, macos-11 ] + os: ["macos-11"] + python-version: ["3.9"] #["3.8", "3.9", "3.10", "3.11"] + hw: ["arm64"] #["x86_64", "arm64"] + # exclude: + # - os: ubuntu-20.04 + # hw: "arm64" + # - os: macos-11 + # python-version: "3.8" + # hw: "arm64" include: - - os: ubuntu-20.04 - python-version: "3.8" - cibw-build: "cp38-manylinux_x86_64" - hw: "x86_64" - - os: ubuntu-20.04 - python-version: "3.9" - cibw-build: "cp39-manylinux_x86_64" - hw: "x86_64" - - os: ubuntu-20.04 - python-version: "3.10" - cibw-build: "cp310-manylinux_x86_64" - hw: "x86_64" - - os: ubuntu-20.04 - python-version: "3.11" - cibw-build: "cp311-manylinux_x86_64" - hw: "x86_64" - - os: macos-11 - python-version: "3.8" - cibw-build: "cp38-macosx_x86_64" - hw: "x86_64" - - os: macos-11 - python-version: "3.9" - cibw-build: "cp39-macosx_x86_64" - hw: "x86_64" - - os: macos-11 - python-version: "3.10" - cibw-build: "cp310-macosx_x86_64" - hw: "x86_64" - - os: macos-11 - python-version: "3.11" - cibw-build: "cp311-macosx_x86_64" - hw: "x86_64" + # - os: ubuntu-20.04 + # python-version: "3.8" + # cibw-build: "cp38-manylinux_x86_64" + # hw: "x86_64" + # - os: ubuntu-20.04 + # python-version: "3.9" + # cibw-build: "cp39-manylinux_x86_64" + # hw: "x86_64" + # - os: ubuntu-20.04 + # python-version: "3.10" + # cibw-build: "cp310-manylinux_x86_64" + # hw: "x86_64" + # - os: ubuntu-20.04 + # python-version: "3.11" + # cibw-build: "cp311-manylinux_x86_64" + # hw: "x86_64" + # - os: macos-11 + # python-version: "3.8" + # cibw-build: "cp38-macosx_x86_64" + # hw: "x86_64" + # - os: macos-11 + # python-version: "3.9" + # cibw-build: "cp39-macosx_x86_64" + # hw: "x86_64" + # - os: macos-11 + # python-version: "3.10" + # cibw-build: "cp310-macosx_x86_64" + # hw: "x86_64" + # - os: macos-11 + # python-version: "3.11" + # cibw-build: "cp311-macosx_x86_64" + # hw: "x86_64" - os: macos-11 python-version: "3.9" - cibw-build: "cp38-macosx_arm64" - hw: "arm64" - - os: macos-11 - python-version: "3.10" - cibw-build: "cp310-macosx_arm64" - hw: "arm64" - - os: macos-11 - python-version: "3.11" - cibw-build: "cp311-macosx_arm64" + cibw-build: "cp39-macosx_arm64" hw: "arm64" + # - os: macos-11 + # python-version: "3.10" + # cibw-build: "cp310-macosx_arm64" + # hw: "arm64" + # - os: macos-11 + # python-version: "3.11" + # cibw-build: "cp311-macosx_arm64" + # hw: "arm64" steps: - uses: actions/checkout@v3 @@ -78,6 +79,8 @@ jobs: # configure cibuildwheel to build native archs ('auto'), and some # emulated ones CIBW_ARCHS_LINUX: native + CIBW_ARCHS_MACOS: ${{ matrix.hw }} + CIBW_MANYLINUX_X86_64_IMAGE: "registry-1.docker.io/tuplex/ci:${{ matrix.python-version }}" CIBW_BUILD: ${{ matrix.cibw-build }} From ab572b8bfb22e3c2783555139323745f3bb70938 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sun, 15 Oct 2023 21:33:43 -0700 Subject: [PATCH 09/14] use macos12 for delocate --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index ea73a6508..fa2df8cca 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: # os: [ ubuntu-20.04, macos-11 ] - os: ["macos-11"] + os: ["macos-12"] python-version: ["3.9"] #["3.8", "3.9", "3.10", "3.11"] hw: ["arm64"] #["x86_64", "arm64"] # exclude: From 2f346236f5b0d502b5a9019b7af0871bf51d0dcf Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Sun, 15 Oct 2023 21:44:08 -0700 Subject: [PATCH 10/14] fix --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index fa2df8cca..77fead2e3 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -51,7 +51,7 @@ jobs: # python-version: "3.11" # cibw-build: "cp311-macosx_x86_64" # hw: "x86_64" - - os: macos-11 + - os: macos-12 python-version: "3.9" cibw-build: "cp39-macosx_arm64" hw: "arm64" From 3b07d8406ba2dc9080a9b6664f67d4189dc157b8 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Mon, 23 Oct 2023 19:32:11 -0700 Subject: [PATCH 11/14] update scripts for arm64 wheels --- scripts/build_macos_wheels.sh | 85 ++++++++++++++++++++++++++++++++--- setup.py | 7 +-- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/scripts/build_macos_wheels.sh b/scripts/build_macos_wheels.sh index 59c0c30f8..b8bbecdfa 100755 --- a/scripts/build_macos_wheels.sh +++ b/scripts/build_macos_wheels.sh @@ -1,9 +1,82 @@ #!/usr/bin/env bash +# (c) 2017-2023 Tuplex team +# builds x86_64 (and arm64) wheels + +# uncomment for debug +#set -euxo pipefail +set -euo pipefail + +function fail { + printf '%s\n' "$1" >&2 + exit "${2-1}" +} + +function detect_instruction_set() { + arch="$(uname -m)" # -i is only linux, -m is linux and apple + if [[ "$arch" = x86_64* ]]; then + if [[ "$(uname -a)" = *ARM64* ]]; then + echo 'arm64' + else + echo 'x86_64' + fi + elif [[ "$arch" = i*86 ]]; then + echo 'x86_32' + elif [[ "$arch" = arm* ]]; then + echo $arch + elif test "$arch" = aarch64; then + echo 'arm64' + else + exit 1 + fi +} # check from where script is invoked CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" +echo " || Tuplex macOS wheel builder || " +echo "-- Executing buildwheel script located in $CWD" + +# check platform is darwin +if [ ! "$(uname -s)" = "Darwin" ]; then + fail "Error: Need to run script under macOS" +fi + +# check which tags are supported +arch=$(detect_instruction_set) +echo "-- Detected arch ${arch}" + +xcode_version_str=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version) +echo "-- Detected Xcode ${xcode_version_str}" + +# if no param is given, use defaults to build all +if [ "${arch}" = "arm64" ]; then + # build Python 3.9 - 3.11 +# cp38-macosx_arm64 + CIBW_BUILD=${CIBW_BUILD-"cp3{9,10,11}-macosx_arm64"} +else + # build Python 3.8 - 3.11 + CIBW_BUILD=${CIBW_BUILD-"cp3{8,9,10,11}-macosx_x86_64}"} +fi + +echo "-- Building wheels for ${CIBW_BUILD}" + +# if macOS is 10.x -> use this as minimum +MINIMUM_TARGET="10.13" + +MACOS_VERSION=$(sw_vers -productVersion) +echo "-- processing on MacOS ${MACOS_VERSION}" +function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + +MACOS_VERSION_MAJOR=`echo $MACOS_VERSION | cut -d . -f1` + +if [ "$MACOS_VERSION_MAJOR" -ge 11 ]; then + echo "-- Newer MacOS detected (>=11.0), using more recent base target." + echo "-- Using minimum target ${MACOS_VERSION_MAJOR}.0" + MINIMUM_TARGET="${MACOS_VERSION_MAJOR}.0" +else + # keep as is + echo "-- defaulting build to use as minimum target ${MINIMUM_TARGET}" +fi -echo "Executing buildwheel script located in $CWD" pushd $CWD > /dev/null cd .. @@ -13,13 +86,13 @@ cd .. # brew extract --version=3.19.4 protobuf $USER/local-podman # brew install $USER/local-podman/protobuf@3.19.4 # i.e., prepend to statemtnt the following: brew tap-new $USER/local; brew extract --force --version=3.19.4 protobuf $USER/local && brew install $USER/local/protobuf@3.19.4 && -export CIBW_BEFORE_BUILD_MACOS="brew install protobuf coreutils zstd zlib libmagic llvm@9 aws-sdk-cpp pcre2 antlr4-cpp-runtime googletest gflags yaml-cpp celero wget boost" -export CIBW_ENVIRONMENT_MACOS="MACOSX_DEPLOYMENT_TARGET=10.13 CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' " +export CIBW_BEFORE_BUILD_MACOS="brew install protobuf coreutils zstd zlib libmagic llvm@16 aws-sdk-cpp pcre2 antlr4-cpp-runtime googletest gflags yaml-cpp celero wget boost ninja snappy" +export CIBW_ENVIRONMENT_MACOS="MACOSX_DEPLOYMENT_TARGET=${MINIMUM_TARGET} CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' " -export CIBW_BUILD="cp3{7,8,9}-*" -export CIBW_SKIP="cp3{5,6}-macosx* pp* *-musllinux_*" +export CIBW_BUILD="${CIBW_BUILD}" +export CIBW_PROJECT_REQUIRES_PYTHON=">=3.8" -export CIBW_PROJECT_REQUIRES_PYTHON=">=3.7" +export CIBW_BUILD_VERBOSITY=3 cibuildwheel --platform macos diff --git a/setup.py b/setup.py index 91285f654..f619ccd81 100644 --- a/setup.py +++ b/setup.py @@ -328,12 +328,13 @@ def build_extension(self, ext): if platform.system().lower() == 'darwin': # mac os, use brewed versions! out_py = subprocess.check_output(['brew', 'info', 'python3']).decode() - print(out_py) def find_pkg_path(lines): - return list(filter(lambda x: 'usr/local' in x, lines.split('\n')))[0] + ans = list(filter(lambda x: 'usr/local' in x, lines.split('\n'))) + return None if 0 == len(ans) else ans[0] out_py = find_pkg_path(out_py) - print('Found python3 @ {}'.format(out_py)) + if out_py: + logging.info('Found python3 @ {}'.format(out_py)) # setups find everything automatically... llvm_root = None From 6d62d1cd865d9852a6ef006172e89bce7839b01b Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Mon, 23 Oct 2023 23:06:36 -0700 Subject: [PATCH 12/14] fix when xcode is installed --- scripts/build_macos_wheels.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/build_macos_wheels.sh b/scripts/build_macos_wheels.sh index b8bbecdfa..49a36ccaf 100755 --- a/scripts/build_macos_wheels.sh +++ b/scripts/build_macos_wheels.sh @@ -2,8 +2,7 @@ # (c) 2017-2023 Tuplex team # builds x86_64 (and arm64) wheels -# uncomment for debug -#set -euxo pipefail +# add -x option for verbose output set -euo pipefail function fail { @@ -44,7 +43,9 @@ fi arch=$(detect_instruction_set) echo "-- Detected arch ${arch}" -xcode_version_str=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version) +# try to extract version of compiler first via command-line tools or xcode +# either needs to be installed. +xcode_version_str=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables 2>/dev/null | grep version || pkgutil --pkg-info=com.apple.pkg.Xcode | grep version) echo "-- Detected Xcode ${xcode_version_str}" # if no param is given, use defaults to build all @@ -54,7 +55,7 @@ if [ "${arch}" = "arm64" ]; then CIBW_BUILD=${CIBW_BUILD-"cp3{9,10,11}-macosx_arm64"} else # build Python 3.8 - 3.11 - CIBW_BUILD=${CIBW_BUILD-"cp3{8,9,10,11}-macosx_x86_64}"} + CIBW_BUILD=${CIBW_BUILD-"cp3{8,9,10,11}-macosx_x86_64"} fi echo "-- Building wheels for ${CIBW_BUILD}" From 47229dcdc056325017184e4b50825cccefe36434 Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Tue, 24 Oct 2023 00:18:54 -0700 Subject: [PATCH 13/14] script update, revert github actions - requires arm64 lib build --- .github/workflows/build_wheels.yml | 84 ++++++++++-------------------- scripts/build_macos_wheels.sh | 3 +- 2 files changed, 29 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 77fead2e3..06c9e6029 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -4,65 +4,37 @@ on: [push, pull_request, workflow_dispatch] jobs: build_wheels: - name: Build wheel for ${{ matrix.cibw-build }} + name: Build wheel on ${{ matrix.os }} - py ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: matrix: - # os: [ ubuntu-20.04, macos-11 ] - os: ["macos-12"] - python-version: ["3.9"] #["3.8", "3.9", "3.10", "3.11"] - hw: ["arm64"] #["x86_64", "arm64"] - # exclude: - # - os: ubuntu-20.04 - # hw: "arm64" - # - os: macos-11 - # python-version: "3.8" - # hw: "arm64" + os: [ ubuntu-20.04, macos-11 ] + python-version: ["3.8", "3.9", "3.10", "3.11"] include: - # - os: ubuntu-20.04 - # python-version: "3.8" - # cibw-build: "cp38-manylinux_x86_64" - # hw: "x86_64" - # - os: ubuntu-20.04 - # python-version: "3.9" - # cibw-build: "cp39-manylinux_x86_64" - # hw: "x86_64" - # - os: ubuntu-20.04 - # python-version: "3.10" - # cibw-build: "cp310-manylinux_x86_64" - # hw: "x86_64" - # - os: ubuntu-20.04 - # python-version: "3.11" - # cibw-build: "cp311-manylinux_x86_64" - # hw: "x86_64" - # - os: macos-11 - # python-version: "3.8" - # cibw-build: "cp38-macosx_x86_64" - # hw: "x86_64" - # - os: macos-11 - # python-version: "3.9" - # cibw-build: "cp39-macosx_x86_64" - # hw: "x86_64" - # - os: macos-11 - # python-version: "3.10" - # cibw-build: "cp310-macosx_x86_64" - # hw: "x86_64" - # - os: macos-11 - # python-version: "3.11" - # cibw-build: "cp311-macosx_x86_64" - # hw: "x86_64" - - os: macos-12 + - os: ubuntu-20.04 + python-version: "3.8" + cibw-build: "cp38-manylinux_x86_64" + - os: ubuntu-20.04 python-version: "3.9" - cibw-build: "cp39-macosx_arm64" - hw: "arm64" - # - os: macos-11 - # python-version: "3.10" - # cibw-build: "cp310-macosx_arm64" - # hw: "arm64" - # - os: macos-11 - # python-version: "3.11" - # cibw-build: "cp311-macosx_arm64" - # hw: "arm64" + cibw-build: "cp39-manylinux_x86_64" + - os: ubuntu-20.04 + python-version: "3.10" + cibw-build: "cp310-manylinux_x86_64" + - os: ubuntu-20.04 + python-version: "3.11" + cibw-build: "cp311-manylinux_x86_64" + - os: macos-11 + python-version: "3.8" + cibw-build: "cp38-macosx_x86_64" + - os: macos-11 + python-version: "3.9" + cibw-build: "cp39-macosx_x86_64" + - os: macos-11 + python-version: "3.10" + cibw-build: "cp310-macosx_x86_64" + - os: macos-11 + python-version: "3.11" + cibw-build: "cp311-macosx_x86_64" steps: - uses: actions/checkout@v3 @@ -79,8 +51,6 @@ jobs: # configure cibuildwheel to build native archs ('auto'), and some # emulated ones CIBW_ARCHS_LINUX: native - CIBW_ARCHS_MACOS: ${{ matrix.hw }} - CIBW_MANYLINUX_X86_64_IMAGE: "registry-1.docker.io/tuplex/ci:${{ matrix.python-version }}" CIBW_BUILD: ${{ matrix.cibw-build }} @@ -99,4 +69,4 @@ jobs: - uses: actions/upload-artifact@v3 with: path: | - ./wheelhouse/*.whl + ./wheelhouse/*.whl \ No newline at end of file diff --git a/scripts/build_macos_wheels.sh b/scripts/build_macos_wheels.sh index 49a36ccaf..35b3812f7 100755 --- a/scripts/build_macos_wheels.sh +++ b/scripts/build_macos_wheels.sh @@ -93,7 +93,8 @@ export CIBW_ENVIRONMENT_MACOS="MACOSX_DEPLOYMENT_TARGET=${MINIMUM_TARGET} CMAKE_ export CIBW_BUILD="${CIBW_BUILD}" export CIBW_PROJECT_REQUIRES_PYTHON=">=3.8" -export CIBW_BUILD_VERBOSITY=3 +# uncomment to increase verbosity of cibuildwheel +# export CIBW_BUILD_VERBOSITY=3 cibuildwheel --platform macos From a87877920e4dabc996ec13a712b6b37d885704ed Mon Sep 17 00:00:00 2001 From: Leonhard Spiegelberg Date: Tue, 24 Oct 2023 21:17:53 -0700 Subject: [PATCH 14/14] script update --- scripts/build_macos_wheels.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/build_macos_wheels.sh b/scripts/build_macos_wheels.sh index 35b3812f7..c701f6d8d 100755 --- a/scripts/build_macos_wheels.sh +++ b/scripts/build_macos_wheels.sh @@ -51,7 +51,6 @@ echo "-- Detected Xcode ${xcode_version_str}" # if no param is given, use defaults to build all if [ "${arch}" = "arm64" ]; then # build Python 3.9 - 3.11 -# cp38-macosx_arm64 CIBW_BUILD=${CIBW_BUILD-"cp3{9,10,11}-macosx_arm64"} else # build Python 3.8 - 3.11 @@ -64,7 +63,7 @@ echo "-- Building wheels for ${CIBW_BUILD}" MINIMUM_TARGET="10.13" MACOS_VERSION=$(sw_vers -productVersion) -echo "-- processing on MacOS ${MACOS_VERSION}" +echo "-- Processing on MacOS ${MACOS_VERSION}" function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } MACOS_VERSION_MAJOR=`echo $MACOS_VERSION | cut -d . -f1` @@ -75,18 +74,13 @@ if [ "$MACOS_VERSION_MAJOR" -ge 11 ]; then MINIMUM_TARGET="${MACOS_VERSION_MAJOR}.0" else # keep as is - echo "-- defaulting build to use as minimum target ${MINIMUM_TARGET}" + echo "-- Defaulting build to use as minimum target ${MINIMUM_TARGET}" fi pushd $CWD > /dev/null cd .. -# protobuf 3.20-3.21.2 is broken for MacOS, so use -# 3.19.4 -# brew tap-new $USER/local-podman -# brew extract --version=3.19.4 protobuf $USER/local-podman -# brew install $USER/local-podman/protobuf@3.19.4 -# i.e., prepend to statemtnt the following: brew tap-new $USER/local; brew extract --force --version=3.19.4 protobuf $USER/local && brew install $USER/local/protobuf@3.19.4 && +# Note: protobuf 3.20 - 3.21.2 is broken for MacOS, do not use those versions export CIBW_BEFORE_BUILD_MACOS="brew install protobuf coreutils zstd zlib libmagic llvm@16 aws-sdk-cpp pcre2 antlr4-cpp-runtime googletest gflags yaml-cpp celero wget boost ninja snappy" export CIBW_ENVIRONMENT_MACOS="MACOSX_DEPLOYMENT_TARGET=${MINIMUM_TARGET} CMAKE_ARGS='-DBUILD_WITH_AWS=ON -DBUILD_WITH_ORC=ON' "