ros / meta-ros

OpenEmbedded Layers for ROS 1 and ROS 2
MIT License
382 stars 251 forks source link

ImportError: cannot import name 'QtCore' from 'PyQt5' (unknown location) #1072

Open bchoineubility opened 10 months ago

bchoineubility commented 10 months ago

Hi,

I am trying to build qt-gui-cpp. by the way, python3-pyqt5-native would not support qt core module.

| FAILED: sip/qt_gui_cpp_sip/Makefile /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/build/sip/qt_gui_cpp_sip/Makefile
| cd /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/git/src/qt_gui_cpp_sip && /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot-native/usr/bin/python3-native/python3 /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/share/python_qt_binding/cmake/sip_configure.py /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/build/sip/qt_gui_cpp_sip qt_gui_cpp.sip /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/build/src/qt_gui_cpp_sip "/home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/git/src/qt_gui_cpp_sip/../../include /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/pluginlib /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/ament_index_cpp /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/class_loader /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/rcpputils /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/rcutils /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/include/python3.10" "/home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libament_index_cpp.so /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libconsole_bridge.so.1.0 dl /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/librcutils.so /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/librcpputils.so /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libclass_loader.so /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libtinyxml2.so.9.0.0 /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libtinyxml2.so.9.0.0 /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/lib/libpython3.10.so /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/build/libqt_gui_cpp.so" "lib" ""
| /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/share/python_qt_binding/cmake/sip_configure.py:2: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
|   from distutils.spawn import find_executable
| Traceback (most recent call last):
|   File "/home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/qt-gui-cpp/2.2.2-1-r0/recipe-sysroot/usr/share/python_qt_binding/cmake/sip_configure.py", line 9, in <module>
|     from PyQt5 import QtCore
| ImportError: cannot import name 'QtCore' from 'PyQt5' (unknown location)
| ninja: build stopped: subcommand failed.
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/bchoi/work/official_ros_humble_build/sources/meta-ros/meta-ros2-humble/generated-recipes/qt-gui-core/qt-gui-cpp_2.2.2-1.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2479 tasks of which 2429 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bchoi/work/official_ros_humble_build/sources/meta-ros/meta-ros2-humble/generated-recipes/qt-gui-core/qt-gui-cpp_2.2.2-1.bb:do_compile
Summary: There was 1 WARNING message.
Summary: There was 1 ERROR message, returning a non-zero exit code.
bchoi@nvidia-build:~/work/official_ros_humble_build/bchoi-build$

I tried to add python3-pyqt5 dependency to qt-gui-cpp recipe. but, it doesn't work now.

I hope to know avoid this issue.

BR, Mark

robwoolley commented 10 months ago

Thanks for reporting this. I added support for python3-pyqt5-native, 3 years ago but haven't submitted it for merging yet (see #674 )

I intend to submit it to meta-qt5 as part of getting ros-image-world to build.

bchoineubility commented 10 months ago

Hi @robwoolley

I am trying to build recipe python3-pyqt5-native-5.15.1.bb with your efforts for this issue.

I changed python-pyqt5.inc as followings, because version do not match with kirkstone.

SUMMARY = "Python Qt5 Bindings"
AUTHOR = "Phil Thomson @ riverbank.co.uk"
HOMEPAGE = "http://riverbankcomputing.co.uk"
SECTION = "devel/python"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "\
    file://LICENSE;md5=d32239bcb673463ab874e80d47fae504 \
"
SRC_URI = "\
    https://www.riverbankcomputing.com/static/Downloads/PyQt5/${PV}/PyQt5_gpl-${PV}.tar.gz \
"
SRC_URI[md5sum] = "67508b652098d2e05c4c2b5baeb170cc"
SRC_URI[sha256sum] = "3718ce847d824090fd5f95ff3f13847ee75c2507368d4cbaeb48338f506e59bf"
S = "${WORKDIR}/PyQt5_gpl-${PV}"

