https://bugs.kde.org/show_bug.cgi?id=428807

            Bug ID: 428807
           Summary: Duplicate symbol linker error under clang/macOS
           Product: frameworks-kio
           Version: 5.75.0
          Platform: Compiled Sources
                OS: macOS
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kio-bugs-n...@kde.org
          Reporter: m...@dawidwrobel.com
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

Created attachment 133120
  --> https://bugs.kde.org/attachment.cgi?id=133120&action=edit
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)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to