CMake: Fix build of oci plugin on arm macOS with the classic linker

When using Xcode 14, or 15 but with the classic linker on arm macOS,
the linking of the oci plugin fails with:

 ld: file not found: @rpath/libnnz.dylib for architecture arm64

Even though the file is present in the expected location.

This seems to be related to the use of the -flat_namespace flag, which
was originally added in 2003 for Qt 3.1, to avoid an issue with the
linker not finding the environ symbol.

These flags doesn't seem to be necessary anymore to successfully link
the plugin.

Remove both the -flat_namespace and -U,_environ flags when building
the plugin.

Amends 3ada49976a06ae251911fd8cd734f697fe4ddab4 in the historical qt
repo, which is not available publicly.

Pick-to: 6.7 6.5
Fixes: QTBUG-127342
Change-Id: If522cacb92aceff35d36d3bcfd3c1f838c134ada
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3642ce6e4b1912a774cc55c9a6a85ecf716d7080)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2024-08-05 17:51:34 +02:00 committed by Qt Cherry-pick Bot
parent 30e0091774
commit 07dc649747

View File

@ -24,9 +24,4 @@ qt_internal_add_plugin(QOCIDriverPlugin
## Scopes:
#####################################################################
qt_internal_extend_target(QOCIDriverPlugin CONDITION APPLE
LINK_OPTIONS
"-Wl,-flat_namespace,-U,_environ"
)
qt_internal_force_macos_intel_arch(QOCIDriverPlugin)