Link failure when Qt6 is compiled with visibility protected
MIDI libraries for Qt/C++
Brought to you by:
plcl
The origin of this breakage can be traced to this work: Remove copy relocation and optimize locally defined symbol access by Thiago, that finally made its way into Qt6. The Arch Linux Qt6 packager used the new build flag FEATURE_no_direct_extern_access=ON
when building Qt6 which exposed the build problem on my Drumstick Libraries.
When using FEATURE_no_direct_extern_access=ON
, the macro Q_DECL_EXPORT
will be defined as __attribute__((visibility("protected")))
in Linux/GCC, potentially breaking existing public shared libraries using this macro.
This ticket comes from GitHub issue #12.
Commit [97d89a88f864993759484741ec667f2f535b412f] on develop branch
Related
Commit: [97d89a]
CMake has an alternative solution, which has been discarded:
https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html
https://cmake.org/cmake/help/latest/prop_tgt/DEFINE_SYMBOL.html
This means that four headers will be generated, and would need to be installed:
This solution will be cross-platform, and contain some other macros as well, but will be disconnected from any future Qt6 advances.
Using Q_DECL_EXPORT and Q_DECL_IMPORT, whatever new development in Qt6 on this area will be adopted by Drumstick as well when Linux distros migrate.