[cmake-developers] Trouble with FindPNG module

Robert Dailey rcdailey.lists at gmail.com
Mon Apr 24 13:20:27 EDT 2017


On Mon, Apr 24, 2017 at 10:02 AM, Ben Boeckel <ben.boeckel at kitware.com> wrote:
> On Mon, Apr 24, 2017 at 09:54:18 -0500, Robert Dailey wrote:
>> On Fri, Apr 21, 2017 at 4:48 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
>> > I'm running CMake 3.8.0 on Ubuntu 14. I invoke the following:
>> >
>> > find_package(PNG REQUIRED)
>> >
>> > Which gives me the output in CMake:
>> >
>> > Could NOT find PNG (missing: PNG_LIBRARY) (found version "1.2.50")
>> >
>> > The CMakeCache.txt file has these variables set:
>> >
>> > PNG_LIBRARY_DEBUG:FILEPATH=PNG_LIBRARY_DEBUG-NOTFOUND
>> > PNG_LIBRARY_RELEASE:FILEPATH=PNG_LIBRARY_RELEASE-NOTFOUND
>> > PNG_PNG_INCLUDE_DIR:PATH=/usr/include
>> >
>> > So it found the headers, but not the libs. Why did it not find the
>> > libs? Note that my version of Ubuntu is 64-bit, and I've installed the
>> > 32-bit libs like so:
>> >
>> > $ sudo apt-get install libpng12-dev:i386
>
> What compiler are you using (what does CMake say it is?)? Does an
> `strace` of CMake configuring the project show anything interesting?
> `cmake --trace-expand`?

It's using Gcc 4.9 because I told it to via toolchain file:



-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/gcc-4.9
-- Check for working C compiler: /usr/bin/gcc-4.9 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++-4.9
-- Check for working CXX compiler: /usr/bin/g++-4.9 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done



Via the following toolchain file contents:



set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_VERSION 1 )
set( CMAKE_SYSTEM_PROCESSOR "i686" )
set( CMAKE_C_COMPILER gcc-4.9 )
set( CMAKE_CXX_COMPILER g++-4.9 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" )



I'm not sure how to use strace. I tried following instructions I found
on the [CMake Performance Tips][1] page, but this isn't working. My
generate command has a lot of options, so I use a helper shell script
to generate. strace seems to not work well when using a shell script.
Trace also doesn't show much useful. Could you give exact command line
I can run to get the info you need?

Where possible, I install everything via apt-get for the 4.9
toolchain. For libpng this was not an option as far as I could tell,
so I'm not sure what implications that has on find_package() behavior.


More information about the cmake-developers mailing list