Solved WiringPi build error
-
@this Which errors?
-
@jsulm It is the same error as the first inquiry.
"file not recognized:file format not recognized
/usr/local/lib/libwiringPi.so
collect2:error:ld returned 1 exit status" -
@this Did you rerun qmake after fixing LIBS in pro file?
-
@jsulm Yes, of course.
I also run rebuild.
However, the same error occurs. -
@this Can you show your pro file and the build log? Are you actually building for ARM?
-
@jsulm ![alt text](image url)
Do you need more information?
-
@this Yes, I need the build log ("Compile Output" tab in QtCreator)
-
@jsulm ![alt text](image url)
I am cross compiling Linux (ubuntu) to raspberrypi.
-
@this 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?
-
@jsulm I'm sorry, but I do not know what lib is.
I can not understand your words.
Are you referring to qt lib?
Are you talking raspberrypi?We have installed cross compile environment by referring to the following site.
https://medium.com/@amirmann/how-to-cross-compile-qt-for-raspberry-pi-3-on-linux-ubuntu-for-beginners-75acf2a078c -
@this I'm talking about libwiringPi.so
How did you install this lib? Was it part of this cross compiling environment or did you get it from somewhere else? -
@jsulm I am sorry.
Installed.
The installation process is as follows:git clone git://git.drogon.net/wiringPi
cd wiringPi/
git pull origin
./buildAt first we installed wiringPi from ubuntu pc.
However, I got the error like above and installed raspberrypi in the same way. -
@this Sorry can you explain this: "At first we installed wiringPi from ubuntu pc.
However, I got the error like above and installed raspberrypi in the same way."Do you mean you built it on the RaspberryPi and copied then to your Ubuntu PC?
You should build it on your Ubuntu machine, but use the cross compilation environment. -
@jsulm Well ... you seem to have misunderstood.
The build is ubuntu -> raspberrypi. (Cross compile)I have been struggling to eliminate the errors that have occurred.
I first installed wiringPi via the terminal from ubuntu pc.
However, I thought that a file not recognized error occurred and there was no file in raspberrypi.
So raspberrypi installed wiringPi through the terminal.
So I installed wiringPi related files in raspberrypi's / usr / local / lib folder.I thought this was the cause of the error.
However, as you know, the error was not resolved and the question was raised
-
@this I know that you're cross compiling.
"However, I thought that a file not recognized error occurred and there was no file in raspberrypi." - for cross compilation it doesn't matter whether the lib is on RaspberryPi or not as you're building on your Ubuntu machine - you need it on your Ubuntu machine.
So, on your Ubuntu machine the lib is this: /usr/local/lib/libwiringPi.so (symbolic link) and /usr/local/lib/libwiringPi.so.2.44 (lib itself), right? -
This post is deleted! -
@jsulm I solved the above error.
LIBS += -L/usr/local/lib-lwiringPi
I made a mistake in the spacing.
However, a new error has occurred.
Is this what I am doing wrong?
I wrote the following in .pro.
INCLUDEPATH + = / usr / local / include
LIBS += -L/usr/local/lib-lwiringPi![alt text]( image url)
![alt text]( image url)
-
@this I got the above error and I deleted wiringPi and reinstalled it.
However, the following error occurs during installation.Is this the problem that caused this error?
//////////////////////////////////////////////////////////////////////////////////////////////////////////
root@smart-HP-Z400-Workstation:~/wiringPi# ./build
wiringPi Build scriptWiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] piHiPri.c
[Compile] wiringShift.c
[Compile] piThread.c
wiringSerial.c: In function ‘serialPutchar’:
wiringSerial.c:158:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (fd, &c, 1) ;
^
wiringSerial.c: In function ‘serialPuts’:
wiringSerial.c:170:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (fd, s, strlen (s)) ;
^
[Compile] softPwm.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softTone.c
wiringPi.c:1247:21: warning: ‘digitalRead8Dummy’ defined but not used [-Wunused-function]
static unsigned int digitalRead8Dummy (UNU struct wiringPiNodeStruct *no
^
wiringPi.c:1248:21: warning: ‘digitalWrite8Dummy’ defined but not used [-Wunused-function]
static void digitalWrite8Dummy (UNU struct wiringPiNodeStruct *no
^
wiringPi.c: In function ‘digitalRead’:
[Compile] mcp23008.c
wiringPi.c:1473:7: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
read (sysFds [pin], &c, 1) ;
^
wiringPi.c: In function ‘digitalWrite’:
wiringPi.c:1535:4: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (sysFds [pin], "0\n", 2) ;
^
wiringPi.c:1537:4: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (sysFds [pin], "1\n", 2) ;
^
wiringPi.c: In function ‘waitForInterrupt’:
wiringPi.c:1837:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
(void)read (fd, &c, 1) ; // Read & clear
^
wiringPi.c: In function ‘wiringPiISR’:
wiringPi.c:1953:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
read (sysFds [bcmGpioPin], &c, 1) ;
^
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3002.c
pcf8591.c: In function ‘myAnalogWrite’:
pcf8591.c:44:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (node->fd, b, 2) ;
^
[Compile] max31855.c
[Compile] mcp3422.c
[Compile] max5322.c
mcp3422.c: In function ‘waitForConversion’:
mcp3422.c:50:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
read (fd, buffer, n) ;
^
[Compile] ads1115.c
[Compile] sn3218.c
[Compile] bmp180.c
[Compile] htu21d.c
[Compile] ds18b20.c
[Compile] rht03.c
[Compile] drcSerial.c
[Compile] drcNet.c
[Compile] pseudoPins.c
[Compile] wpiExtensions.c
pseudoPins.c: In function ‘myAnalogRead’:
pseudoPins.c:50:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
int *ptr = (int *)node->data0 ;
^
pseudoPins.c: In function ‘myAnalogWrite’:
pseudoPins.c:59:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
int *ptr = (int *)node->data0 ;
^
pseudoPins.c: In function ‘pseudoPinsSetup’:
pseudoPins.c:89:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
node->data0 = (unsigned int)ptr ;
^
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] piNes.c
[Compile] lcd.c
[Compile] lcd128x64.c
[Compile] scrollPhat.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]GPIO Utility
[Compile] gpio.c
[Compile] readall.c
[Compile] pins.c
gpio.c: In function ‘doVersion’:
gpio.c:1292:7: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets (name, 80, fd) ;
^
gpio.c: In function ‘doLoad’:
gpio.c:285:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system (cmd) ;
^
gpio.c:291:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system (cmd) ;
^
gpio.c: In function ‘doUnLoad’:
gpio.c:345:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system (cmd) ;
^
gpio.c:351:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system (cmd) ;
^
[Link]
[Install]All Done.
NOTE: To compile programs with wiringPi, you need to add:
-lwiringPi
to your compile line(s) To use the Gertboard, MaxDetect, etc.
code (the devLib), you need to also add:
-lwiringPiDev
to your compile line(s).
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -
@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.