Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#939 libgphoto2: Put user CPPFLAGS after (not before) your own

Ryan Schmidt

When building any software using MacPorts, we automatically put -I${prefix}/include into CPPFLAGS (to help that software find other software it might depend on). (Similarly we put -L${prefix}/lib into LDFLAGS.)

The libgphoto2 configure script sets AM_CPPFLAGS to the user-supplied $CPPFLAGS, then appends various -I flags to it for the various build directories.

The problem arises if another version of libgphoto2 is already installed, particularly one whose headers differ from those of the version being built. Because of the user-supplied -I${prefix}/include CPPFLAGS, files in ${prefix}/include get found in preference to files in the build directories, which can cause build failures like this one that was reported to us:

Here is the patch we've been using to fix this:

We recommend making this change in your sources.


    • status: open --> pending-fixed
    • assigned_to: Marcus Meissner
  • I rewrote the logic today and I think it should be fixed now.

    CPPFLAGS is at least evalauted after the other -I statements.

  • the things just work fine for me already, i can build 2.5 libgphoto2 on a system with 2.4 libgphoto2 without issues.

  • ... i have howveer merged a better version of your second patch into svn.

    • status: pending-fixed --> closed-fixed
  • fixed in 2.5.2