inherit qmake5
DEPENDS = "qtbase qtdeclarative qtquickcontrols2"

export BUILD_SYS
export HOST_SYS
export STAGING_INCDIR
export STAGING_LIBDIR

PARALLEL_MAKEINST = ""

DISABLED_FEATURES = "PyQt_Desktop_OpenGL PyQt_Accessibility PyQt_SessionManager ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '', 'PyQt_OpenGL', d)}"

PYQT_MODULES = "QtCore QtGui QtNetwork QtXml QtNetwork QtQml ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'QtQuick QtWidgets QtQuickWidgets', '', d)}"

do_configure_prepend() {
    cd ${S}
    echo "py_platform = linux" > pyqt.cfg
    echo "py_inc_dir = %(sysroot)/$includedir/python%(py_major).%(py_minor)${PYTHON_ABI}" >> pyqt.cfg
    echo "py_pylib_dir = %(sysroot)/${libdir}/python%(py_major).%(py_minor)" >> pyqt.cfg
    echo "py_pylib_lib = python$%(py_major).%(py_minor)" >> pyqt.cfg
    echo "pyqt_module_dir = ${D}/${libdir}/python%(py_major).%(py_minor)/site-packages" >> pyqt.cfg
    echo "pyqt_bin_dir = ${D}/${bindir}" >> pyqt.cfg
    echo "pyqt_sip_dir = ${D}/${datadir}/sip/PyQt5" >> pyqt.cfg
    echo "pyuic_interpreter = ${D}/${bindir}/python%(py_major).%(py_minor)" >> pyqt.cfg
    echo "pyqt_disabled_features = ${DISABLED_FEATURES}" >> pyqt.cfg
    echo "qt_shared = True" >> pyqt.cfg
    QT_VERSION=`${OE_QMAKE_QMAKE} -query QT_VERSION`
    echo "[Qt $QT_VERSION]" >> pyqt.cfg
    echo "pyqt_modules = ${PYQT_MODULES}" >> pyqt.cfg
    echo yes | ${PYTHON} configure.py --verbose --qmake  ${STAGING_BINDIR_NATIVE}/${QT_DIR_NAME}/qmake --configuration pyqt.cfg $(if [ -n "${STAGING_HOST_DIR}" ]; then echo --sysroot ${STAGING_HOST_DIR}; fi)
}

do_compile() {
    cd ${S}
    oe_runmake
}

do_install() {
    cd ${S}
    oe_runmake MAKEFLAGS='-j 1' install
}

FILES_${PN} += "${libdir}/${PYTHON_DIR}/site-packages ${datadir}/sip/PyQt5/"

RDEPENDS_${PN} = "qtbase qtdeclarative qtquickcontrols2 qtquickcontrols2-mkspecs"

By the way, this also reference Qt gui also.

 Reading /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r1/PyQt5-5.15.1/QtCore/QtCore.pro
| Reading /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r1/PyQt5-5.15.1/QtGui/QtGui.pro
| Project ERROR: Unknown module(s) in QT: gui
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/bchoi/work/official_ros_humble_build/sources/meta-neubility/yocto-land/recipes-python/pyqt5/python3-pyqt5-native_5.15.1.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1644 tasks of which 1636 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bchoi/work/official_ros_humble_build/sources/meta-neubility/yocto-land/recipes-python/pyqt5/python3-pyqt5-native_5.15.1.bb:do_configure

before doing it, I remove --sysroot option because STAGING_HOST_DIR is empty.

BR, Mark

bchoineubility commented 10 months ago

I managed to succeed in building python3-pyqt5-native with kirkstone qt-5.15.7.

Here, I leave my recipe for it.

SUMMARY = "Python Qt5 Bindings"
AUTHOR = "Phil Thomson @ riverbank.co.uk"
HOMEPAGE = "https://www.riverbankcomputing.com/software/pyqt"
SECTION = "devel/python"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "\
    file://LICENSE;md5=d32239bcb673463ab874e80d47fae504 \
"

