bskari / pi-rc

Turn your Raspberry Pi into a radio controller for RC toys.
GNU General Public License v2.0
139 stars 38 forks source link

Update mailbox.c #29

Closed mzac closed 5 years ago

mzac commented 5 years ago

Added:

#include <sys/sysmacros.h>

I found this issue somewhere else where it was described that:

Glibc removes sys/sysmacros.h which defines makedev from sys/types.h since v2.28. [Commit ID: e16deca62e16f]

And then glibc suggestions us to include <sys/sysmacros.h>`directly if code needs it.

Without this fix running 'make' on newer system fails as such:

root@pi-dx:~/github/pi-rc# make
cc -Wall -Wextra -Wshadow -Wswitch-enum -Wswitch-default -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -DRASPI=2   -c -o pi_pcm.o pi_pcm.c
cc -Wall -Wextra -Wshadow -Wswitch-enum -Wswitch-default -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -DRASPI=2   -c -o mailbox.o mailbox.c
mailbox.c: In function ‘mbox_open’:
mailbox.c:258:52: warning: implicit declaration of function ‘makedev’ [-Wimplicit-function-declaration]
     if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_A, 0)) >= 0 &&
                                                    ^~~~~~~
cc   pi_pcm.o mailbox.o  -lm -o pi_pcm
/usr/bin/ld: mailbox.o: in function `mbox_open':
mailbox.c:(.text+0xc0c): undefined reference to `makedev'
/usr/bin/ld: mailbox.c:(.text+0xc74): undefined reference to `makedev'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: pi_pcm] Error 1
bskari commented 5 years ago

Awesome! Thank you so much for the pull request. I haven't upgraded my OS in a while, so thanks for helping out!