libpng icon indicating copy to clipboard operation
libpng copied to clipboard

unable to compile >=1.6.28 on OSX 10.12

Open lifeofguenter opened this issue 7 years ago • 5 comments

cc -dynamiclib \
	 -install_name /usr/local/lib/libpng16.16.dylib \
	 -current_version 16 -compatibility_version 16 \
	 -o libpng16.16.dylib \
	 png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic.o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran.pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o -L/usr/lib -lz
Undefined symbols for architecture x86_64:
  "_inflateValidate", referenced from:
      _png_inflate_claim in pngrutil.pic.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libpng16.16.dylib] Error 1

lifeofguenter avatar Mar 21 '17 19:03 lifeofguenter

This is a known problem, fixed in libpng-1.6.29. It can be exhibited when linking libpng-1.6.28 with zlib-1.2.8f

glennrp avatar Mar 21 '17 20:03 glennrp

I'm still getting this error with libping-1.6.29 and any zlib version above 1.2.8 in OS X 10.12, clang version Apple LLVM version 8.1.0 (clang-802.0.42) With zlib 1.2.8 installed, make completes without errors and make check passes all tests. I think the problem is the ZLIB_VERNUM check in pngrutil.c

If I change line 421 in pngrutil.c from #if ZLIB_VERNUM >= 0x1290 &&
to #if ZLIB_VERNUM < 0x1290 && \

make completes without errors and make check passes all tests with zlib 1.2.9 and 1.2.11 when making libping-1.6.29

selasley avatar Jun 03 '17 22:06 selasley

That backslash is present in my copy of libpng-1.6.29.tar.gz and in pngrutil.c in the libpng16 branch of the github repository. The ">=" is correct, because inflateValidate() was added to zlib at version 1.2.9, and 0x1290 is greater than your 0x128f.

glennrp avatar Jun 03 '17 22:06 glennrp

I started with a fresh download of libpng-1.6.29 and was still getting the "Undefined symbols" error until I exported LDFLAGS="-L/usr/local/lib" before doing ./configure and make. I'd be happy to delete my earlier comment since it contains incorrect information.

selasley avatar Jun 04 '17 04:06 selasley

If I change line 421 in pngrutil.c from
#if ZLIB_VERNUM >= 0x1290 &&
to
#if ZLIB_VERNUM < 0x1290 && \

and from the original report:

Undefined symbols for architecture x86_64:
  "_inflateValidate", referenced from:
      _png_inflate_claim in pngrutil.pic.o

So if ZLIB_VERNUM is = 0x1290 in the original code there is no call to inflateValidate in the libpng source code.

@lifeofguenter: please retest in the latest release of libpng.

jbowler avatar Dec 27 '23 02:12 jbowler