Menu

#525 CMake png header&lib check not working on Mac

Fixed
nobody
Low
2011-12-18
2011-12-17
Anonymous
No

Originally created by: j...@flygarna.se
Originally owned by: zakalawe@mac.com

*What steps will reproduce the problem?*
1. Build flightgear on a machine with no png development files

*What is the expected output? What do you see instead?*

cmake should complain that png.h is not found during configuration phase. As it is now the missing png-files are caught at compile time.

*Any output in the console (black window)?*

[ 98%] Building CXX object utils/fgpanel/CMakeFiles/fgpanel.dir/FGPNGTextureLoader.cxx.o
/path/to/projects/fg/fg/utils/fgpanel/FGPNGTextureLoader.cxx:30:17: error: png.h: No such file or directory
/path/to/projects/fg/fg/utils/fgpanel/FGPNGTextureLoader.cxx: In member function 'virtual GLuint FGPNGTextureLoader::loadTexture(const std::string&)':
/path/to/projects/fg/fg/utils/fgpanel/FGPNGTextureLoader.cxx:39: error: 'png_byte' was not declared in this scope
... [and much more]

*What FlightGear version are you using (when using GIT version, please
mention date)?*

fresh git, December 17, 2011

*What operating system and graphics card?*

MacOSX Lion (10.7.x)

*Please provide any additional information below or as attachment (Avoid
expiring external links, such as to imageshack/pastebin/...).*

I started to build fg et al. on a fairly fresh non-developer Lion machine, i.e., not too many non-Apple packages were installed. Various missing software was detected during the configuration phases except png. I know libpng is a prerequisite but I wanted to test the build procedure.

cmake should check for png devfiles during flightgear build. Unfortunately I cannot provide a patch since I have not used cmake before. Autotools would be a different story :)

Discussion

  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: bre... (code.google.com)@gmail.com

    Works for me... Only FGPanel has a direct PNG dependency, but FGPanel already has a mandatory PNG library check in its CMake script:
    find_package(PNG REQUIRED)

    I removed PNG libraries on my system, ran CMake and got:
    CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
      Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
    Call Stack (most recent call first):
      /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
      /usr/share/cmake/Modules/FindPNG.cmake:59 (find_package_handle_standard_args)
      utils/fgpanel/CMakeLists.txt:2 (find_package)

    Installed the png library again, but not the header files, and I got:
    CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
      Could NOT find PNG (missing: PNG_PNG_INCLUDE_DIR)

    So, the PNG checks for lib + includes are working fine. CMake reports and complains about missing dependencies. Maybe the Makefiles were generated and just copied over from another machine - and "CMake" was not run on the new machine?
    Otherwise it's got to be some Mac-specific issue with CMake's "FindPNG.cmake" module (CCing "Mac Zak").

    Summary: CMake png header&lib check not working on Mac
    Labels: Mac CMake Priority-Low

     
  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: j...@flygarna.se

    I did _not_ copy any files from another machine. Everything was pristine from the different fg related repos. I'll try to figure out what happens on my machine.

    It is raining outside, my real world flight is cancelled, so I suppose it is a good day to take my first steps into cmake configuration land.

     
  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: bre... (code.google.com)@gmail.com

    One thing that was indeed missing though: FGPanel didn't consider the PNG-specific include directory as reported by CMake. Fixed by:
    http://www.gitorious.org/fg/flightgear/commit/37453e6b7c4b420929f6224f5845323df17b2fa6

    Depending on where libpng is installed, it could happen that CMake finds the header file (and library), but the compiler still couldn't, since the specific search path wasn't set. Seems this wasn't the case here though...

     
  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: j...@flygarna.se

    Thanks that fixed the problem. And I had the opportunity to learn some cmake features like simple/straightforward delegation of requirement checks to different parts of the project, like in the fgpanel case.

    From my point of view this issue is resolved now.

     
  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: bre... (code.google.com)@gmail.com

    Ok, excellent. Thanks for reporting and testing!

    Status: Fixed

     

Log in to post a comment.

MongoDB Logo MongoDB