Building Gphoto2

I have been dabbling with gphoto2, with hopes of getting it set up to do remote (tethered) control of my Canon 20D camera in order to do microscope photography.

Up until late 2007 this was a necessity for anyone wanting to do this, because the 20D control features were experimental and not available unless a person was to get the latest SVN trunk. As of early 2008, it is still necessary to get the latest SVN and apply patches or modify the code.

At this time (early 2009), my office computer runs Fedora Core 9, which includes gphoto2 2.4.0. This system is pretty out of date. FC10 is available, and gphoto2 2.4.3 is on the gphoto website, do it is definitely pretty silly to try to do things with gphoto2 2.4.0.

Some time ago, I got the SVN checkout set up, so I could run the latest development code (which was essential back then to use the 20D, perhaps less so now.

Also, at some time in the past, I got some supporting libraries:

yum install gphoto2-devel.x86_64
This pulls in:
libexif-devel.x86_64.0.6.16-1.fc8
libusb-devel.x86_64.0.1.12-10.fc8

In January of 2009, I decide to get back on this and start with:

cd /u1/archive/gphoto_svn
svn update

Building libgphoto2

It seems to me, the first thing to try is to build libgphoto2
cd /u1/archive/gphoto_svn
cd libgphoto2
autoreconf --install --symlink
./configure --prefix=/usr/local
The autoreconf business is described in the INSTALL file, which I am using to guide my efforts. It turns out I was missing
libltdl
, which I can get via:
yum install libtool-ltdl-devel
On my system (a dual core AMD64), this installs libtool-ltdl-devel.x86_64
After this, the configure command goes fine, and ends with the following report.
I already have some vintage of libusb, as well as libexif.

Configuration (libgphoto2_port 0.9.0):

  Build
    Source directory:              .
    Compiler:                      gcc
    libltdl includes:              
    libltdl library:               -lltdl
    Use translations:              yes

  Serial ports
    Serial support:                yes
    resmgr locking:                no
    baudboy locking:               yes
    ttylock locking:               no
    lockdev locking:               no

  USB ports
    libusb:                        yes

  Documentation
    build API docs with gtk-doc:   no (not requested)

You may run "make" and "make install" now.

Configuration (libgphoto2 2.4.99.0):

  Build
    Source code location:          .
    GP2DDB support:                no  (EXPERIMENTAL)
    Compiler:                      gcc
    libltdl includes:              
    libltdl library:               -lltdl

  Features
    Use translations:              yes
    JPEG mangling support:         yes
    Camlibs:                       all
    build API docs with gtk-doc:   no (not requested)
    libexif:                       yes

    Subprojects:                   libgphoto2_port

You may run "make" and "make install" now.
Please check whether the configuration I detected matches what you
would like to have. E.g. make sure that USB support is there if you
intend to use USB cameras with libgphoto2 photo camera library.

Please also check that PKG_CONFIG_PATH contains
    ${libdir}/pkgconfig
before compiling any libgphoto2 frontend.
After this, the usual:
make
make install
I am coached with the following note many times:
Libraries have been installed in:
   /usr/local/lib/libgphoto2/2.4.99.0

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

Building gphoto2

With libgphoto2-2.4.99 built and living in /usr/local, the next sensible thing to do would be to build gphoto2.
cd /u1/archive/gphoto_svn
svn update
cd gphoto2
autoreconf -is
./configure --prefix=/usr/local
The configure gets into trouble looking for libgphoto2 version 2.4.99:
checking for libgphoto2 version according to gphoto2-config... 2.4.0
checking if libgphoto2 version is matching requirement >= 2.4.99.0... no
configure: error: Version requirement libgphoto2 >= 2.4.99.0 not met. Found: 2.4.0
It turns out (after some trial and error), that this solves the problem:
./configure --prefix=/usr/local --with-libgphoto2=/usr/local
make
make install
After this, when I run /usr/local/bin/gphoto2 --version, I get:
gphoto2 2.4.99.0

Copyright (c) 2000-2008 Lutz Mueller and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.4.99.0       gcc, popt(m), exif, no cdk, no aa, jpeg, readline
libgphoto2      2.4.99.0       all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.9.0          gcc, ltdl, USB, serial baudboy locking

Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org