Menu ▾ ▴

#781 configure ignores pkg-config's PNG library name when it is `-llibpng16` (MSVC builds of libpng)

v1.0_(example)
closed-fixed
None
5
2026-11-04
2026-11-03
No

Seen with GraphicsMagick 1.3.49, building with configure and MSVC cl through vcpkg (x64-windows).

On MSVC, libpng's CMake build names its import library libpng16.lib (libpng16d.lib in debug), so pkg-config reports:

PNG_LIBS='-L.../lib -llibpng16d'

The loop in configure.ac that takes the library name from PNG_LIBS only matches -lpng*:

for png_libs_arg in $PNG_LIBS ; do
  case $png_libs_arg in
    -lpng*)

-llibpng16d doesn't match, so pnglibs stays at the default list -lpng17 -lpng16 .... png16 then passes the header-only minor-version test (version 16 has no link test), and -lpng16 gets added to LIBS. That library doesn't exist. Every later AC_CHECK_LIB link test fails with LNK1104, so JPEG, FreeType, WebP and TIFF are all reported as "no -- some components failed test", and the final link of libGraphicsMagick fails.

Suggested fix: also accept the lib prefix.

-           -lpng*)
+           -lpng*|-llibpng*)

The later sed expressions handle it already: -llibpng16d gives pnglibbase=libpng16d and libver=16. Linux -lpng16 behaves as before.

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2026-11-04
    • Description has changed:

    Diff:

    
    
    • status: --> open
    • assigned_to: Bob Friesenhahn
    • Group: --> v1.0_(example)
    • Priority: --> 5
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-11-04
    • status: open --> closed-fixed
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-11-04

    Addressed by Mercurial changeset 18233:6715475d25a6. Thanks for the bug report and the help.

     

Log in to post a comment.