inherit pypi

PYPI_PACKAGE = "PyQt5"

SRC_URI[md5sum] = "b60f895e70d31d774e6cd374efd17c65"
SRC_URI[sha256sum] = "d9a76b850246d08da9863189ecb98f6c2aa9b4d97a3e85e29330a264aed0f9a1"

S = "${WORKDIR}/PyQt5-${PV}"

inherit qmake5
inherit python3native python3-dir

DEPENDS = "qtbase qtdeclarative qtquickcontrols2"
DEPENDS += "sip3-native python3-native"

PARALLEL_MAKEINST = ""

DISABLED_FEATURES = "PyQt_Desktop_OpenGL PyQt_Accessibility PyQt_SessionManager ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '', 'PyQt_OpenGL', d)}"
#PYQT_MODULES = "QtCore QtGui QtNetwork QtQml ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'QtQuick QtWidgets QtQuickWidgets', '', d)}"
#PYQT_MODULES = "QtNetwork QtQml"
#PYQT_MODULES = "QtCore QtGui QtNetwork QtXml QtNetwork QtQml"

# $includedir is recipes-sysroot-native/usr/include
# can not inject dependenies of qmake with configure.py.
do_configure:prepend() {
    cd ${S}
    echo "py_platform = linux" > pyqt.cfg
    echo "py_inc_dir = $includedir/python%(py_major).%(py_minor)${PYTHON_ABI}" >> pyqt.cfg
    echo "py_pylib_dir = ${libdir}/python%(py_major).%(py_minor)" >> pyqt.cfg
    echo "py_pylib_lib = python$%(py_major).%(py_minor)" >> pyqt.cfg
#    echo "pyqt_module_dir = ${D}/usr/lib/python%(py_major).%(py_minor)/site-packages" >> pyqt.cfg
#    echo "pyqt_bin_dir = ${D}/usr/bin" >> pyqt.cfg
#    echo "pyqt_sip_dir = ${D}/usr/share/sip/PyQt5" >> pyqt.cfg
    echo "pyqt_module_dir = ${libdir}/python%(py_major).%(py_minor)/site-packages" >> pyqt.cfg
    echo "pyqt_bin_dir = ${bindir}" >> pyqt.cfg
    echo "pyqt_sip_dir = ${datadir}/sip/PyQt5" >> pyqt.cfg
    echo "pyuic_interpreter = ${bindir}/python%(py_major).%(py_minor)" >> pyqt.cfg
    echo "pyqt_disabled_features = ${DISABLED_FEATURES}" >> pyqt.cfg
    echo "qt_shared = True" >> pyqt.cfg
    QT_VERSION=`${OE_QMAKE_QMAKE} -query QT_VERSION`
    echo "[Qt $QT_VERSION]" >> pyqt.cfg
#    echo "pyqt_modules = ${PYQT_MODULES}" >> pyqt.cfg
    echo yes | ${PYTHON} configure.py --verbose --qmake  ${STAGING_BINDIR_NATIVE}/${QT_DIR_NAME}/qmake --configuration pyqt.cfg --sysroot ${STAGING_DIR_NATIVE}
}

do_configure:append() {
  modules="QtDBus QtNetwork QtXml"
  for module in $modules
    do
    sed -i'' -r -e "/INCPATH/a\INCPATH       += -I../../recipe-sysroot-native/usr/include/$module" ${S}/$module/Makefile
  done
  sed -i'' -r -e "/INCPATH/a\INCPATH       += -I../../recipe-sysroot-native/usr/include/QtXml" ${S}/pyrcc/Makefile
  sed -i'' -r -e "/INCPATH/a\INCPATH       += -I../../recipe-sysroot-native/usr/include/QtXml" ${S}/pylupdate/Makefile
}

