Bug 440416 - When compiling statically: 'KCrash::defaultCrashHandler': redefinition; different linkage
Summary: When compiling statically: 'KCrash::defaultCrashHandler': redefinition; diffe...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kcrash
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.84.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-30 10:40 UTC by Dawid Wróbel
Modified: 2021-08-09 22:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2021-07-30 10:40:18 UTC
SUMMARY
I am getting 'KCrash::defaultCrashHandler': redefinition; different linkage when compiling KCrash statically under MS Windows with MSVC:



STEPS TO REPRODUCE
1. You can test it with vcpkg and my PR here: https://github.com/microsoft/vcpkg/pull/19179
2. once checked out, issue bootstrap-vcpkg.bat
3. then ./vcpkg install kf5crash:x64-windows-static

OBSERVED RESULT
C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1429~1.300\bin\Hostx64\x64\cl.exe   /TP -DKCOREADDONS_LIB -DKF_DEPRECATED_WARNINGS_SINCE=0x060000 -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055100 -DQT_ACCESSIBILITY_SUPPORT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050f00 -DQT_EVENTDISPATCHER_SUPPORT_LIB -DQT_FONTDATABASE_SUPPORT_LIB -DQT_GUI_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_FOREACH -DQT_NO_KEYWORDS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_URL_CAST_FROM_STRING -DQT_THEME_SUPPORT_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_WINDOWSUIAUTOMATION_SUPPORT_LIB -DUNICODE -DWIN32_LEAN_AND_MEAN -DWINVER=0x0600 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_USE_MATH_DEFINES -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0600 -Isrc -ID:\buildtrees\kf5crash\src\v5.84.0-e25e6ced55.clean\src -Isrc\KF5Crash_autogen\include -ID:\installed\x64-windows-static\include\qt5 -ID:\installed\x64-windows-static\include\qt5\QtCore -ID:\installed\x64-windows-static\tools\qt5\mkspecs\win32-msvc -ID:\installed\x64-windows-static\include\KF5\KCoreAddons -ID:\installed\x64-windows-static\include\KF5 -ID:\installed\x64-windows-static\include\KF5\KWindowSystem -ID:\installed\x64-windows-static\include\qt5\QtGui -ID:\installed\x64-windows-static\include\qt5\QtEventDispatcherSupport -ID:\installed\x64-windows-static\include\qt5\QtFontDatabaseSupport -ID:\installed\x64-windows-static\include\qt5\QtThemeSupport -ID:\installed\x64-windows-static\include\qt5\QtAccessibilitySupport -ID:\installed\x64-windows-static\include\qt5\QtWindowsUIAutomationSupport -ID:\installed\x64-windows-static\include\qt5\QtWidgets /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP  /wd4250 /wd4251 /wd4396 /wd4661 /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1  -MTd /utf-8 -std:c++17 /showIncludes /Fosrc\CMakeFiles\KF5Crash.dir\kcrash.cpp.obj /Fdsrc\CMakeFiles\KF5Crash.dir\KF5Crash.pdb /FS -c D:\buildtrees\kf5crash\src\v5.84.0-e25e6ced55.clean\src\kcrash.cpp
D:\installed\x64-windows-static\include\KF5\KCoreAddons\kaboutdata.h(30): error C2375: 'KCrash::defaultCrashHandler': redefinition; different linkage
D:\buildtrees\kf5crash\src\v5.84.0-e25e6ced55.clean\src\kcrash.h(56): note: see declaration of 'KCrash::defaultCrashHandler'

EXPECTED RESULT
Should compile just fine

SOFTWARE/OS VERSIONS
Windows: 10
MSVC: 2019 16.10.4
KDE Frameworks Version: 5.84
Qt Version: https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/vcpkg.json

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2021-08-07 15:29:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/122
Comment 2 Nicolas Fella 2021-08-09 22:00:29 UTC
Git commit 5d5834d86e2890e3baeafdc9bd06849496d7fc98 by Nicolas Fella.
Committed on 09/08/2021 at 22:00.
Pushed by nicolasfella into branch 'master'.

Fix issue when building KCrash static

KCoreAddons forward declares a function from KCrash.

It contains a Q_DECL_IMPORT but that breaks when doing a static build.

Only add the Q_DECL_IMPORT when we are doing a dynamic build.

M  +4    -0    src/lib/CMakeLists.txt
M  +4    -0    src/lib/kaboutdata.h

https://invent.kde.org/frameworks/kcoreaddons/commit/5d5834d86e2890e3baeafdc9bd06849496d7fc98