Solved WiringPi build error
-
@this I changed the version of qt and run it without errors.
The version I used was qt5.4.2.
I changed it to another version and it builds without errors.
Thank you for your help.Is there a problem with qt5.4.2?
Hangul (Korean language) was also out of print, I had to worry about changing the version.
But wiringPi is also incompatible
Is there a problem with qt5.4.2 version? -
@this wiringPi isn't a Qt library to my knowledge, so it is not a Qt problem.
This is wrong:LIBS += -L/usr/local/lib-lwiringPi
it must be:
LIBS += -L/usr/local/lib -lwiringPi
(space between lib and -l).
I really don't know what you are doing wrong. You should read http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
Also, "undefined reference" errors means that the a library (in your case wiringPi) is missing. Take a closer look at the compiler/linker output.
You can try to write a simple C++ console application without Qt but with wiringPi. Just create a makefile and build your app. -
@jsulm Qt Build with no error when running with version 5.5.1.
However, when building with qt 4.5.2, the above error also occurs.
Is not this a version issue?
Space above the space is filled in.
I misplaced that article. -
@this Again: wiringPi is not a Qt library. In fact it is not even C++, it is a C library. You don't build it with Qt (Qt is not a compiler) you build it with a C compiler (gcc).
So what is the problem now: you can't build wiringPi or you can't build your Qt app which uses this lib? -
@jsulm I am developing in qt.
So I need to build wiringPi using qt.I think I can use wiringPi in qt.
WiringPi is a c language library.
So is it impossible to use in qt?
If I can not use wiringPi in qt, I will code it in another way for GPIO control.If available in qt,
Having said that,
Ubuntu pc -> raspberrypi (rasbian)
I am developing using cross compile.
I am developing using qt 5.4.2.I tried to continue but failed to recognize the wiringPi function.
So I tried qt 5.5.1.
Qt 5.5.1 is not a cross compile.
I run it on qt of ubuntu pc.The same source and the same project.
Changed version and os of qt.
(Note that changing os does not mean that raspberrypi has built the program.
It refers to the os where the qt file is executed.)
It recognizes wiringPi without error.So I think.
Whether wiringPi is compatible with the Qt version,
Whether wirignPi is not available depending on OSDo you understand my situation now?
-
@this said in WiringPi build error:
So I need to build wiringPi using qt.
You don't build it using Qt, Qt is not a compiler. You need to understand the difference: Qt is just a C++ framework. You build the library using a compiler, not Qt.
Yes, you can use C libraries in C++ projects. So, you can use it in your Qt project.
"Whether wiringPi is compatible with the Qt version" - this does not make sense as wiringPi and Qt are two completely independent things, there is no compatibility. Your problem is not compatibility with Qt, your problem is with the wiringPi library which is apparently not compatible with the ABI you're using as the linker error clearly states. You most probably built wiringPi with a different compiler with different parameters. See one of my posts above: "The lib is EABI5: "ELF 32-bit LSB shared object, ARM, EABI5". I think RPi uses EABI7 or something. From where did you get the lib?" - this does not have anything to do with Qt.
We already discuss this for long time now. I asked you whether you built wiringPi on your RaspberyPi and then copied the lib to your PC? Did you? You should build wiringPi with exact same compiler you're using for cross compilation (means: you need to cross compile wiringPi).
So, my question is: how exactly did you build wiringPi for RaspberryPi? -
@jsulm So, do you use wiringPI installed from raspberrypi?
Do you want to copy the wiringPi installed by raspberrypi and enter the link to the ubuntu pc?I did not build wiringPi for cross compilation.
I kept asking the way.What should I set up to use wiringPI in a cross-compilation environment?
I do not speak English well.
We still communicate using translator.
Please describe in simple words. -
@this May be this can help: https://www.raspberrypi.org/forums/viewtopic.php?t=33881&p=289337
-
@jsulm I do not understand how to use wiringPi in a cross compile.
Is wiringPi installed on raspberrypi?
Is the link path of the LIBS a wiringPi location in raspberrypi?
Is not wiringPi down to ubuntu-> rasberrpy when cross compile?
I wonder how the wiringPi library is cross compiled.If wiringPi should be present in rasberrypi,
Can I import files located in rasberrypi on a ubuntu pc into LIBS?I am running the qt project on ubuntu, is it that the library at a specific location in rasberrpypi is loaded and executed before the build?
I can not understand.
I do not understand the relationship of linking wiringPI to LIBS.Where does wringPI go to as a cross compile?
-
@this Usually, if you cross compile you have a sysroot. A sysroot is the file system of your target device containing all needed header files and libraries. That means: the path you use for wiringPi would usually be the one pointing to your sysroot. It looks like you have your sysroot under /mnt/rasp-pi-rootfs.
Try (I assume you have wiringPi under /usr/local/lib on your RaspberryPi, correct the path if it is different):-L/mnt/rasp-pi-rootfs/usr/local/lib -lwiringPi