[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cross-compiling gphoto2-2.1.4
> From: <Nathan.Smith@xxxxxxx.gov>
> Date: Mon, 16 Aug 2004 12:12:44 -0400
> I've been out in the field for a week and haven't had a chance to
> resolve issues compiling gphoto2. I was able to compile libgphoto2 with
> help from the mailing list. If anyone else wants to do this in the
> future, I wrote this script:
> export PATH=/usr/local/cris/cris-axis-linux-gnu/bin:$PATH
That line is wrong. This should be:
If you need it as you wrote it, the libgphoto configure is
broken with regards to cross-compilation. I suggest checking
with its maintainers.
> echo $PATH
> ./configure --host=cris-axis-linux-gnu --without-exif
> Then did 'make'. The libraries were located in
> ~/libgphoto2-2.1.4/libgphoto2/.libs and
> ~/libgphoto2-2.1.4/libgphoto2_port/libgphoto2_port/.libs .
> I copied the everything and the symlinks to
> /usr/local/cris/cris-axis-linux-gnu/lib .
Copying and symlinking seems a bit overwhelming. Can't gphoto2
locate a libgphoto built in a sibling directory? Doesn't
"configure --prefix=/some/dir" and "make install" move it to
/some/dir for you?
> Now I'm trying to cross-compile gphoto2. I have another script that I
> run just like for cross-compiling libgphoto2:
> #export PATH=/usr/local/cris/cris-axis-linux-gnu/bin:$PATH
> export PATH=/usr/local/cris/bin/:$PATH
That PATH looks better. ;-)
> echo $PATH
> ./configure --host=cris-axis-linux-gnu --without-exif \
> --libdir=/usr/local/cris/cris-axis-linux-gnu/lib \
> --without-pkgconfig \
I assume by --libdir=/usr/local/cris/cris-axis-linux-gnu/lib you
mean to point out the library directory where you installed
libgphoto2, so it'd be /some/dir/lib with my --prefix
suggestion. That --includedir looks unnecessary. It's a system
include directory so you should never need to specify it
manually. What breaks when you leave it out?
> This completes fine, with output saying the compiler is
> 'cris-axis-linux-gnu-gcc'. However, 'make' then fails:
> if cris-axis-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I..
> -DGPHOTO2_LOCALEDIR=\""/usr/local/share/locale"\" -I.. -I../intl
> -I../gphoto2 -I/usr/include/gphoto2 -g -O2 -g -Wall
> -Wmissing-declarations -Wmissing-prototypes -MT options.o -MD -MP -MF
> ".deps/options.Tpo" \
> -c -o options.o `test -f 'options.c' || echo './'`options.c; \
> then mv -f ".deps/options.Tpo" ".deps/options.Po"; \
> else rm -f ".deps/options.Tpo"; exit 1; \
> In file included from actions.h:27,
> from options.c:22:
> gp-params.h:24:36: gphoto2/gphoto2-camera.h: No such file or directory
> gp-params.h:25:44: gphoto2/gphoto2-abilities-list.h: No such file or
> gp-params.h:26:37: gphoto2/gphoto2-context.h: No such file or directory
> make: *** [options.o] Error 1
> Inside of gp-params.h is:
> #include <gphoto2/gphoto2-camera.h>
> #include <gphoto2/gphoto2-abilities-list.h>
> #include <gphoto2/gphoto2-context.h>
> The "-I/usr/include/gphoto2" should pick up those 3 files,
Only if the complete path is "/usr/include/gphoto2/gphoto2/gphoto2-camera.h"
(note the gphoto2/gphoto2) as you noticed. I suggest you
install the headers elsewhere, using --prefix as I suggest
> actions.c:799:1: directives may not be used inside a macro argument
> actions.c:798:24: unterminated argument list invoking macro "printf"
> actions.c: In function `print_version_action':
> actions.c:802: parse error before string constant
> make: *** [actions.o] Error 1
> Relevant lines from actions.c:
> #ifdef OS2 //line 799
> _("OS/2 port by Bart van Leeuwen\n")
> #endif //line 803
> Obviously I'm not doing something right.
This time, it's the code that's wrong. Really. It seems nobody
compiled that version with a recent GCC, which makes me ask: Are
you using a recent version of gphoto2?
> With all that I've described
> above maybe someone knows what's going on or something I can try? This
> e-mail will also help me keep track of what I've done.
As the error message says, you can't have preprocessor
directives in a macro expansion. printf is a preprocessor macro
Change that printf from this form:
to this form:
or preferably for readability, this form:
#define baz xyzzy
#define baz plugh
Or simply, just change printf to (printf).
Don't forget to send a patch to the maintainers of gphoto2.