PDA

View Full Version : Problems with libpng dependency




VTGuitarMan
May 14, 2008, 04:18 PM
Hi all,

I'm trying to install a data analysis program called Matpack on my MacBook (running 10.5.2 Leopard). I've successfully installed it on both Fedora and Ubuntu Linux systems in the lab, but I'd like it on my laptop, too. The process was cake on the Linux boxes, just type 'make' and everything flies. When I do the same on my MacBook, the 'make' step fails with the following:

Undefined symbols:
"_png_mmx_support", referenced from:
_png_init_mmx_flags in matpack.a(png.o)
"_png_read_filter_row", referenced from:
_png_read_row in matpack.a(pngread.o)
"_png_do_read_interlace", referenced from:
_png_read_row in matpack.a(pngread.o)
"_png_combine_row", referenced from:
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [../../bin/elements] Error 1
make[2]: *** [ALL] Error 2
make[1]: *** [thetools] Error 2
make: *** [allstatic] Error 2


I've searched quite a bit online and found that everyone's solution to this problem was to either install libpng from source or to install it via Fink. I've done both, but neither has worked. I currently have the Fink-installed libpng3 (version 1.2.29-1) installed. I was hoping that the newest available version would do the trick for me. No dice.

Any ideas? Thanks in advance for your attention.



Cromulent
May 14, 2008, 04:26 PM
Are your paths setup correctly?

VTGuitarMan
May 14, 2008, 07:04 PM
By default, Fink installed libpng in /usr/local/lib, and I have tried the 'make' stage with no special settings and with

export LDFLAGS=-L/usr/local/lib

to see if that was necessary to find the libraries. Is there anything else I should set in terms of PATHs or compiler options?

Thanks for the reply!

yeroen
May 14, 2008, 08:45 PM
You'll have to pass the link flag

-lpng

on the compile line or in the makefile wherever the linker options are listed.

VTGuitarMan
May 14, 2008, 09:31 PM
You'll have to pass the link flag

-lpng

on the compile line or in the makefile wherever the linker options are listed.

Thanks, that gives me a little progress. Adding -lpng within the Makefile gets rid of the _png_mmx_support problem, but these still remain:

Undefined symbols:
"_png_read_filter_row", referenced from:
_png_read_row in matpack.a(pngread.o)
"_png_do_read_interlace", referenced from:
_png_read_row in matpack.a(pngread.o)
"_png_combine_row", referenced from:
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
_png_read_row in matpack.a(pngread.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [../../bin/elements] Error 1
make[2]: *** [ALL] Error 2
make[1]: *** [thetools] Error 2
make: *** [allstatic] Error 2


Thanks again for your attention and suggestions.

antibact1
May 14, 2008, 10:19 PM
Try this:

CPPFLAGS="-DPNG_NO_MMX_CODE" make

VTGuitarMan
May 15, 2008, 07:03 AM
Try this:

CPPFLAGS="-DPNG_NO_MMX_CODE" make

Thank you! That did the trick! I used the original Makefile (no -lpng option) in conjunction with your advice and it's up and running.

alastor
Jun 18, 2008, 05:43 AM
Edit:

I'm so sorrry that I have to "reanimate" an 1-month-old topic, but I have the same problem and I'm a total newbie with MacOsX(fresh switcher..)
I got the latest MacBook pro with macosx 10.5.2, fully updated.
I did:
1) downloaded the Matpack c++
2) installed Libpng from http://ethan.tira-thompson.com/Mac%20OS%20X%20Ports.html
using the command
CPPFLAGS="-DPNG_NO_MMX_CODE" make
I obtain the static Library matpack.a . How can it be used in Eclipse?


I want a dynamic library, accordingly to the installation guide


2b) If you want to install Matpack as a shared library then
- login as root
- unpack the library in /opt (or move the directory matpack to /opt/matpack)
- call "make install" in /opt/matpack.
The shared library "libmatpack.so.1.9.0" is created in the "matpack" directory
and then automatically moved to /usr/lib (two links "libmatpack.so.1" and
"libmatpack.so" are also created in /usr/lib).
- Before compiling the tools and the demos you have to replace the line
LINKLIBS= ${MATLIB} ${BLASLIB} -L/usr/X11/lib -lXpm -lX11 -lm
in file "Makefile.common" by
LINKLIBS= ${BLASLIB} -L/usr/X11/lib -lXpm -lX11 -lmatpack -lm
to link all applications versus the shared library (-lmatpack)
- call "make tools"
- Each user must set the environment variable MATPACK to /opt/matpack
and add /opt/matpack/bin to the PATH variable (the best place is the
the shell startup script .bashrc or .cshrc).



I followed the steps but I obtain such error:

=====================================================================
sucessfully created shared library libmatpack.so.1.9.0
=====================================================================
=====================================================================
Install shared library in /usr/lib (you must be root)
=====================================================================
mv libmatpack.so.1.9.0 /usr/lib
mv: rename libmatpack.so.1.9.0 to /usr/lib/libmatpack.so.1.9.0: No such file or directory
make: *** [install] Error 1

Thanks a lot,
Enzo

VTGuitarMan
Jun 19, 2008, 06:35 AM
I tried using the libpng from the site you mentioned at one point, and it failed. Use the libpng3 version that you can install from Fink/FinkCommander. Then things should work alright.

alastor
Jun 19, 2008, 10:04 AM
I tried using the libpng from the site you mentioned at one point, and it failed. Use the libpng3 version that you can install from Fink/FinkCommander. Then things should work alright.
I was able to compile the static library.. How can it be used in Eclipse? I'm new to that IDE.
Any Idea how to solve the problem about the dynamic one?
thank you.
Enzo

VTGuitarMan
Jun 19, 2008, 10:30 AM
I was able to compile the static library.. How can it be used in Eclipse? I'm new to that IDE.
Any Idea how to solve the problem about the dynamic one?
thank you.
Enzo

My suggestion was in reference to solving the dynamic library problem. I have no idea how to use Eclipse, and if you want help with that, you'll probably have to start a new thread to that effect, or search in the Eclipse documentation.

alastor
Jun 19, 2008, 11:26 AM
I've installed Fink and Libpng.. Still not working!
=====================================================================
sucessfully created shared library libmatpack.so.1.9.0
=====================================================================
=====================================================================
Install shared library in /usr/lib (you must be root)
=====================================================================
mv libmatpack.so.1.9.0 /usr/lib
mv: rename libmatpack.so.1.9.0 to /usr/lib/libmatpack.so.1.9.0: No such file or directory
make: *** [install] Error 1
localhost:matpack root#

hankyou anyway for the help!

VTGuitarMan
Jun 19, 2008, 11:28 AM
I've installed Fink and Libpng.. Still not working!
=====================================================================
sucessfully created shared library libmatpack.so.1.9.0
=====================================================================
=====================================================================
Install shared library in /usr/lib (you must be root)
=====================================================================
mv libmatpack.so.1.9.0 /usr/lib
mv: rename libmatpack.so.1.9.0 to /usr/lib/libmatpack.so.1.9.0: No such file or directory
make: *** [install] Error 1
localhost:matpack root#

hankyou anyway for the help!

Out of curiosity, what are the errors that show up before the erroneous claim that the library was successfully created? Are you sure this problem is even linked to libpng? Are the error messages you are seeing the same as the ones I saw and posted above?

alastor
Jun 19, 2008, 01:47 PM
Out of curiosity, what are the errors that show up before the erroneous claim that the library was successfully created? Are you sure this problem is even linked to libpng? Are the error messages you are seeing the same as the ones I saw and posted above?

In the origin I had the some errors you had, but I managed to solve it, leading to the creation of a static library.
I edited my previous post since I had already bumped an old topic, and for a matter of forum orderliness I didn't create a new topic.

Actually, I think is not (or at least no more ) related to the Libpng problem, but since I'm a newbye I try everything!

thanks a lot
Enzo