Bug 471836 - Build failure with -flto -Werror=odr: kded/engine/backends/cryfs/cryfsbackend.cpp:33:12: error: type ‘PlasmaVault::ExitCode’ violates the C++ One Definition Rule [-Werror=odr]
Summary: Build failure with -flto -Werror=odr: kded/engine/backends/cryfs/cryfsbackend...
Status: RESOLVED NOT A BUG
Alias: None
Product: Plasma Vault
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Ivan Čukić
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-01 15:41 UTC by kocelfc
Modified: 2023-09-13 18:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
complete build log (169.01 KB, text/x-log)
2023-07-01 15:41 UTC, kocelfc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kocelfc 2023-07-01 15:41:49 UTC
Created attachment 160026 [details]
complete build log

SUMMARY

plasma-vault 5.27.6 fails to compile with -flto -Werror=odr added to CFLAGS and CXXFLAGS


/home/kostadin/plasma-vault/kded/engine/backends/cryfs/cryfsbackend.cpp:33:12: error: type ‘PlasmaVault::ExitCode’ violates the C++ One Definition Rule [-Werror=odr]
   33 | enum class ExitCode : int {
      |            ^
/home/kostadin/plasma-vault/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp:32:12: note: an enum with different value name is defined in another translation unit
   32 | enum class ExitCode : int {
      |            ^
/home/kostadin/plasma-vault/kded/engine/backends/cryfs/cryfsbackend.cpp:37:5: note: name ‘UnspecifiedError’ differs from name ‘NonEmptyCipherDir’ defined in another translation unit
   37 |     UnspecifiedError = 1,
      |     ^
/home/kostadin/plasma-vault/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp:36:5: note: mismatching definition
   36 |     NonEmptyCipherDir = 6,
      |     ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status


STEPS TO REPRODUCE
1. git clone -b Plasma/5.27 https://invent.kde.org/plasma/plasma-vault.git
2. cd plasma-vault
3. mkdir build && cd build
4. run `CFLAGS="-O2 -flto -Werror=odr" CXXFLAGS="-O2 -flto -Werror=odr" cmake ..
5. make

OBSERVED RESULT

Build fails due to ODR violations 

EXPECTED RESULT

Build completes fine with no errors


SOFTWARE/OS VERSIONS
Gentoo Linux 2.13
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
gcc version: (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527
Comment 1 Nate Graham 2023-09-13 18:56:19 UTC
We don't build with -Werror by default, and as such, this isn't considered a bug that's trackable in the bug tracker system. But please do feel free to submit a merge request to improve it!