EXTRA_QMAKEVARS_POST = "QT=core"

do_compile() {
    cd ${S}
    oe_runmake
}

do_install:class-native() {
    cd ${S}
    oe_runmake MAKEFLAGS='-j 1' install INSTALL_ROOT=${D}
}

FILES:${PN} += "${libdir}/${PYTHON_DIR}/site-packages ${datadir}/sip/PyQt5/"

RDEPENDS:${PN} = "qtbase qtdeclarative qtquickcontrols2 qtquickcontrols2-mkspecs"
RDEPENDS:${PN} += "python3-core python3-sip3"

inherit native

Can you check this recipe is correct and let me know I am missing?

BR, Mark

robwoolley commented 10 months ago

Hi Mark,

Thanks for looking into this. I took a look at it last week as well. Many of the problems I encountered only appeared when I started trying to use it to build qt-gui-cpp. I had to add a few host tools (like python3-pyqt-build-native) and heavy work on sip3 to make qt-gui-cpp build.

There are 2 things I think may be incorrect. It looks like the intent was to specify the Qt modules explicitly in PYQT_MODULES. Commenting this out and using EXTRA_QMAKEVARS_POST seems to be against the original intent of the maintainer. I think removing ${D} from pyqt_module_dir, pyqt_bin_dir, pyqt_sip_dir may cause problems when trying to use these tools in other recipes. From memory, the ${D} variable is the full absolute path under the "image" directory for -native packages. I suspect this means that they are getting installed back into one of the recipes-sysroot directories and not getting packaged.

I am planning on pushing out a developer branch with my changes this week. Would you be interested in collaborating to verify that you can reproduce a build of qt-gui-cpp with it?

Regards, Rob

robwoolley commented 10 months ago

I have started to push my changes upstream starting with meta-openembedded. You can see my cover letter and 2 patches to sip3 here:

After it is accepted, I can push my pyqt5 changes to meta-qt5.

robwoolley commented 10 months ago

I have made a pull request to meta-qt5 with the changes I made to python3-pyqt5 to add -native: https://github.com/meta-qt5/meta-qt5/pull/546

robwoolley commented 10 months ago

I have created a feature branch with the qt-gui-cpp changes: https://github.com/robwoolley/meta-ros/commits/qt-gui-cpp

I am waiting for the sip3 changes to meta-openembedded and the python3-pyqt5 changes to meta-qt5 to be accepted first before applying the changes to meta-ros.

bchoineubility commented 10 months ago

Hi Mark,

Thanks for looking into this. I took a look at it last week as well. Many of the problems I encountered only appeared when I started trying to use it to build qt-gui-cpp. I had to add a few host tools (like python3-pyqt-build-native) and heavy work on sip3 to make qt-gui-cpp build.

There are 2 things I think may be incorrect. It looks like the intent was to specify the Qt modules explicitly in PYQT_MODULES. Commenting this out and using EXTRA_QMAKEVARS_POST seems to be against the original intent of the maintainer. I think removing ${D} from pyqt_module_dir, pyqt_bin_dir, pyqt_sip_dir may cause problems when trying to use these tools in other recipes. From memory, the ${D} variable is the full absolute path under the "image" directory for -native packages. I suspect this means that they are getting installed back into one of the recipes-sysroot directories and not getting packaged.

I am planning on pushing out a developer branch with my changes this week. Would you be interested in collaborating to verify that you can reproduce a build of qt-gui-cpp with it?

Regards, Rob

Hi @robwoolley

Many thanks for looking into my recipe. I think I agree with you. I am not familiar with structure of image folder for native recipes. I know it has full absolute path from highest position for example, /home/bchoi ..... recently.

I have to use EXTRA_QMAKEVARS_POST to avoid qmake error as following:

