From 2723561f356e68dee48cd1d5002a12873708c316 Mon Sep 17 00:00:00 2001 From: jhoyt4 Date: Mon, 12 Feb 2024 19:22:45 -0500 Subject: [PATCH] Github workflow: Fix linking error on macOS Homebrew has multiple versions of python which occasionally step on each other. Add the overwrite flag in the install process to explicity oveverwrite old links. Additionally add a call to brew upgrade to handle issues where new packages require updating already installed ones. --- .github/workflows/buildmaster.yml | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/buildmaster.yml b/.github/workflows/buildmaster.yml index ce242c33d31..5013b1675a1 100644 --- a/.github/workflows/buildmaster.yml +++ b/.github/workflows/buildmaster.yml @@ -64,9 +64,12 @@ jobs: - name: Check cross-compile environment (macOS) env: ARCH: ${{ matrix.arch }} + PYTHONVERS: 3.12 run: | SYSARCH=$(/usr/bin/uname -m) PKGMGR_CMD='brew' + HB_PREFIX=$(${PKGMGR_CMD} --prefix) + echo "HB_PREFIX=$HB_PREFIX" >> $GITHUB_ENV if [ "$SYSARCH" = "$ARCH" ]; then # this is a cross-compile PKGMGR_CMD="arch -${ARCH} $PKGMGR_CMD" @@ -74,6 +77,14 @@ jobs: echo "MAKE_CMD=arch -${ARCH} $MAKE_CMD" >> $GITHUB_ENV fi echo "PKGMGR_CMD=$PKGMGR_CMD" >> $GITHUB_ENV + + # Uninstall alternative python versions + INSTALLED_PYTHONS=$($PKGMGR_CMD list|grep 'python@') + for PYTH in $INSTALLED_PYTHONS; do + if [[ $PYTH != *"3.12"* ]]; then + $PKGMGR_CMD uninstall --ignore-dependencies $PYTH + fi + done if: runner.os == 'macOS' # N.B. These dependencies are for the master branch. Unlike the ansible @@ -100,22 +111,23 @@ jobs: env: OS_VERS: ${{ matrix.os }} run: | - brew update - ${PKGMGR_CMD} install pkg-config ccache qt5 nasm libsamplerate taglib\ - lzo libcec libbluray libass libhdhomerun dav1d x264 x265 libvpx \ - openssl sound-touch lame freetype libass libiconv libxml2 libzip \ - XviD zlib pyenv-virtualenv python-lxml python-requests \ - python-setuptools - ${PKGMGR_CMD} link qt5 --force + ${PKGMGR_CMD} update + ${PKGMGR_CMD} upgrade --force + ${PKGMGR_CMD} install pkg-config ccache qt@5 nasm libsamplerate \ + taglib lzo libcec libbluray libass libhdhomerun dav1d x264 x265 \ + libvpx openssl sound-touch lame freetype libass libiconv libxml2 \ + libzip XviD zlib pyenv-virtualenv python-lxml python-requests \ + python-setuptools --force --overwrite + ${PKGMGR_CMD} link qt@5 --force + ${PKGMGR_CMD} link python --force --overwrite # macos-14 updated the linker and needs to be run in "classic" mode case $OS_VERS in - macos-14) + macos-14 | macos-13) LDFLAGS="-Wl,-ld_classic" ;; esac # homebrew uses different prefixes on x86_64 and arm64, find the # correct one and setup the correct build variables - HB_PREFIX=$(${PKGMGR_CMD} --prefix) C_INCLUDE_PATH=$HB_PREFIX/include:$C_INCLUDE_PATH echo "C_INCLUDE_PATH=$C_INCLUDE_PATH" >> $GITHUB_ENV CPLUS_INCLUDE_PATH=$HB_PREFIX/include:$CPLUS_INCLUDE_PATH @@ -169,7 +181,7 @@ jobs: - name: Install plugin dependencies (macOS) run: ${PKGMGR_CMD} install minizip flac libvorbis libcdio python-pycurl - python-oauthlib + python-oauthlib --force --overwrite if: runner.os == 'macOS' - name: Configure plugins