Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find a package configuration file provided by "Qt5Widgets". #94

Closed
satoru-i opened this issue Aug 10, 2023 · 11 comments
Closed

Comments

@satoru-i
Copy link

I tried cross-compiling turtlesim for KR260 to get used to using the KRS.
https://github.com/ros/ros_tutorials/tree/humble-devel/turtlesim

However, when I try to build with the following command, I get an error.

colcon build --build-base=build-kr260-ubuntu --install-base=install-kr260-ubuntu --merge-install --mixin kr260 --packages-select turtlesim
--- stderr: turtlesim                         
CMake Error at /home/satorui/krs_ws/acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/usr/lib/aarch64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)

---
Failed   <<< turtlesim [0.91s, exited with code 1]

Qt5Widgets exists in sysroot, but how can I build an app that uses Qt5Widgets?

@vmayoral
Copy link
Contributor

Are you sure Qt5Widgets is properly set up in the sysroot? How have you verified it? If properly set in the sysroot, then, in principle, you wouldn't have this issue.

@jasvinderkhurana
Copy link
Collaborator

@vmayoral, It seems QT is not set by default in rootfs, so can you confirm that in the KR260 firmware, did you enabled QT explicitly ? If not, then there might not be any QT libs. Can you guide on how to create a new firmware with QT enabled in sysroot?

@vmayoral
Copy link
Contributor

vmayoral commented Aug 12, 2023

@vmayoral, It seems QT is not set by default in rootfs, so can you confirm that in the KR260 firmware, did you enabled QT explicitly ? If not, then there might not be any QT libs. Can you guide on how to create a new firmware with QT enabled in sysroot?

QT's not part-of (or generally needed) an embedded ROS rootfs. It implies a significant amount of deps. and adds unnecessary weight, unless you need it, as it seems the case above. This can of course be added by re-creating the firmware artifacts again.

Happy to work together with you and the team @jasvinderkhurana to recreate the firmware artifacts and include what's needed. Let's take this offline to a separate channel. Very excited and discuss this in a next collaboration.

@satoru-i
Copy link
Author

Hi @vmayoral, @jasvinderkhurana,
Thank you both for your comments. As you've probably noticed, I installed KRS exactly as instructed, so I'm using the sysroot found in the firmware below.

https://github.com/ros-acceleration/acceleration_firmware_kr260/releases/download/v1.1.1/acceleration_firmware_kr260.zip

I would appreciate it if you could point me to "how to create a new firmware with QT enabled in sysroot".

@jasvinderkhurana
Copy link
Collaborator

@satoru-i , Can you please confirm whether you are using Ubuntu flow or Petalinux/Yocto flow ? I will check this.

@satoru-i
Copy link
Author

Hi @jasvinderkhurana,
I'm using Ubuntu flow(Ubuntu 22.04, Cross-compilation development) found here.
https://xilinx.github.io/KRS/sphinx/build/html/docs/install.html

@jasvinderkhurana
Copy link
Collaborator

@satoru-i, Thanks for confirming.. I also find this strange because I can see the Qt5Widgets cmake at .../krs_ws/acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/usr/lib/aarch64-linux-gnu/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake , but the environment is not picking up. I am looking at this and will update you as soon as I get any solution.

@jasvinderkhurana
Copy link
Collaborator

jasvinderkhurana commented Aug 22, 2023

@satoru-i, QT is acting differently here, though all the dependencies are available in sysroot it is somehow not able to find it. I have found one workaround to fix the cmake find problem, add dependencies(Qt5Core, Qt5Gui, Qt5Widgets) before Qt5 in CMakelists.txt of turtlesim see below:

find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)

Even after fixing Qt5Widgets error, it gives another issue:

aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory
gmake[2]: *** [CMakeFiles/turtlesim_node.dir/build.make:74: include/turtlesim/moc_turtle_frame.cpp] Error 255
gmake[1]: *** [CMakeFiles/Makefile2:598: CMakeFiles/turtlesim_node.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< turtlesim [3.70s, exited with code 2]

@satoru-i
Copy link
Author

satoru-i commented Aug 23, 2023

Hi @jasvinderkhurana, thank you for looking into it.
Applying that workaround to CMakelists.txt of turtlesim worked around the cmake find problem, and got the same error.

So I did "sudo ln -s ~/krs_ws/install/../acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1", but I got another error.

Starting >>> turtlesim

--- stderr: turtlesim                             
/home/satorui/krs_ws/acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/usr/lib/qt5/bin/moc: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
gmake[2]: *** [CMakeFiles/turtlesim_node.dir/build.make:74: include/turtlesim/moc_turtle_frame.cpp] Error 127
gmake[1]: *** [CMakeFiles/Makefile2:598: CMakeFiles/turtlesim_node.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< turtlesim [7.66s, exited with code 2]

This looks like the same issue as the workaround for installing KRS.
https://xilinx.github.io/KRS/sphinx/build/html/docs/install.html
image

@jasvinderkhurana
Copy link
Collaborator

@satoru-i , that's right, the workaround you did is correct! And regarding your latest error, I also faced the same issue and I observed that "/home/satorui/krs_ws/acceleration/firmware/kr260/sysroots/aarch64-xilinx-linux/usr/lib/qt5/bin/moc" is an Arm binary and it is trying to be executed on x86 machine which is causing the trouble.

The cmake is trying to create a .cpp file from QT. So, as a workaround I compiled the package for x86 first and this creates a moc_turtle_frame.cpp file in build folder. Take that file compile it with turtlesime source code. This is succeeding for me. I have attached the file here and see the changes done in CMakelists.txt of turtlesim below:

image

Let me know if this is working for you as well.

@satoru-i
Copy link
Author

Hi @jasvinderkhurana, Thanks for letting me know the workaround. I also built it and was able to run it on the KR260.
With this information, I'm going to try out some user apps using HLS. Thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants