Compile Error When Adding wiringPi Libraries
-
Hello,
I am having problems adding the Wiring Pi libraries to my QtonPi project. I have succesfully installed and tested WiringPi, as per the instructions on: wiringPi.com/download-and-install/
In my project's .pro file, I've added "INCLUDEPATH += /usr/local/include" and "LIBS += /usr/local/lib -lwiringPi".
My program compiles successfully without the Wiring Pi libraries included, but I get the following error when they are: "/usr/local/lib: file not recognized: Is a directory", "collect2: error: ld returned 1 exit status"
Performing a Google search suggests that this may have something to do with -lpthread, but I do not know where to go with that.
Any help would be much appreciated. Thanks in advance!
Here is my full .pro file:
@#-------------------------------------------------Project created by QtCreator 2013-11-25T11:11:22
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Frisker_v1
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
target.path = /home/pi
INSTALLS += targetINCLUDEPATH += /usr/local/include
SOURCES +=
taskprogress.cpp
mainwindow.cpp
main.cpp
frisker.cpp
optionsdialog.cppHEADERS +=
taskprogress.h
mainwindow.h
lcdTimer.h
frisker.h
lcdCounter.h
trigger.h
optionsdialog.hLIBS += /usr/local/lib -lwiringPi
@Here is a portion of my compiler output:
@15:44:37: Running steps for project Frisker_v1...
15:44:37: Configuration unchanged, skipping qmake step.
.
.
.
.
In file included from /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/QtCore/qobject.h:48:0,
from /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/QtWidgets/qwidget.h:46,
from /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/QtWidgets/qmainwindow.h:45,
from /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/QtWidgets/QMainWindow:1,
from mainwindow.h:4,
from moc_mainwindow.cpp:9:
/mnt/rasp-pi-rootfs/usr/local/qt5pi/include/QtCore/qstring.h:300:17: note: the mangling of 'va_list' has changed in GCC 4.4
/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rasp-pi-rootfs/opt/vc/lib -Wl,-rpath-link,/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf --sysroot=/mnt/rasp-pi-rootfs -Wl,-rpath,/usr/local/qt5pi/lib -o Frisker_v1 taskprogress.o spreadsheet.o sortdialog.o mainwindow.o main.o gotocelldialog.o frisker.o finddialog.o cell.o optionsdialog.o qrc_spreadsheet.o moc_taskprogress.o moc_spreadsheet.o moc_sortdialog.o moc_mainwindow.o moc_lcdTimer.o moc_gotocelldialog.o moc_frisker.o moc_finddialog.o moc_lcdCounter.o moc_trigger.o moc_optionsdialog.o -L/mnt/rasp-pi-rootfs/opt/vc/lib /usr/local/lib -lwiringPi -L/mnt/rasp-pi-rootfs/usr/local/qt5pi/lib -lQt5Widgets -L/usr/local/qt5pi/lib -lQt5Gui -lQt5Core -lGLESv2 -lpthread
/usr/local/lib: file not recognized: Is a directory
collect2: error: ld returned 1 exit status
make: *** [Frisker_v1] Error 1
15:44:43: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Frisker_v1 (kit: Raspberry Pi)
When executing step 'Make'
15:44:43: Elapsed time: 00:06.
@ -
Hi,
You are missing a -L before the path in LIBS +=
-
When I do that I get the following errors:
"skipping incompatible /usr/local/lib/libwiringPi.so when searching for -lwiringPi"
"skipping incompatible /mnt/rasp-pi-rootfs/usr/lib/libwiringPi.so when searching for -lwiringPi"However I am able to deploy the project. Can I ignore these errors?
(Note: The only function I have added to my code from wiringPi so far is the setup function.)Compiler Output:
@.
.
.
/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rasp-pi-rootfs/opt/vc/lib -Wl,-rpath-link,/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf --sysroot=/mnt/rasp-pi-rootfs -Wl,-rpath,/usr/local/qt5pi/lib -o Frisker_v1 taskprogress.o spreadsheet.o sortdialog.o mainwindow.o main.o gotocelldialog.o frisker.o finddialog.o cell.o optionsdialog.o qrc_spreadsheet.o moc_taskprogress.o moc_spreadsheet.o moc_sortdialog.o moc_mainwindow.o moc_lcdTimer.o moc_gotocelldialog.o moc_frisker.o moc_finddialog.o moc_lcdCounter.o moc_trigger.o moc_optionsdialog.o -L/mnt/rasp-pi-rootfs/opt/vc/lib -L/usr/local/lib -lwiringPi -L/mnt/rasp-pi-rootfs/usr/local/qt5pi/lib -lQt5Widgets -L/usr/local/qt5pi/lib -lQt5Gui -lQt5Core -lGLESv2 -lpthread
/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/local/lib/libwiringPi.so when searching for -lwiringPi
{ test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]+([0-9]).([0-9]).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'Frisker_v1' && test -f Frisker_v1.gdb-index && /opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-objcopy --add-section '.gdb_index=Frisker_v1.gdb-index' --set-section-flags '.gdb_index=readonly' 'Frisker_v1' 'Frisker_v1' && rm -f Frisker_v1.gdb-index || true
/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /mnt/rasp-pi-rootfs/usr/lib/libwiringPi.so when searching for -lwiringPi
16:31:59: The process "/usr/bin/make" exited normally.
16:31:59: Elapsed time: 00:44.
@ -
You are trying to link a x86/x86_64 library to an ARM built program.
-
Get the ARM version of that lib or cross-compile it