From e8a94de2ea4675fb30c48c448ad829532f69bf2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 27 Jan 2025 13:29:15 +0100 Subject: [PATCH] Use correct path for libiodbc and forward via ODBC_ROOT env var The hard-coded path paths added to LIBRARY_PATH and CPLUS_INCLUDE_PATH was not correct on Apple Silicon Macs, where homebrew installs into /opt/homebrew/. There's also no point in passing on the library location via compiler environment variables, when we can use ODBC_ROOT. And we don't need to pass it on as a CMake define, as a environment variable works just fine. This decouples the provisioning of libiodbc from the build configurations. Change-Id: I40aa3c1852fb0baf3366fa1a9dab85a66eef95e2 Reviewed-by: Joerg Bornemann Reviewed-by: Alexandru Croitor (cherry picked from commit 124957a8cb55a9dc6a068d424a93cc7642bb03d7) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 1bb142175a5447149020a994b83e9ca9c2a58269) --- coin/platform_configs/cmake_platforms_static_release.yaml | 2 +- coin/platform_configs/macos.yaml | 2 +- coin/provisioning/common/macos/libiodbc.sh | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/coin/platform_configs/cmake_platforms_static_release.yaml b/coin/platform_configs/cmake_platforms_static_release.yaml index e89c9609..911ff9fb 100644 --- a/coin/platform_configs/cmake_platforms_static_release.yaml +++ b/coin/platform_configs/cmake_platforms_static_release.yaml @@ -53,7 +53,7 @@ Configurations: Features: ['Packaging', 'Sccache', 'DoNotRunTests', 'WarningsAreErrors', 'UseConfigure', 'MinimalStaticTests'] Configure arguments: '-static -nomake examples -release -no-framework -no-icu -qt-doubleconversion -no-feature-sql-psql' Environment variables: [ - 'CMAKE_ARGS=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DODBC_ROOT=/usr/local/opt/libiodbc -DPostgreSQL_ROOT={{.Env.POSTGRESQLBINPATH}}/.. -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_DIR}}', + 'CMAKE_ARGS=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DPostgreSQL_ROOT={{.Env.POSTGRESQLBINPATH}}/.. -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_DIR}}', 'NON_QTBASE_CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Release -DFEATURE_gds=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR}} -DFEATURE_native_grpc=OFF', 'Protobuf_ROOT=/usr/local/lib/cmake/protobuf' ] diff --git a/coin/platform_configs/macos.yaml b/coin/platform_configs/macos.yaml index d35b7e30..73a86201 100644 --- a/coin/platform_configs/macos.yaml +++ b/coin/platform_configs/macos.yaml @@ -15,7 +15,7 @@ Configurations: Features: ['Packaging', 'Sccache', 'DoNotRunTests', 'WarningsAreErrors', 'UseConfigure', 'GenerateSBOM', 'VerifySBOM'] Configure arguments: '-nomake examples -release -force-debug-info -separate-debug-info -headersclean -framework' Environment variables: [ - 'CMAKE_ARGS=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DODBC_ROOT=/usr/local/opt/libiodbc -DPostgreSQL_ROOT={{.Env.POSTGRESQLBINPATH}}/.. -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_DIR}}', + 'CMAKE_ARGS=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DPostgreSQL_ROOT={{.Env.POSTGRESQLBINPATH}}/.. -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_DIR}}', 'NON_QTBASE_CMAKE_ARGS=-DFEATURE_gds=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR}} -DQT_DEPLOY_FFMPEG=TRUE -DINPUT_headersclean=ON -DQT_FEATURE_open62541_security=OFF', 'Protobuf_ROOT=/usr/local/lib/cmake/protobuf' ] diff --git a/coin/provisioning/common/macos/libiodbc.sh b/coin/provisioning/common/macos/libiodbc.sh index 059758c8..e33ce98c 100755 --- a/coin/provisioning/common/macos/libiodbc.sh +++ b/coin/provisioning/common/macos/libiodbc.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright (C) 2018 The Qt Company Ltd. +# Copyright (C) 2025 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # Install libiodbc @@ -11,12 +11,9 @@ source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" brew install --formula "${BASH_SOURCE%/*}/libiodbc.rb" "$@" -# CPLUS_INCLUDE_PATH is set so clang and configure can find libiodbc - read -r -a arr <<< "$(brew list --versions libiodbc)" version=${arr[1]} -SetEnvVar "CPLUS_INCLUDE_PATH" "/usr/local/Cellar/libiodbc/$version/include${CPLUS_INCLUDE_PATH:+:}${CPLUS_INCLUDE_PATH}" -SetEnvVar "LIBRARY_PATH" "/usr/local/Cellar/libiodbc/$version/lib${LIBRARY_PATH:+:}${LIBRARY_PATH}" +SetEnvVar "ODBC_ROOT" "$(brew --prefix libiodbc)" echo "libiodbc = $version" >> ~/versions.txt