piface / libpifacedigital

A simple C library for controlling PiFace Digital.
GNU General Public License v3.0
16 stars 10 forks source link

Does not compile on 2015-01-03 kernel #7

Open emgi2008 opened 9 years ago

emgi2008 commented 9 years ago

root@raspi03:/home/leo/libpifacedigital# uname -a Linux raspi03 3.12-1-rpi #1 Debian 3.12.9-1+rpi3 (2015-01-03) armv6l GNU/Linux

root@raspi03:/home/leo/libpifacedigital# make example gcc -o example example.c -Isrc/ -L. -lpifacedigital -L../libmcp23s17/ -lmcp23s17 example.c: In function 'main': example.c:125:9: warning: passing argument 1 of 'pifacedigital_wait_for_input' makes pointer from integer without a cast [enabled by default] src/pifacedigital.h:212:5: note: expected 'uint8t ' but argument is of type 'int' example.c:125:9: error: too few arguments to function 'pifacedigital_wait_forinput' src/pifacedigital.h:212:5: note: declared here Makefile:44: recipe for target 'example' failed make: ** [example] Error 1

root@raspi03:/home/leo/libpifacedigital# make pifacedigital gcc -o pifacedigital util/pifacedigital-cmd.c -Isrc/ -I../libmcp23s17/src/ -L. -lpifacedigital -L../libmcp23s17/ -lmcp23s17 -lstderr util/pifacedigital-cmd.c: In function 'main': util/pifacedigital-cmd.c:123:9: warning: passing argument 1 of 'sprintf' from incompatible pointer type [enabled by default] /usr/include/stdio.h:361:12: note: expected 'char * restrict' but argument is of type 'struct _IO_FILE ' util/pifacedigital-cmd.c: In function 'str2reg': util/pifacedigital-cmd.c:153:9: warning: passing argument 1 of 'sprintf' from incompatible pointer type [enabled by default] /usr/include/stdio.h:361:12: note: expected 'char * restrict' but argument is of type 'struct _IOFILE ' /usr/bin/ld: cannot find -lstderr collect2: ld returned 1 exit status Makefile:50: recipe for target 'pifacedigital' failed make: _* [pifacedigital] Error 1 root@raspi03:/home/leo/libpifacedigital#

tompreston commented 9 years ago

Hi, I've cloned and compiled on a fresh Raspbian install on a Pi 2 with the latest kernel. Everything seemed to compile fine:

$ uname -a
Linux raspberrypi 3.18.5-v7+ #225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux
$ git clone https://github.com/piface/libmcp23s17.git
Cloning into 'libmcp23s17'...
remote: Counting objects: 249, done.
remote: Total 249 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (249/249), 250.27 KiB | 220 KiB/s, done.
Resolving deltas: 100% (103/103), done.
$ cd libmcp23s17/
$ make
gcc  -c -Wall -fPIC src/mcp23s17.c -o src/mcp23s17.o
ar rcs libmcp23s17.a src/mcp23s17.o
$ cd ..
$ git clone https://github.com/piface/libpifacedigital.git
Cloning into 'libpifacedigital'...
remote: Counting objects: 279, done.
remote: Total 279 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (279/279), 205.46 KiB, done.
Resolving deltas: 100% (144/144), done.
$ cd libpifacedigital/
$ make
gcc -I../libmcp23s17/src/ -c -Wall -fPIC src/pifacedigital.c -o src/pifacedigital.o
ar rcs libpifacedigital.a src/pifacedigital.o

Try updating to the latest kernel.

emgi2008 commented 9 years ago

Hello and thanks for replying! I have tried to compile on a model B but I am using the exact same kernel version as you. Looking at the output above it seems you are using a slightly different syntax from the example commands in the documentation which I followed. I remember using 'make example' and 'make pifacedigital' as per those instructions.

Will try the above later tonight and let you know.

/emgi

2015-02-16 12:38 GMT+01:00 Thomas Preston notifications@github.com:

Hi, I've cloned and compiled on a fresh Raspbian install on a Pi 2 with the latest kernel. Everything seemed to compile fine:

$ uname -a Linux raspberrypi 3.18.5-v7+ #225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux $ git clone https://github.com/piface/libmcp23s17.git Cloning into 'libmcp23s17'... remote: Counting objects: 249, done. remote: Total 249 (delta 0), reused 0 (delta 0) Receiving objects: 100% (249/249), 250.27 KiB | 220 KiB/s, done. Resolving deltas: 100% (103/103), done. $ cd libmcp23s17/ $ make gcc -c -Wall -fPIC src/mcp23s17.c -o src/mcp23s17.o ar rcs libmcp23s17.a src/mcp23s17.o $ cd .. $ git clone https://github.com/piface/libpifacedigital.git Cloning into 'libpifacedigital'... remote: Counting objects: 279, done. remote: Total 279 (delta 0), reused 0 (delta 0) Receiving objects: 100% (279/279), 205.46 KiB, done. Resolving deltas: 100% (144/144), done. $ cd libpifacedigital/ $ make gcc -I../libmcp23s17/src/ -c -Wall -fPIC src/pifacedigital.c -o src/pifacedigital.o ar rcs libpifacedigital.a src/pifacedigital.o

Try updating to the latest kernel.

— Reply to this email directly or view it on GitHub https://github.com/piface/libpifacedigital/issues/7#issuecomment-74495925 .

emgi2008 commented 9 years ago