| Checking to see if the QtGui module should be built...
| /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r0/recipe-sysroot-native/usr/bin/qmake -o cfgtest_QtGui.mk cfgtest_QtGui.pro
| Info: creating stash file /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r0/PyQt5-5.15.1/.qmake.stash
| Project ERROR: Unknown module(s) in QT: gui
|
| Checking to see if the QtHelp module should be built...
| /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r0/recipe-sysroot-native/usr/bin/qmake -o cfgtest_QtHelp.mk cfgtest_QtHelp.pro
| Project ERROR: Unknown module(s) in QT: gui help
|
| Checking to see if the QtMultimedia module should be built...
| /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r0/recipe-sysroot-native/usr/bin/qmake -o cfgtest_QtMultimedia.mk cfgtest_QtMultimedia.pro
| Project ERROR: Unknown module(s) in QT: gui multimedia
|
| Checking to see if the QtMultimediaWidgets module should be built...
| /home/bchoi/work/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.1-r0/recipe-sysroot-native/usr/bin/qmake -o cfgtest_QtMultimediaWidgets.mk cfgtest_QtMultimediaWidgets.pro
| Project ERROR: Unknown module(s) in QT: gui multimediawidgets multimedia

It looks like failure finding qt gui and I couldn't find what module provide it. I just guess qtbase should provide it because I found qtbase recipe has a build option in my memory. (Can you let me know which module provide qt:gui ?)

After build python3-pyqt5-native.bb, I could manage to build qt-gui-cpp also. but, I am not sure it was correct. qt-gui-cpp would generate make file using cmake with two stage, one is for qt-gui-cpp another is for qt-gui-cpp-sip. the former is using ninja obviously the later would using cmake without generator( maybe using make). I could see build error occurred at qt-gui-cpp-sip because it would not aware that yocto build system and generate makefile illegal I think. so, I modified makefile according to yocto build environment then, could build successfully.

But, I am not familiar with qt and pyqt5 and so one, I am not sure it is correct. I think these build error was from difference of build options between qtbase and qtbase-native.

I will test your patches and get back to you.

How do you think about that?

BR, Mark

bchoineubility commented 10 months ago

Hi @robwoolley

Can you share added-the-py_ssize_t_clean-argument-to-the-module-directive.patch you create? I can not find it to test it.

BR, Mark

robwoolley commented 10 months ago

Hi Mark,

I pushed 2 patches here for your convenience: https://github.com/robwoolley/meta-openembedded/tree/kirkstone

Regards, Rob

bchoineubility commented 9 months ago

Hi Rob,

Patch file do not work properly for me.

Logs are :

NOTE: Executing Tasks
ERROR: sip3-4.19.23-r0 do_patch: Applying patch 'added-the-py_ssize_t_clean-argument-to-the-module-directive.patch' on target directory '/home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/sip3/4.19.23-r0/sip-4.19.23'
CmdError('quilt --quiltrc /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/sip3/4.19.23-r0/recipe-sysroot-native/etc/quiltrc push', 0, 'stdout: Applying patch added-the-py_ssize_t_clean-argument-to-the-module-directive.patch
patching file sipgen/gencode.c
patching file sipgen/metasrc/lexer.l
patching file sipgen/metasrc/parser.y
patching file sipgen/sip.h
patching file sphinx/directives.rst
patching file sipgen/lexer.c
Hunk #4 succeeded at 54 with fuzz 1.
Hunk #6 FAILED at 155.
Hunk #9 FAILED at 220.
Hunk #22 FAILED at 1640.
Hunk #23 FAILED at 1670.
Hunk #28 FAILED at 1778.
Hunk #56 FAILED at 3332.
Hunk #59 FAILED at 3377.
Hunk #67 succeeded at 3784 with fuzz 2 (offset 212 lines).
Hunk #68 FAILED at 3581.
Hunk #69 FAILED at 3606.
Hunk #70 FAILED at 3624.
Hunk #71 FAILED at 3667.
Hunk #72 FAILED at 3698.
Hunk #73 FAILED at 3717.
Hunk #74 FAILED at 3735.
Hunk #75 FAILED at 3752.
Hunk #76 FAILED at 3772.
Hunk #77 FAILED at 3782.
Hunk #78 FAILED at 3811.
Hunk #80 FAILED at 3853.
Hunk #83 FAILED at 3924.
Hunk #84 succeeded at 3947 with fuzz 2.
Hunk #85 FAILED at 3962.
Hunk #89 succeeded at 4035 with fuzz 1.
21 out of 93 hunks FAILED -- rejects in file sipgen/lexer.c
patching file sipgen/parser.c
Hunk #19 FAILED at 2348.
Hunk #58 FAILED at 5762.
2 out of 109 hunks FAILED -- rejects in file sipgen/parser.c
patching file sipgen/parser.h
Patch added-the-py_ssize_t_clean-argument-to-the-module-directive.patch does not apply (enforce with -f)

stderr: ')
ERROR: Logfile of failure stored in: /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/armv8a-poky-linux/sip3/4.19.23-r0/temp/log.do_patch.219612
ERROR: Task (/home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/sources/meta-openembedded/meta-oe/recipes-devtools/sip/sip3_4.19.23.bb:do_patch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 93 tasks of which 91 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/sources/meta-openembedded/meta-oe/recipes-devtools/sip/sip3_4.19.23.bb:do_patch
Summary: There was 1 ERROR message, returning a non-zero exit code.

My build configuration are : \

Build Configuration:
BB_VERSION           = "2.0.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "jetson-agx-xavier-devkit"
DISTRO               = "poky"
DISTRO_VERSION       = "4.0.14"
TUNE_FEATURES        = "aarch64 armv8a crc"
TARGET_FPU           = ""
DISTRO_NAME          = "Poky (Yocto Project Reference Distro)"
ROS_DISTRO           = "humble"
ROS_VERSION          = "2"
ROS_PYTHON_VERSION   = "3"
meta
meta-poky
meta-yocto-bsp       = "HEAD:d8d6d921fad14b82167d9f031d4fca06b5e01883"
meta-oe
meta-python
meta-filesystems
meta-networking
meta-multimedia      = "HEAD:f95484417e3d3e65ca15b460ba71dfd35773f0e4"
meta-clang           = "HEAD:71321ddf78ea522b87a6b4bffefb14c988a6d921"
meta-tegra           = "HEAD:2a808b6afb221974196d2eeab3537140ebb63cc7"
meta-qt5             = "kirkstone-next:f5dfcd1417fa01dc59b3fc1f28bbe7c986de0e9d"
meta-chromium        = "HEAD:b279a4dc078ba6957815e2496820f1eadbafd58a"
meta-virtualization  = "HEAD:b3b3dbc67504e8cd498d6db202ddcf5a9dd26a9d"
meta-tegra-community = "HEAD:56ce73e5f5a36cea832894946787bd024b71493e"
meta-ros-common
meta-ros2
meta-ros2-humble     = "kirkstone:950bcc85ad7a223252664688de71f9000cfeb61d"
meta-neubility       = "staging:26a5503c9cda66dfa5f9d8fdf3a9d2adbe5b9992"

I backup my sip3 recipe and download patch and recipe.

bchoi@nvidia-build:~/nvidia-yocto-bsp/official_ros_humble_build/sources/meta-openembedded/meta-oe/recipes-devtools/sip$ tree
.
├── sip3
│   └── added-the-py_ssize_t_clean-argument-to-the-module-directive.patch
├── sip3_4.19.23.bb
└── sip3_4.19.23.org

1 directory, 3 files
bchoi@nvidia-build:~/nvidia-yocto-bsp/official_ros_humble_build/sources/meta-openembedded/meta-oe/recipes-devtools/sip$

BR, Mark

robwoolley commented 9 months ago

Thanks, Mark.

I now see the same thing here. I will send out a revised patch.

robwoolley commented 9 months ago

It seems that "git am" stripped whitespace at the end of the lines when I reapplied the patches. This causes the breakage you saw. I revised the git commit and force pushed the changes to robwoolley/meta-openembedded.

The clean build I did with this seemed to work, hopefully it works for you now with your setup:

git clone -b kirkstone git://git.yoctoproject.org/poky

cd poky

git clone -b kirkstone https://github.com/robwoolley/meta-openembedded.git

 . oe-init-build-env

bitbake-layers add-layer ../meta-openembedded/meta-oe/

bitbake sip3 sip3-native
bchoineubility commented 9 months ago

Hi @robwoolley ,

I could build sip3 and sip3-native after applying patch. but, I could not build python3-pyqt5-native.

I tried to build with :

meta-qt5             = "kirkstone-next:f5dfcd1417fa01dc59b3fc1f28bbe7c986de0e9d"

bchoi@nvidia-build:~/work/third-party/meta-openembedded$ git remote -v
origin  https://github.com/robwoolley/meta-openembedded.git (fetch)
origin  https://github.com/robwoolley/meta-openembedded.git (push)
bchoi@nvidia-build:~/work/third-party/meta-openembedded$ git branch

* kirkstone
bchoi@nvidia-build:~/work/third-party/meta-openembedded$ git show
commit ad1494b75f6ece452bdaec88c32772a32cd9186b (HEAD -> kirkstone, origin/kirkstone)

l attached log and run file. log_run_pyqt5-native.zip

BR, Mark

bchoineubility commented 9 months ago

Hi @robwoolley ,

I tried to debug for segmentation fault and got followings.

Starting program: /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.7-r0/recipe-sysroot-native/usr/bin/sip_debug -w -n PyQt5.sip -t WS_X11 -t Qt_5_15_0 -x PyQt_Desktop_OpenGL -x PyQt_Accessibility -x PyQt_SessionManager -x PyQt_OpenGL -f -P -c /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.7-r0/PyQt5-5.15.7/Qt -I sip -I /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.7-r0/PyQt5-5.15.7/sip /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/work/x86_64-linux/python3-pyqt5-native/5.15.7-r0/PyQt5-5.15.7/sip/Qt/Qtmod.sip
warning: Error disabling address space randomization: 명령을 허용하지 않음
BFD: /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
warning: `/home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2': Shared library architecture unknown is not compatible with target architecture i386:x86-64.
warning: `/home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2': Shared library architecture unknown is not compatible with target architecture i386:x86-64.
BFD: /home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6: unknown type [0x13] section `.relr.dyn'
warning: `/home/bchoi/nvidia-yocto-bsp/official_ros_humble_build/bchoi-build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6': Shared library architecture unknown is not compatible with target architecture i386:x86-64.

Program received signal SIGSEGV, Segmentation fault.
generateCompositeCpp (pt=0x7ffc1bf7d4a0, pt=0x7ffc1bf7d4a0, py_debug=0, codeDir=<optimized out>) at gencode.c:1141
1141        if (isPY_SSIZE_T_CLEAN(mod))
(gdb)

It would be caused by referencing variable "mod" which is NULL. fuction generateCompositeCpp only declare it as a pointer and do not allocate memory now.

This issue is occurred in building python3-pyqt5 as well.

BR, Mark

bchoineubility commented 9 months ago

I think this patch need to change as following because code intent to use to generate PY_SSIZE_T_CLEAN :

 1140 #ifdef MOD_PY_SSIZE_T_CLEAN
 1141         prcode(fp,
 1142 "\n"
 1143 "#define PY_SSIZE_T_CLEAN\n"
 1144             );
 1145 #endif
bchoineubility commented 9 months ago

And I just add to qtbase-native.bb in the meta-qt5 it blown away a problem "module not found QT : gui" .

PACKAGECONFIG += "gui"