VSCode QT GPIO header problem

I am testing torizon core from visual studio code and QT example but I have a problem when i add libgpiod to my .pro file or try to include #include <gpiod.h>

At this point:

  1. I have a working qt gui example.
  2. I add devpackage to my torizoncore container; libgpiod-dev:arm64 libgpiod2:arm64
  3. I add libgpiod2 gpiod libgpiod-dev (The last one only to test toradex gpio-toggle.c example)
  4. I build gpio-toggle.c from container terminal and it and gpio toggle works fine in my container (Same that QT App)

Now I try to add toggle to my qt app, but when I add lib to my .pro file using:
LIBS += -L/usr/lib/aarch64-linux-gnu -lgpiod

I get this error from VSCode:
inux-gnu/libQt5Core.so -lpthread
/usr/lib/gcc-cross/aarch64-linux-gnu/10/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lgpiod
collect2: error: ld returned 1 exit status

And if I add #include <gpiod.h> I get:
In file included from gpioTest.cpp:1:
mainwindow.h:16:10: fatal error: gpiod.h: No such file or directory
16 | #include <gpiod.h>
| ^~~~~~~~~

How I could solve it?
Best regards

Greetings @delta,

Just so our team has more information to try and reproduce/debug this issue, I have a couple questions if you don’t mind.

  • What version of the Torizon Extensions are you using?
  • To reproduce the situation in the Qt app could you clearly state your steps?
    • It sounds like you created a C/C++ Qt project (What kind? QtCore, QML, Widgets)
    • Add libgpiod-dev:arm64 libgpiod2:arm64 to devpackages
    • Add libgpiod2 gpiod libgpiod-dev to extrapackages
    • Add LIBS += -L/usr/lib/aarch64-linux-gnu -lgpiod to the *.pro file
    • Am I missing any other relevant steps you may have done?

Best Regards,

Thanks for your answer @jeremias.tx ,

Sure, this is the process. I use VSC extension Toradex Torizon Support v1.4.0 in VSC 1.65.2 on Fedora.
I created C/C++ Qt widget project.

Best regards

I would humbly suggest you spin up a Ubuntu 20.04 development environment and try to duplicate the issue from there. RPM based distros have weird security and other issues.

If everything works on Ubuntu, stay with Ubuntu.

Most device development shops use Ubuntu or a Debian based distro for development and testing.

Alright after performing the steps I laid out, I’m unfortunately not able to reproduce your issue on my side. For me after adding the link to libgpiod the compilation succeeds with no issue.

As for what could be wrong on your side. Perhaps after adding the packages to devpackages, you didn’t rebuild & reload the SDK container?

Best Regards,

I change my development destokp PC with Fedora to my laptop with windows 10 and works fine, I will continue my development on this PC and in the future try to had another test on Fedora to understand where is the problem.

Thanks for your help!!!

I’m glad to hear it works now, but I would like to understand why this seems to fail on Fedora for whatever reason. If you ever get a chance to look into this please let me know, in case there’s anything we can do to improve our extensions.

Best Regards,