Hi,

Just tested it again. Same issue. You are correct that make itself still works but after this step I stil no executable code. The issue occurs in the last two steps: make example & make pifacedigital Here again the output with my kernel version (model B) at the beginning:

pi@raspi03 ~/libpifacedigital $ uname -a Linux raspi03 3.18.5+ #744 PREEMPT Fri Jan 30 18:19:07 GMT 2015 armv6l GNU/Linux

pi@raspi03 ~/libpifacedigital $ make example gcc -o example example.c -Isrc/ -L. -lpifacedigital -L../libmcp23s17/ -lmcp23s17 example.c: In function âmainâ: example.c:125:9: warning: passing argument 1 of âpifacedigital_wait_for_inputâ makes pointer from integer without a cast [enabled by default] src/pifacedigital.h:212:5: note: expected âuint8_t _â but argument is of type âintâ example.c:125:9: error: too few arguments to function âpifacedigital_wait_forinputâ src/pifacedigital.h:212:5: note: declared here Makefile:44: recipe for target 'example' failed make: ** [example] Error 1

pi@raspi03 ~/libpifacedigital $ make pifacedigital gcc -o pifacedigital util/pifacedigital-cmd.c -Isrc/ -I../libmcp23s17/src/ -L. -lpifacedigital -L../libmcp23s17/ -lmcp23s17 -lstderr util/pifacedigital-cmd.c: In function âmainâ: util/pifacedigital-cmd.c:123:9: warning: passing argument 1 of âsprintfâ from incompatible pointer type [enabled by default] /usr/include/stdio.h:361:12: note: expected âchar * restrictâ but argument is of type âstruct _IO_FILE â util/pifacedigital-cmd.c: In function âstr2regâ: util/pifacedigital-cmd.c:153:9: warning: passing argument 1 of âsprintfâ from incompatible pointer type [enabled by default] /usr/include/stdio.h:361:12: note: expected âchar * restrictâ but argument is of type âstruct _IO_FILE _â /usr/bin/ld: cannot find -lstderr collect2: ld returned 1 exit status Makefile:50: recipe for target 'pifacedigital' failed make: _* [pifacedigital] Error 1

pi@raspi03 ~/libpifacedigital $

2015-02-16 19:24 GMT+01:00 Leo Gijssel emgi2008@gmail.com:

Hello and thanks for replying! I have tried to compile on a model B but I am using the exact same kernel version as you. Looking at the output above it seems you are using a slightly different syntax from the example commands in the documentation which I followed. I remember using 'make example' and 'make pifacedigital' as per those instructions.

Will try the above later tonight and let you know.

/emgi

2015-02-16 12:38 GMT+01:00 Thomas Preston notifications@github.com:

Hi, I've cloned and compiled on a fresh Raspbian install on a Pi 2 with the latest kernel. Everything seemed to compile fine:

$ uname -a Linux raspberrypi 3.18.5-v7+ #225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux $ git clone https://github.com/piface/libmcp23s17.git Cloning into 'libmcp23s17'... remote: Counting objects: 249, done. remote: Total 249 (delta 0), reused 0 (delta 0) Receiving objects: 100% (249/249), 250.27 KiB | 220 KiB/s, done. Resolving deltas: 100% (103/103), done. $ cd libmcp23s17/ $ make gcc -c -Wall -fPIC src/mcp23s17.c -o src/mcp23s17.o ar rcs libmcp23s17.a src/mcp23s17.o $ cd .. $ git clone https://github.com/piface/libpifacedigital.git Cloning into 'libpifacedigital'... remote: Counting objects: 279, done. remote: Total 279 (delta 0), reused 0 (delta 0) Receiving objects: 100% (279/279), 205.46 KiB, done. Resolving deltas: 100% (144/144), done. $ cd libpifacedigital/ $ make gcc -I../libmcp23s17/src/ -c -Wall -fPIC src/pifacedigital.c -o src/pifacedigital.o ar rcs libpifacedigital.a src/pifacedigital.o

Try updating to the latest kernel.

— Reply to this email directly or view it on GitHub https://github.com/piface/libpifacedigital/issues/7#issuecomment-74495925 .

tompreston commented 9 years ago

Hi, so far I've managed to get it to compile if I put a uint8_t * cast just before the first argument of the interrupt handler but it appears to be falling right through the wait function and timing out straight away. I'll have to investigate further another time.

Compiles if I change:

interrupt_ret = pifacedigital_wait_for_input(&inputs, 5, hw_addr);

to:

interrupt_ret = pifacedigital_wait_for_input((uint8_t *)&inputs, 5, hw_addr);
emgi2008 commented 9 years ago

Hi Thomas,

I'd like to bear with you but I was unable to locate the section above in the files from github. Can you tell me where (which file) these changes need to be made?

/Leo

2015-02-17 16:26 GMT+01:00 Thomas Preston notifications@github.com:

Hi, so far I've managed to get it to compile if I put a uint8_t * cast just before the first argument of the interrupt handler but it appears to be falling right through the wait function and timing out straight away. I'll have to investigate further another time.

Compiles if I change:

interrupt_ret = pifacedigital_wait_for_input(&inputs, 5, hw_addr);

to:

interrupt_ret = pifacedigital_wait_for_input((uint8_t *)&inputs, 5, hw_addr);

— Reply to this email directly or view it on GitHub https://github.com/piface/libpifacedigital/issues/7#issuecomment-74685300 .