Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emgi2008 opened this issue Feb 13, 2015 · 5 comments
Open

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

emgi2008 opened this issue Feb 13, 2015 · 5 comments

Comments

@emgi2008
Copy link

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 'uint8_t ' but argument is of type 'int'
example.c:125:9: error: too few arguments to function 'pifacedigital_wait_for_input'
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 _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
root@raspi03:/home/leo/libpifacedigital#

@tompreston
Copy link
Member

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
Copy link
Author

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 [email protected]:

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
#7 (comment)
.

@emgi2008
Copy link
Author

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_for_inputâ
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 [email protected]:

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 [email protected]:

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
#7 (comment)
.

@tompreston
Copy link
Member

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
Copy link
Author

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 [email protected]:

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
#7 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants