Bug 480520 - Krita does not compile with LTO enabled
Summary: Krita does not compile with LTO enabled
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.1.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-30 06:48 UTC by Erik Quaeghebeur
Modified: 2024-01-30 14:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Quaeghebeur 2024-01-30 06:48:32 UTC
SUMMARY
Krita does not compile with LTO enabled:

---
/var/tmp/portage/media-gfx/krita-5.1.5/work/krita-5.1.5/plugins/tools/tool_transform2/kis_free_transform_strategy.cpp:26:6: error: type ‘StrokeFunction’ violates the C++ One Definition Rule [-Werror=odr]                                 
   26 | enum StrokeFunction {                                                                                                                                                                                                               
      |      ^                                                                                                                                                                                                                              
/var/tmp/portage/media-gfx/krita-5.1.5/work/krita-5.1.5/plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp:27:6: note: an enum with different value name is defined in another translation unit                           
   27 | enum StrokeFunction {                                                                                                                                                                                                               
      |      ^                                                                                                                                                                                                                              
/var/tmp/portage/media-gfx/krita-5.1.5/work/krita-5.1.5/plugins/tools/tool_transform2/kis_free_transform_strategy.cpp:27:5: note: name ‘ROTATE’ differs from name ‘DRAG_HANDLE’ defined in another translation unit      
   27 |     ROTATE = 0,                                                                                               
      |     ^                                                                                                         
/var/tmp/portage/media-gfx/krita-5.1.5/work/krita-5.1.5/plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp:28:5: note: mismatching definition
   28 |     DRAG_HANDLE = 0,                                                                                          
      |     ^                                                                                                         
lto1: some warnings being treated as errors                                                                           
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status                                     
compilation terminated.                                          
---

STEPS TO REPRODUCE
1. compile with LTO enabled

OBSERVED RESULT
Compile fails

EXPECTED RESULT
Compile succeeds

SOFTWARE/OS VERSIONS
GCC: 13.2.1_p20240113
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.12
Comment 1 Erik Quaeghebeur 2024-01-30 06:49:54 UTC
Downstream bug: https://bugs.gentoo.org/922520
Comment 2 Sam James 2024-01-30 06:51:08 UTC
(Note that it may build with just -flto, but -Wodr warnings indicate it's unsafe, so we tell people downstream to use -Werror=odr with LTO.)
Comment 3 Dmitry Kazakov 2024-01-30 09:21:22 UTC
Thank you for the report! It sounds as a nice isseu :)
Comment 4 Dmitry Kazakov 2024-01-30 14:32:31 UTC
Git commit e33c7d7d533d5289c3a37007f8cf574af5bc7102 by Dmitry Kazakov.
Committed on 30/01/2024 at 14:31.
Pushed by dkazakov into branch 'master'.

Possibly fix ODR violation in the transform tool strategies

M  +2    -0    plugins/tools/tool_transform2/kis_free_transform_strategy.cpp
M  +2    -1    plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp

https://invent.kde.org/graphics/krita/-/commit/e33c7d7d533d5289c3a37007f8cf574af5bc7102
Comment 5 Dmitry Kazakov 2024-01-30 14:33:00 UTC
Git commit 2c4dd042df1518d67c117ced08c5a2f3729c3193 by Dmitry Kazakov.
Committed on 30/01/2024 at 14:32.
Pushed by dkazakov into branch 'krita/5.2'.

Possibly fix ODR violation in the transform tool strategies


(cherry picked from commit e33c7d7d533d5289c3a37007f8cf574af5bc7102)

M  +2    -0    plugins/tools/tool_transform2/kis_free_transform_strategy.cpp
M  +2    -1    plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp

https://invent.kde.org/graphics/krita/-/commit/2c4dd042df1518d67c117ced08c5a2f3729c3193