ninjablocks / 433Utils

433Kit is a collection of code and documentation designed to assist you in the connection and usage of RF 433MHz transmit and receive modules to/with your Arduino and Rapberry Pi.
ninjablocks.com
MIT License
893 stars 336 forks source link

Compiler Error #44

Open behollan opened 6 years ago

behollan commented 6 years ago

Hi, I can't seem to get this project to compile with make. I have wiringPi installed and working correctly and have pulled a fresh version of 433Utils making sure to use the --recursive option. I get the following errors when running make:

/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `crypt'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `pthread_join'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `pthread_create'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `shm_open'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'send' failed
make: *** [send] Error 1

I can fix some of these errors by changing the make such that: https://github.com/ninjablocks/433Utils/blob/b858d9bc6b555439f721a2092051ec531db25135/RPi_utils/Makefile#L3 is now CXXFLAGS=-DRPI -lpthread in which case the error becomes:

/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `crypt'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `shm_open'
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'send' failed
make: *** [send] Error 1

Adding -lcrypt to the make options doesn't seem to get rid of the undefined reference error for crypt. Any suggestions?

ufehembach commented 5 years ago

add -lwiringPi -pthread -lwiringPiDev -lcrypt -lm -lrt

works for me