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

shiboken2: fails on crossbuild, need to pass platform's target definition to clang

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.15.2
    • Shiboken
    • None
    • qt 5.15.2, PySide Qt 5.15.2, clang 11.0

    Description

      Using shiboken2 to generate python's binding for Qt (pyside) fails if crossbuild is requested.

      This happens for some target platform like `arm7l-glibc`, because shiboken2 calls the crossbuild clang compiler as expected, but it fails: see log below.

      (full build log here: https://github.com/void-linux/void-packages/pull/26962/checks?check_run_id=1584350893)

      [ 1%] Building CXX object libpyside/CMakeFiles/pyside2.dir/globalreceiverv2.cpp.o 
       
      qt.shiboken: (core) CLANG builtins includes directory: /usr/armv7l-linux-gnueabihf/usr/lib/clang/11.0.0/include 
       
      (core) clang_parseTranslationUnit2(0x0, cmd[14]=-isystem/usr/armv7l-linux-gnueabihf/usr/lib/clang/11.0.0/include -fPIC -Wno-constant-logical-operand -std=c++14 
      -I/builddir/pyside-setup-opensource-src-5.15.2/sources/pyside2/PySide2 -I/usr/armv7l-linux-gnueabihf/usr/include/qt5 -I/usr/armv7l-linux-gnueabihf/usr/include/qt5 
      -I/usr/armv7l-linux-gnueabihf/usr/include/qt5/QtCore -I/usr/armv7l-linux-gnueabihf/usr/lib/qt5/mkspecs/linux-g++ 
      -I/usr/armv7l-linux-gnueabihf/usr -I/usr/armv7l-linux-gnueabihf/usr/include /tmp/QtCore_global_cqCVQJ.hpp 
      "-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))" 
      "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);") 
       
      /usr/armv7l-linux-gnueabihf/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found
      

      Unfortunately, calling the crossbuild clang compiler this way is not enough.
      The error below might be fixed if specifying the target's platform to clang, like option `-target armv7l-linux-gnueabihf`.

      Indeed, this makes defining specific glibc macro for this platform that is needed : defining macro ` __ARM_PCS_VFP` in this case makes `include/gnu/stubs.h` choose `gnu/stubs-hard.h` instead of `gnu/stubs-soft.h`

      $ clang -target armv7l-linux-gnueabihf -dM -E - < /dev/null | grep

      ARM_PCS_VFP#define __ARM_PCS_VFP 1

      A workaround might be add an option to shiboken2 to pass some clang options.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              yopito Pierre Bourgin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes