PDA

View Full Version : Problem installing libpng on Intel Mac




gekko513
Jul 4, 2006, 11:17 AM
My goal is to install the GD Graphics library (http://www.boutell.com/gd/), 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 (http://www.zlib.net/). Seemed to work.

Then I downloaded the source for libpng.1.2.12 (http://www.libpng.org/pub/png/libpng.html) 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:
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.



robbieduncan
Jul 4, 2006, 11:41 AM
There are some step-by-step instructions here (http://www.phpmac.com/articles.php?view=134).

I've not tried them mind...

gekko513
Jul 4, 2006, 11:51 AM
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

AlmostThere
Jul 4, 2006, 02:57 PM
Is there any reason for not installing it through fink?

$apt-cache search gd2
gd2 - Graphics generation library
gd2-bin - Executables for gd2 package
gd2-shlibs - Shared libraries for gd2 package

slooksterPSV
Jul 4, 2006, 08:01 PM
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.

rata911
Jul 15, 2006, 07:04 AM
Using the makefile.darwin to run "make test" I get the following error:
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?

gekko513
Jul 15, 2006, 09:01 AM
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?

rata911
Jul 15, 2006, 09:02 PM
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

rata911
Jul 18, 2006, 04:02 PM
Hey gekko, I just succeeded in compiling libpng and thought that I should let you know.
Well, I just bypassed the problem somehow and used libpng-1.2.8 instead which has a config file included. This did the trick.
http://lfthoughts.blogspot.com/2006/03/mac-os-x-rails-imagemagick-without.html

Have a nice day (with GD?) :D

gekko513
Jul 19, 2006, 02:03 AM
Thanks a lot! I wonder if that config file can somehow be ported to be used with the new version.

rata911
Jul 19, 2006, 02:36 AM
Hm, interesting question. Maybe the makefile will work maybe not....who knows? :)

j-b
Jul 27, 2006, 03:01 AM
Are you still interested in a patch for libpng-1.2.12 on MacTel ?

I think I got one.:)

justbn
Aug 4, 2006, 09:39 PM
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

gekko513
Aug 4, 2006, 10:03 PM
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.

justbn
Aug 7, 2006, 02:28 PM
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.

j-b
Aug 10, 2006, 06:56 AM
./configure should work perfectly, but I got a special thing that made it fails on my system.

For the other, here it is.
http://poy.chewa.net/~jb/vlc/libpng-darwin-mactel.patch