[kst] [Bug 484572] New: Build fails with LTO

Eli Schwartz bugzilla_noreply at kde.org
Wed Mar 27 05:22:18 GMT 2024


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

            Bug ID: 484572
           Summary: Build fails with LTO
    Classification: Applications
           Product: kst
           Version: 2.0.8
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: packaging
          Assignee: kst at kde.org
          Reporter: eschwartz93 at gmail.com
  Target Milestone: ---

Created attachment 167831
  --> https://bugs.kde.org/attachment.cgi?id=167831&action=edit
Full build log

I tried to build with the following *FLAGS to optimize the build: `-flto=4
-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing`

Note the -Werror=* flags are used to help detect cases where the compiler tries
to optimize by assuming UB cannot exist in the source code -- if it does exist,
ordinarily the code would be miscompiled, and this says to make the
miscompilation a fatal error.

I got this error:
```
[1138/1138] : && /usr/bin/x86_64-pc-linux-gnu-g++ -march=native
-fstack-protector-all -O2 -pipe -fdiagnostics-color=always
-frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch
-Werror=strict-aliasing  -Wformat -Werror=format-security -Wall -Wl,-O1
-Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch
-Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0    -rdynamic
src/kst/CMakeFiles/kst2.dir/main.cpp.o
src/kst/CMakeFiles/kst2.dir/qrc_icons.cpp.o -o build/bin/kst2 
-Wl,-rpath,/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8_build/build/lib64:
 src/libkstapp/libkst2app.a  build/lib64/libkst2widgets.so.2.0.8 
build/lib64/libkst2math.so.2.0.8  build/lib64/libkst2core.so.2.0.8 
/usr/lib64/libQt5Xml.so.5.15.12  /usr/lib64/libQt5Network.so.5.15.12 
/usr/lib64/libQt5PrintSupport.so.5.15.12  /usr/lib64/libQt5Widgets.so.5.15.12 
/usr/lib64/libQt5Gui.so.5.15.12  /usr/lib64/libQt5Core.so.5.15.12 && :
FAILED: build/bin/kst2 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -march=native -fstack-protector-all -O2
-pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr
-Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat
-Werror=format-security -Wall -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr
-Werror=lto-type-mismatch -Werror=strict-aliasing
-Wl,--defsym=__gentoo_check_ldflags__=0    -rdynamic
src/kst/CMakeFiles/kst2.dir/main.cpp.o
src/kst/CMakeFiles/kst2.dir/qrc_icons.cpp.o -o build/bin/kst2 
-Wl,-rpath,/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8_build/build/lib64:
 src/libkstapp/libkst2app.a  build/lib64/libkst2widgets.so.2.0.8 
build/lib64/libkst2math.so.2.0.8  build/lib64/libkst2core.so.2.0.8 
/usr/lib64/libQt5Xml.so.5.15.12  /usr/lib64/libQt5Network.so.5.15.12 
/usr/lib64/libQt5PrintSupport.so.5.15.12  /usr/lib64/libQt5Widgets.so.5.15.12 
/usr/lib64/libQt5Gui.so.5.15.12  /usr/lib64/libQt5Core.so.5.15.12 && :
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.h:53:7:
error: type ‘struct MainWindow’ violates the C++ One Definition Rule
[-Werror=odr]
   53 | class MainWindow : public QMainWindow
      |       ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.h:53:7:
note: a different type is defined in another translation unit
   53 | class MainWindow : public QMainWindow
      |       ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.h:258:14:
note: the first difference of corresponding definitions is field
‘_createSvgAct’
  258 |     QAction *_createSvgAct;
      |              ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.h:260:14:
note: a field with different name is defined in another translation unit
  260 |     QAction *_createSharedAxisBoxAct;
      |              ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.h:64:10:
error: type of ‘initFromCommandLine’ does not match original declaration
[-Werror=lto-type-mismatch]
   64 |     bool initFromCommandLine();
      |          ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.cpp:431:6:
note: ‘initFromCommandLine’ was previously declared here
  431 | bool MainWindow::initFromCommandLine() {
      |      ^
/var/tmp/portage/sci-visualization/kst-2.0.8-r2/work/Kst-2.0.8/src/libkstapp/mainwindow.cpp:431:6:
note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
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.
/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
ninja: build stopped: subcommand failed.
```

Originally reported downstream: https://bugs.gentoo.org/863296

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kst mailing list