From c93a8a17e27018da820403e3e82309ab48b5b266 Mon Sep 17 00:00:00 2001 From: k-dominik Date: Wed, 22 Mar 2023 20:19:06 +0100 Subject: [PATCH 1/5] run osx tests in ci, add shebang to test scripts otherwise they won't run on osx --- azure-pipelines.yml | 24 +++++++++++------------- ci/build_unix.sh | 4 +++- config/run_test.sh.in | 1 + 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index af2907dc9..7bc38e685 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,19 +13,17 @@ jobs: PYTHON_VERSION: 3.9 steps: - script: bash ci/build_unix.sh - # We could not get the OSX CIs to pass easily. - # https://github.com/ukoethe/vigra/issues/535 - # - job: OSX - # pool: - # vmImage: macOS-latest - # strategy: - # matrix: - # py37: - # PYTHON_VERSION: 3.7 - # steps: - # - script: | - # sudo xcode-select -s /Applications/Xcode_13.2.1.app - # bash ci/build_unix.sh + - job: OSX + pool: + vmImage: macOS-latest + strategy: + matrix: + py37: + PYTHON_VERSION: 3.7 + steps: + - script: | + sudo xcode-select -s /Applications/Xcode_13.2.1.app + bash ci/build_unix.sh - job: Windows pool: vmImage: windows-2019 diff --git a/ci/build_unix.sh b/ci/build_unix.sh index 7c46618d8..93b8a96ad 100644 --- a/ci/build_unix.sh +++ b/ci/build_unix.sh @@ -11,7 +11,9 @@ conda create \ python=${PYTHON_VERSION} c-compiler cxx-compiler \ zlib jpeg libpng libtiff hdf5 fftw \ boost boost-cpp numpy h5py nose sphinx \ - openexr lemon + openexr lemon cmake + +export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}" source $CONDA/bin/activate vigra diff --git a/config/run_test.sh.in b/config/run_test.sh.in index 9e95ef381..5fa61cf54 100644 --- a/config/run_test.sh.in +++ b/config/run_test.sh.in @@ -1 +1,2 @@ +#!/bin/bash PATH=@EXTRA_PATH@$PATH && cd @CMAKE_CURRENT_BINARY_DIR@ && (@VIGRA_TEST_EXECUTABLE@ || { touch testsuccess.cxx; exit 1; } ) From 9af2b62c88b04946d6f28987a34847ce9b6e69c8 Mon Sep 17 00:00:00 2001 From: k-dominik Date: Wed, 22 Mar 2023 20:15:42 +0100 Subject: [PATCH 2/5] Skip linking to `libpython` on macOS The interpreter is statically linked to `libpython` on macOS. Likely causes symbol clashes, which causes the segmentation faults we have seen. See also https://github.com/conda-forge/vigra-feedstock/blob/34e1048c818424995997b59817bbf909f43b221b/recipe/patches/ignore_libpython_macos.diff Co-authored-by: John Kirkham --- ci/build_unix.sh | 4 ++-- config/FindVIGRANUMPY_DEPENDENCIES.cmake | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ci/build_unix.sh b/ci/build_unix.sh index 93b8a96ad..2cc2f76ca 100644 --- a/ci/build_unix.sh +++ b/ci/build_unix.sh @@ -11,7 +11,7 @@ conda create \ python=${PYTHON_VERSION} c-compiler cxx-compiler \ zlib jpeg libpng libtiff hdf5 fftw \ boost boost-cpp numpy h5py nose sphinx \ - openexr lemon cmake + openexr lemon cmake make export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}" @@ -29,7 +29,7 @@ cmake .. \ -DTEST_VIGRANUMPY=ON \ -DWITH_OPENEXR=ON \ -DWITH_LEMON=ON \ - -DAUTOEXEC_TESTS=OFF + -DAUTOEXEC_TESTS=OFF \ make -j2 make check -j2 diff --git a/config/FindVIGRANUMPY_DEPENDENCIES.cmake b/config/FindVIGRANUMPY_DEPENDENCIES.cmake index 1564a18e9..1478c228e 100644 --- a/config/FindVIGRANUMPY_DEPENDENCIES.cmake +++ b/config/FindVIGRANUMPY_DEPENDENCIES.cmake @@ -149,7 +149,11 @@ IF(Python_Interpreter_FOUND) SET(VIGRANUMPY_INCLUDE_DIRS ${VIGRANUMPY_INCLUDE_DIRS} CACHE PATH "include directories needed by VIGRA Python bindings" FORCE) - SET(VIGRANUMPY_LIBRARIES ${Python_LIBRARIES} ${Boost_PYTHON_LIBRARY}) + IF(APPLE) + SET(VIGRANUMPY_LIBRARIES ${Boost_PYTHON_LIBRARY}) + ELSE() + SET(VIGRANUMPY_LIBRARIES ${Python_LIBRARIES} ${Boost_PYTHON_LIBRARY}) + ENDIF() if(TEST_VIGRANUMPY AND NOT VIGRANUMPY_DEPENDENCIES_FOUND) MESSAGE(FATAL_ERROR " vigranumpy dependencies NOT found while TEST_VIGRANUMPY=1") From 429a4adac16849c10515363ed29308953a3806d0 Mon Sep 17 00:00:00 2001 From: k-dominik Date: Wed, 22 Mar 2023 15:49:50 +0100 Subject: [PATCH 3/5] specify zlib/png directly also use correct extension for osx/lnx --- ci/build_unix.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ci/build_unix.sh b/ci/build_unix.sh index 2cc2f76ca..152264b5b 100644 --- a/ci/build_unix.sh +++ b/ci/build_unix.sh @@ -13,7 +13,13 @@ conda create \ boost boost-cpp numpy h5py nose sphinx \ openexr lemon cmake make -export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}" +if [[ `uname` == 'Darwin' ]]; +then + export SHLIB_EXT=".dylib" + export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}" +else + export SHLIB_EXT=".so" +fi source $CONDA/bin/activate vigra @@ -30,6 +36,12 @@ cmake .. \ -DWITH_OPENEXR=ON \ -DWITH_LEMON=ON \ -DAUTOEXEC_TESTS=OFF \ + -DZLIB_INCLUDE_DIR=${CONDA_PREFIX}/include \ + -DZLIB_LIBRARY=${CONDA_PREFIX}/lib/libz${SHLIB_EXT} \ +\ + -DPNG_LIBRARY=${CONDA_PREFIX}/lib/libpng${SHLIB_EXT} \ + -DPNG_PNG_INCLUDE_DIR=${CONDA_PREFIX}/include + make -j2 make check -j2 From fd3423f9617dca93a50b80da01330d5ade094fdd Mon Sep 17 00:00:00 2001 From: k-dominik Date: Wed, 22 Mar 2023 17:34:48 +0100 Subject: [PATCH 4/5] change order to find packages --- ci/build_unix.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/build_unix.sh b/ci/build_unix.sh index 152264b5b..f1ab30173 100644 --- a/ci/build_unix.sh +++ b/ci/build_unix.sh @@ -36,6 +36,8 @@ cmake .. \ -DWITH_OPENEXR=ON \ -DWITH_LEMON=ON \ -DAUTOEXEC_TESTS=OFF \ + -DCMAKE_FIND_FRAMEWORK=LAST \ + -DCMAKE_FIND_APPBUNDLE=LAST \ -DZLIB_INCLUDE_DIR=${CONDA_PREFIX}/include \ -DZLIB_LIBRARY=${CONDA_PREFIX}/lib/libz${SHLIB_EXT} \ \ From cee42d918b976f099018b0a482a9f7300fb91b4c Mon Sep 17 00:00:00 2001 From: Dominik Kutra Date: Mon, 27 Mar 2023 18:20:35 +0200 Subject: [PATCH 5/5] python linking workaround on OSX only in conda-based builds --- config/FindVIGRANUMPY_DEPENDENCIES.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/FindVIGRANUMPY_DEPENDENCIES.cmake b/config/FindVIGRANUMPY_DEPENDENCIES.cmake index 1478c228e..964ae9230 100644 --- a/config/FindVIGRANUMPY_DEPENDENCIES.cmake +++ b/config/FindVIGRANUMPY_DEPENDENCIES.cmake @@ -149,7 +149,9 @@ IF(Python_Interpreter_FOUND) SET(VIGRANUMPY_INCLUDE_DIRS ${VIGRANUMPY_INCLUDE_DIRS} CACHE PATH "include directories needed by VIGRA Python bindings" FORCE) - IF(APPLE) + # due to some static linking in Python on conda-forge, Python cannot be directly linked to + # see also https://github.com/ukoethe/vigra/pull/538 + IF(APPLE AND DEFINED ENV{CONDA_TOOLCHAIN_BUILD}) SET(VIGRANUMPY_LIBRARIES ${Boost_PYTHON_LIBRARY}) ELSE() SET(VIGRANUMPY_LIBRARIES ${Python_LIBRARIES} ${Boost_PYTHON_LIBRARY})