Problems with libpng dependency

Discussion in 'Mac Programming' started by VTGuitarMan, May 14, 2008.

  1. VTGuitarMan macrumors newbie

    Joined:
    May 14, 2008
    #1
    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:

    Code:
    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.
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
  3. VTGuitarMan thread starter macrumors newbie

    Joined:
    May 14, 2008
    #3
    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!
     
  4. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #4
    You'll have to pass the link flag

    -lpng

    on the compile line or in the makefile wherever the linker options are listed.
     
  5. VTGuitarMan thread starter macrumors newbie

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

    Code:
    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.
     
  6. antibact1 macrumors 6502

    Joined:
    Jun 1, 2006
  7. VTGuitarMan thread starter macrumors newbie

    Joined:
    May 14, 2008
    #7
    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.
     
  8. alastor macrumors newbie

    Joined:
    Jun 18, 2008
    #8
    Sorry

    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 OS X Ports.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

    Code:
     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:
    Code:
    =====================================================================
    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
     
  9. VTGuitarMan thread starter macrumors newbie

    Joined:
    May 14, 2008
    #9
    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.
     
  10. alastor macrumors newbie

    Joined:
    Jun 18, 2008
    #10
    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
     
  11. VTGuitarMan thread starter macrumors newbie

    Joined:
    May 14, 2008
    #11
    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.
     
  12. alastor macrumors newbie

    Joined:
    Jun 18, 2008
    #12
    I've installed Fink and Libpng.. Still not working!
    Code:
    =====================================================================
    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!
     
  13. VTGuitarMan thread starter macrumors newbie

    Joined:
    May 14, 2008
    #13
    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?
     
  14. alastor macrumors newbie

    Joined:
    Jun 18, 2008
    #14
    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
     

Share This Page