Created attachment 133120 [details] vcpkg build output SUMMARY I am having trouble getting kio to compile under macOS. I am working on vcpkg portfile for it and it fails with 'duplicate symbol' error. While I know it compiles fine under craft, AFIK it doesn't use most recent macOS version/SDK/Xcode. It may also be that vcpkg has toolchain configured to be less lenient towards common errors. Specifically the error reported is: duplicate symbol 'operator>>(QDBusArgument const&, QSslCertificate&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) duplicate symbol 'operator<<(QDBusArgument&, QSslCertificate const&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) duplicate symbol 'operator>>(QDBusArgument const&, KSslCertificateRule&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) duplicate symbol 'operator<<(QDBusArgument&, KSslCertificateRule const&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) duplicate symbol 'operator>>(QDBusArgument const&, QSslError::SslError&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) duplicate symbol 'operator<<(QDBusArgument&, QSslError::SslError const&)' in: src/kssld/CMakeFiles/kssld.dir/kssld.cpp.o lib/libKF5KIOCore.a(ksslcertificatemanager.cpp.o) ld: 6 duplicate symbols for architecture x86_64 I did some investigation and here's what follows: - the operators above are declared *and defined* in kssld_dbusmetatypes.h - the header is in turn included by kssld_interface.h and kssld_adaptor.h, which are respectively included by the ksslcertificatemanager.cpp and kissed.cpp, which the linker is complaining about. My rusty C++ tells me that the linker complains because the body of the operators is implemented in the kssld_dbusmetatypes header file. Despite my rather limited knowledge of Qt and its metatype macros, I tried to separate the implementation from the header, but failed miserably. Note that 5.73 had an identical issue. STEPS TO REPRODUCE 1. You can try to build the vcpkg package using https://github.com/microsoft/vcpkg/pull/13469 SOFTWARE/OS VERSIONS macOS: 10.15.7 (19H2) KDE Frameworks Version: 5.75 Qt Version: 5.15 Apple clang version 11.0.3 (clang-1103.0.32.62)
Might be related to the friend declarations in src/core/ksslcertificatemanager.h .. not sure though.
I thought so, too, but I commented all that code and the references to befriended private members elsewhere, but still seeing the same issue.
Does adding `inline` to those operators help?
It obviously does, I don't know why I didn't think about it!
@Volker, has this been fixed? (does it need fixing?)
I didn't submit this change (I was just guessing, I don't even have it locally), but it sounds like we should add it indeed.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/563
Git commit eaa2729e17a15261f41599ad8c47124b486e4319 by Dawid Wróbel. Committed on 30/08/2021 at 20:23. Pushed by wrobelda into branch 'master'. Inline kssld operators to avoid duplicate symbol errors M +6 -6 src/core/kssld_dbusmetatypes.h https://invent.kde.org/frameworks/kio/commit/eaa2729e17a15261f41599ad8c47124b486e4319