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

Tried to compile on Raspberry PI #2

Closed
fsoustra opened this issue Jun 8, 2014 · 9 comments
Closed

Tried to compile on Raspberry PI #2

fsoustra opened this issue Jun 8, 2014 · 9 comments
Assignees
Labels

Comments

@fsoustra
Copy link

fsoustra commented Jun 8, 2014

Hi Jim,
I love that someone finally is working on a real wrapper for gphoto2 for python.
I tried to compile on a raspberry PI as I am starting a series of time lapse scripts and I got the following, my days of C are a bit behind me so not sure if I am missing a dev or if its something else below is the output of what I ran:

*running build
running build_py
copying source/gphoto2_camera.py -> build/lib.linux-armv6l-2.7/gphoto2
copying source/gphoto2_abilities_list.py -> build/lib.linux-armv6l-2.7/gphoto2
running build_ext
building '_gphoto2_camera' extension
swigging source/gphoto2_camera.i to source/gphoto2_camera_wrap.c
swig -python -I/usr/include -builtin -O -Wall -o source/gphoto2_camera_wrap.c source/gphoto2_camera.i
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/gphoto2_camera_wrap.c -o build/temp.linux-armv6l-2.7/source/gphoto2_camera_wrap.o -O3 -Wno-unused-variable
source/gphoto2_camera_wrap.c: In function ‘_wrap_gp_camera_get_port_info’:
source/gphoto2_camera_wrap.c:5536:5: error: incompatible type for argument 2 of ‘SWIG_Python_NewPointerObj’
source/gphoto2_camera_wrap.c:2547:1: note: expected ‘void ’ but argument is of type ‘GPPortInfo’
error: command 'gcc' failed with exit status 1

Thanks for the help

Cheers

Fred

@jim-easterbrook jim-easterbrook self-assigned this Jun 8, 2014
@jim-easterbrook
Copy link
Owner

I just tried it on my Pi and got the same result. It's got an earlier version of SWIG (2.0.7) than I've been using on my main machine (2.0.10). The problem is in the typemaps for gp_port_info_new(), which I don't think would ever be called from Python, so doesn't really need wrapping. (But who knows what someone might want to do...)
I'll commit a bug fix now.

jim-easterbrook added a commit that referenced this issue Jun 8, 2014
SWIG version 2.0.7 complains about an argument type that SWIG 2.0.10
ignores. See issue #2.
@jim-easterbrook
Copy link
Owner

PS I haven't tested any image capture stuff - you may find things you need are missing or "not properly joined up". Do let me know of any problems you run into.

@fsoustra
Copy link
Author

fsoustra commented Jun 8, 2014

Thanks Jim.
Will do.

@tomriddle1234
Copy link

Thanks Jim, I got the same issue but on ubuntu 12.04 with default swig 2.04 installation.

@fsoustra
Copy link
Author

fsoustra commented Jun 9, 2014

Got this issue arising now:

*gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/lib/gphoto2_camera_wrap.c -o build/temp.linux-armv6l-2.7/source/lib/gphoto2_camera_wrap.o -O3 -Wno-unused-variable
source/lib/gphoto2_camera_wrap.c: In function ‘_wrap_gp_camera_get_port_info’:
source/lib/gphoto2_camera_wrap.c:5536:5: error: incompatible type for argument 2 of ‘SWIG_Python_NewPointerObj’
source/lib/gphoto2_camera_wrap.c:2547:1: note: expected ‘void ’ but argument is of type ‘GPPortInfo’
error: command 'gcc' failed with exit status 1

gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
and
SWIG Version 2.0.7
and python 2.7.3

@jim-easterbrook
Copy link
Owner

Doh! The perils of testing on one machine and committing to GitHub from a different one. I removed the wrong asterisk in commit 9e7f9f2. This is still the same problem. Commit 533eb33 should fix it.

@jim-easterbrook
Copy link
Owner

Unfortunately, although this change allows it to compile with older SWIG versions, it causes a segfault when gp_camera_set_port_info() is called. Some more work needed.

@jim-easterbrook
Copy link
Owner

I think I've found the problem. It's nothing to do with SWIG, it's the version of libgphoto2. The API changed in version 2.5 (see http://www.gphoto.org/news/) - my Pi only has version 2.4.14. I'm surprised I managed to build python-gphoto2 at all. You certainly need version 2.5 to run the example programs.
(The difference responsible for this bug is that in 2.5 GPPortInfo is a pointer to a structure, in 2.4 it's the structure itself. Quite a big difference!)

jim-easterbrook added a commit that referenced this issue Jun 10, 2014
The problem compiling on a Pi is because it has libgphoto2 version 2.4.
The Python interfaces need version 2.5+.
@jim-easterbrook
Copy link
Owner

Commit 9d1f71e allows building with gphoto2 version 2.4 or 2.5. Some of the examples work with version 2.4 as well (tested with my Canon DSLR connected to a Raspberry Pi).

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

No branches or pull requests

3 participants