Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gekko513

macrumors 603
Original poster
Oct 16, 2003
6,301
1
My goal is to install the GD Graphics library, and to get png support I must install libpng. I thought Mac OS X already had libpng installed, but gd doesn't seem to agree, so I'm trying to install libpng from the source code.

Libpng requires zlib, so I've downloaded, (./configure, make, make install) zlib-1.2.3. Seemed to work.

Then I downloaded the source for libpng.1.2.12 and I'm trying to install it.

The libpng install procedure doesn't follow "normal unix standard". I have to find my own makefile and put the already built zlib in a neighbour directory because it won't detect that zlib is installed in /usr/local/lib and /usr/local/include.

Using the makefile.darwin to run "make test" I get the following error:
Code:
cc -dynamiclib \
 -install_name /usr/local/lib/libpng12.0.dylib \
 -current_version 0.1.2.12 -compatibility_version 0.1.2.12 \
 -o libpng12.0.1.2.12.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../zlib -lz
ld: Undefined symbols:
_png_mmx_support
_png_combine_row
_png_do_read_interlace
_png_read_filter_row
/usr/bin/libtool: internal link edit command failed
make: *** [libpng12.0.1.2.12.dylib] Error 1

Any thoughts? I've also tried the generic makefile.gcc without success.

Strangely, /usr/local/include now holds four png related files (libpng libpng12 png.h pngconf.h); I don't know if they've always been there. I did a make install just for the heck of it, but it reported the same error.
 
Thanks, robbieduncan, but my problem remains unsolved.

The following change had already been made in the newer version of the libpng source:
Then do a search (Control-W) for

LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -current_version $(PNGVER)

change this to:

LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz

... and I did this, but I had already fixed that "problem" by putting zlib in a neighbour directory:
The previous command opens Makefile in Pico, which is a UNIX command line text editor. In Pico we must make a few changes. The first involves changing the commenting (the # signs) on the following:

# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
 
Here's how I compile everything I need: --some packages 65% at least - come with a configure file and a config.sub file. Also some come with an autogen.sh that will do everything for you. Here's how to totally do it in terminal:

cd /directory/to/the/libpng/extracted/folder
sudo ./configure
sudo make
sudo make install

If it says: cannot find such and such library, go get it.
 
gekko513 said:
Using the makefile.darwin to run "make test" I get the following error:
Code:
cc -dynamiclib \
 -install_name /usr/local/lib/libpng12.0.dylib \
 -current_version 0.1.2.12 -compatibility_version 0.1.2.12 \
 -o libpng12.0.1.2.12.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../zlib -lz
ld: Undefined symbols:
_png_mmx_support
_png_combine_row
_png_do_read_interlace
_png_read_filter_row
/usr/bin/libtool: internal link edit command failed
make: *** [libpng12.0.1.2.12.dylib] Error 1

Any thoughts? I've also tried the generic makefile.gcc without success.

Strangely, /usr/local/include now holds four png related files (libpng libpng12 png.h pngconf.h); I don't know if they've always been there. I did a make install just for the heck of it, but it reported the same error.

I got the same results (Intel MBP), playing around with the Makefile didn't produce any different results. Did you succeed in building libpng yet?
 
No, I gave up. I don't really need it. I was just going to experiment with a little something. Have you tried the fink version suggestion by AlmostThere?
 
Have you tried the fink version suggestion by AlmostThere?

Uh, no.
The PHP package that is released by the Entropy guys has built-in GD support so there MUST be some way of getting that bugger compiled. Maybe us two are just too dumb for that? :D
 
Thanks a lot! I wonder if that config file can somehow be ported to be used with the new version.
 
Are you still interested in a patch for libpng-1.2.12 on MacTel ?

I think I got one.:)
 
Problem installing libpng on Intel Mac Reply to Thread

j-b,

Do you have any information on how to compile libpng on an Intel Mac? I've been searching and readling like crazy. I've seen many people with this problem. However, I haven't seen any answers.

justbn
 
j-b said:
Are you still interested in a patch for libpng-1.2.12 on MacTel ?

I think I got one.:)
I have kind of moved on to different hunting grounds, but I'm sure the project that maintains libpng would appreciate and include the patch in their main trunk. That way we'd all benefit.
 
I've finally managed to resolve this. The issue I had is due to the fact I had downloaded the "no-configure" version of libpng. I don't think there is any way to get this version to work on an Intel Mac.

From the libpng.org website, there is no link to the "coonfigurable" version. To access it, go to : http://prdownloads.sourceforge.net/libpng/libpng-1.2.12.tar.gz.

Then simply :
./configure [--prefix=$HOME] (I used --prefix=/usr/local )
make check
make install

It installs perfectly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.