Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2619

Fails to compile with LTO

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P5: Not important
    • 6.6.3
    • 6.6.2
    • Shiboken
    • None
    • Gentoo Linux
    • Linux/X11
    • fd397ea88 (dev), 498ad471e (6.6)

    Description

      I tried to compile shiboken6 6.6.2 with

      -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
      

      I got this compile error:

      ninja -v -j8 -l0
      [1/6] : && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Wall -Wextra -Wno-strict-aliasing -Wno-cast-function-type -fvisibility=hidden -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII  -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -shared -Wl,-soname,libshiboken6-python3.11.so.6.6 -o libshiboken/libshiboken6-python3.11.so.6.6.2 libshiboken/CMakeFiles/libshiboken.dir/basewrapper.cpp.o libshiboken/CMakeFiles/libshiboken.dir/bindingmanager.cpp.o libshiboken/CMakeFiles/libshiboken.dir/bufferprocs_py37.cpp.o libshiboken/CMakeFiles/libshiboken.dir/debugfreehook.cpp.o libshiboken/CMakeFiles/libshiboken.dir/gilstate.cpp.o libshiboken/CMakeFiles/libshiboken.dir/helper.cpp.o libshiboken/CMakeFiles/libshiboken.dir/pep384impl.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkarrayconverter.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkcontainer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkcppstring.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkenum.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkerrors.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkfeature_base.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkmodule.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbknumpy.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbksmartpointer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkstaticstrings.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkstring.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbktypefactory.cpp.o libshiboken/CMakeFiles/libshiboken.dir/shibokenbuffer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/threadstatesaver.cpp.o libshiboken/CMakeFiles/libshiboken.dir/voidptr.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_globals.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_extend.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_helper.cpp.o  -Wl,-rpath,:::::::: && :
      FAILED: libshiboken/libshiboken6-python3.11.so.6.6.2 
      : && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Wall -Wextra -Wno-strict-aliasing -Wno-cast-function-type -fvisibility=hidden -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII  -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -shared -Wl,-soname,libshiboken6-python3.11.so.6.6 -o libshiboken/libshiboken6-python3.11.so.6.6.2 libshiboken/CMakeFiles/libshiboken.dir/basewrapper.cpp.o libshiboken/CMakeFiles/libshiboken.dir/bindingmanager.cpp.o libshiboken/CMakeFiles/libshiboken.dir/bufferprocs_py37.cpp.o libshiboken/CMakeFiles/libshiboken.dir/debugfreehook.cpp.o libshiboken/CMakeFiles/libshiboken.dir/gilstate.cpp.o libshiboken/CMakeFiles/libshiboken.dir/helper.cpp.o libshiboken/CMakeFiles/libshiboken.dir/pep384impl.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkarrayconverter.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkcontainer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkcppstring.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkenum.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkerrors.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkfeature_base.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkmodule.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbknumpy.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbksmartpointer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkstaticstrings.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbkstring.cpp.o libshiboken/CMakeFiles/libshiboken.dir/sbktypefactory.cpp.o libshiboken/CMakeFiles/libshiboken.dir/shibokenbuffer.cpp.o libshiboken/CMakeFiles/libshiboken.dir/threadstatesaver.cpp.o libshiboken/CMakeFiles/libshiboken.dir/voidptr.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_globals.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_extend.cpp.o libshiboken/CMakeFiles/libshiboken.dir/signature/signature_helper.cpp.o  -Wl,-rpath,:::::::: && :
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:53:16: error: type ‘struct _typeobject’ violates the C++ One Definition Rule [-Werror=odr]
         53 | typedef struct _typeobject {
            |                ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:53:16: note: a different type is defined in another translation unit
         53 | typedef struct _typeobject {
            |                ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:88:11: note: the first difference of corresponding definitions is field ‘X31’
         88 |     void *X31;
            |           ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:86:15: note: a field with different name is defined in another translation unit
         86 |     PyObject *tp_dict;
            |               ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:502:38: error: ‘PepStaticMethod_TypePtr’ violates the C++ One Definition Rule [-Werror=odr]
        502 | extern LIBSHIBOKEN_API PyTypeObject *PepStaticMethod_TypePtr;
            |                                      ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:720:15: note: type ‘struct PyTypeObject’ itself violates the C++ One Definition Rule
        720 | PyTypeObject *PepStaticMethod_TypePtr = nullptr;
            |               ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:720:15: note: ‘PepStaticMethod_TypePtr’ was previously declared here
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:348:38: error: ‘PepFunction_TypePtr’ violates the C++ One Definition Rule [-Werror=odr]
        348 | extern LIBSHIBOKEN_API PyTypeObject *PepFunction_TypePtr;
            |                                      ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:697:15: note: type ‘struct PyTypeObject’ itself violates the C++ One Definition Rule
        697 | PyTypeObject *PepFunction_TypePtr = nullptr;
            |               ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:697:15: note: ‘PepFunction_TypePtr’ was previously declared here
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.h:370:38: error: ‘PepMethod_TypePtr’ violates the C++ One Definition Rule [-Werror=odr]
        370 | extern LIBSHIBOKEN_API PyTypeObject *PepMethod_TypePtr;
            |                                      ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:636:15: note: type ‘struct PyTypeObject’ itself violates the C++ One Definition Rule
        636 | PyTypeObject *PepMethod_TypePtr = nullptr;
            |               ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/libshiboken/pep384impl.cpp:636:15: note: ‘PepMethod_TypePtr’ was previously declared here
      /usr/include/python3.11/dictobject.h:15:26: error: ‘PyDict_Type’ violates the C++ One Definition Rule [-Werror=odr]
         15 | PyAPI_DATA(PyTypeObject) PyDict_Type;
            |                          ^
      /usr/include/python3.11/dictobject.h:15:26: note: type ‘struct PyTypeObject’ itself violates the C++ One Definition Rule
         15 | PyAPI_DATA(PyTypeObject) PyDict_Type;
            |                          ^
      /usr/include/python3.11/dictobject.h:15:26: note: ‘PyDict_Type’ was previously declared here
      /usr/include/python3.11/object.h:269:26: error: ‘PyType_Type’ violates the C++ One Definition Rule [-Werror=odr]
        269 | PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
            |                          ^
      /usr/include/python3.11/object.h:269:26: note: type ‘struct PyTypeObject’ itself violates the C++ One Definition Rule
        269 | PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
            |                          ^
      /usr/include/python3.11/object.h:269:26: note: ‘PyType_Type’ was previously declared here
      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
      [2/6] : && /usr/bin/x86_64-pc-linux-gnu-g++ -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Wall -Wextra -Wno-strict-aliasing -Wno-cast-function-type -fvisibility=hidden -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 generator/CMakeFiles/shiboken6.dir/shiboken6_autogen/mocs_compilation.cpp.o generator/CMakeFiles/shiboken6.dir/defaultvalue.cpp.o generator/CMakeFiles/shiboken6.dir/generator.cpp.o generator/CMakeFiles/shiboken6.dir/generatorcontext.cpp.o generator/CMakeFiles/shiboken6.dir/main.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator_container.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator_smartpointer.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/generatorargument.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/headergenerator.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/overloaddata.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/shibokengenerator.cpp.o generator/CMakeFiles/shiboken6.dir/qtdoc/qtdocgenerator.cpp.o generator/CMakeFiles/shiboken6.dir/qtdoc/qtxmltosphinx.cpp.o -o generator/shiboken6  -Wl,-rpath,/usr/lib/llvm/17/lib64::::::::::::::::::  ApiExtractor/libapiextractor.a  /usr/lib64/libQt6Core.so.6.6.2  /usr/lib/llvm/17/lib64/libclang.so.17.0.6  /usr/lib64/libxslt.so  /usr/lib64/libxml2.so  -Wl,-rpath-link,/usr/lib/llvm/17/lib64 && :
      FAILED: generator/shiboken6 
      : && /usr/bin/x86_64-pc-linux-gnu-g++ -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Wall -Wextra -Wno-strict-aliasing -Wno-cast-function-type -fvisibility=hidden -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 generator/CMakeFiles/shiboken6.dir/shiboken6_autogen/mocs_compilation.cpp.o generator/CMakeFiles/shiboken6.dir/defaultvalue.cpp.o generator/CMakeFiles/shiboken6.dir/generator.cpp.o generator/CMakeFiles/shiboken6.dir/generatorcontext.cpp.o generator/CMakeFiles/shiboken6.dir/main.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator_container.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/cppgenerator_smartpointer.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/generatorargument.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/headergenerator.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/overloaddata.cpp.o generator/CMakeFiles/shiboken6.dir/shiboken/shibokengenerator.cpp.o generator/CMakeFiles/shiboken6.dir/qtdoc/qtdocgenerator.cpp.o generator/CMakeFiles/shiboken6.dir/qtdoc/qtxmltosphinx.cpp.o -o generator/shiboken6  -Wl,-rpath,/usr/lib/llvm/17/lib64::::::::::::::::::  ApiExtractor/libapiextractor.a  /usr/lib64/libQt6Core.so.6.6.2  /usr/lib/llvm/17/lib64/libclang.so.17.0.6  /usr/lib64/libxslt.so  /usr/lib64/libxml2.so  -Wl,-rpath-link,/usr/lib/llvm/17/lib64 && :
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp:180:12: error: type ‘WebXmlTag’ violates the C++ One Definition Rule [-Werror=odr]
        180 | enum class WebXmlTag {
            |            ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/ApiExtractor/classdocumentation.cpp:86:12: note: an enum with different value name is defined in another translation unit
         86 | enum class WebXmlTag
            |            ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp:181:5: note: name ‘Unknown’ differs from name ‘Class’ defined in another translation unit
        181 |     Unknown,
            |     ^
      /var/tmp/portage/dev-python/shiboken6-6.6.2/work/pyside-setup-everywhere-src-6.6.2/sources/shiboken6/ApiExtractor/classdocumentation.cpp:88:5: note: mismatching definition
         88 |     Class, Description, Enum, Function, Parameter, Property, Typedef, Other
            |     ^
      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
      

      Downstream report: https://bugs.gentoo.org/925479

      Attachments

        1. build.log
          173 kB
        2. pyside2619_log.txt
          13 kB
        For Gerrit Dashboard: PYSIDE-2619
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            eschwartz Eli Schwartz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes