Re: grib2c library not linking png and jpeg libraries

From: Tzung-May Fu <cetmfu_at_nyahnyahspammersnyahnyah>
Date: Sat, 10 Jan 2009 01:54:38 +0800 (HKT)

Thank you Mary! That worked beautifully!

may

---- Original message ----
>Date: Fri, 09 Jan 2009 06:40:09 -0700
>From: "Mary Haley" <haley_at_ucar.edu>
>Subject: Re: grib2c library not linking png and
jpeg libraries
>To: "Tzung-May Fu" <cetmfu_at_polyu.edu.hk>
>Cc: ncl-install_at_ucar.edu
>
>Hi May,
>
>I think this was a bug in the ymake system for NCL. You
>need to link in the PNG library if you enable PNG support
>for GRIB2.
>
>To fix this, look at the file $NCARG/config/Project for a
>line that starts with "#define GRIB2lib".
>
>Change this line to be:
>
>#define GRIB2lib -lgrib2c -ljasper -lpng -lz
>
>To test if this fix works, type the following:
>
> cd $NCARG/ni/src/ncl
> make me
> make all install
>
>If this works, then you can finish your NCL/NCAR Graphics
>make with:
>
> cd $NCARG
> make all install >&! make-output-2
>
>I'm using "$NCARG" to represent the top directory of the
>NCL/NCAR Graphics source tree.
>
>I'll add this to our troubleshooting guide.
>
>--Mary
>
>On Fri, 9 Jan 2009 11:11:05 +0800
> "Tzung-May Fu" <cetmfu_at_polyu.edu.hk> wrote:
>> Hi all -
>>
>> I'm trying to build NCL with GRIB2 support. The OS is
>>Ubuntu linux, and I am using Intel C and Fortran
>>compilers.
>>
>> During 'make Everything' for NCL, here's the error
>>message I got:
>>
>> /home/tmfu/testlib/lib/libgrib2c.a(dec_png.o): In
>>function
>> `dec_png':
>> dec_png.c:(.text+0x99): undefined reference to
>> `png_create_read_struct'
>> dec_png.c:(.text+0x11f): undefined reference to
>>`png_set_read_fn'
>> dec_png.c:(.text+0x136): undefined reference to
>>`png_read_png'
>> dec_png.c:(.text+0x149): undefined reference to
>>`png_get_rows'
>> dec_png.c:(.text+0x18a): undefined reference to
>>`png_get_IHDR'
>> dec_png.c:(.text+0x319): undefined reference to
>> `png_destroy_read_struct'
>> dec_png.c:(.text+0x36a): undefined reference to
>> `png_destroy_read_struct'
>> dec_png.c:(.text+0x39d): undefined reference to
>> `png_destroy_read_struct'
>> dec_png.c:(.text+0x3cb): undefined reference to
>> `png_destroy_read_struct'
>> make[4]: *** [ncl] Error 1
>>
>> So I read Rick's reply on this thread:
>> http://www.ncl.ucar.edu/Support/install_archives/2008/0119.html
>>
>> And I checked my libgrib2c.a compilation. Here's the
>>strange part. My makefile seems correct:
>>
>> DEFS=-DUSE_JPEG2000 -DUSE_PNG
>> INC=-I/home/tmfu/testlib/include
>> LDFLAGS=-L/home/tmfu/testlib/lib
>> LIBS=-ljpeg -lpng
>> #CFLAGS= $(INC) $(DEFS) # <----- I also trited
>>this
>> CFLAGS= $(INC) $(DEFS) $(LDFLAGS) $(LIBS)
>>
>> CC=icc
>> LIB=libgrib2c.a
>> ARFLAGS=
>>
>> But the resulting 'libgrib2c.a' is somehow not linking
>>PNG and JPEG libraries correctly. I did an 'nm' on
>>'libgrib2c.a':
>>
>> nm libgrib2c.a | grep png
>>
>> Here's what I got:
>> U pngunpack
>> pngpack.o:
>> U enc_png
>> 0000000000000000 T pngpack
>> pngunpack.o:
>> U dec_png
>> 0000000000000000 T pngunpack
>> dec_png.o:
>> 0000000000000030 T dec_png
>> U png_create_info_struct
>> U png_create_read_struct
>> U png_destroy_read_struct
>> U png_get_IHDR
>> U png_get_io_ptr
>> U png_get_rows
>> U png_read_png
>> U png_set_read_fn
>> U png_sig_cmp
>> enc_png.o:
>> 0000000000000040 T enc_png
>> U png_create_info_struct
>> U png_create_write_struct
>> U png_destroy_write_struct
>> U png_get_io_ptr
>> U png_set_IHDR
>> U png_set_rows
>> U png_set_write_fn
>> U png_write_png
>> U pngpack
>>
>> So it seems that these functions are really NOT defined
>>in 'libgrib2c.a'. I did check to see the same functions
>>are defined in 'libpng.a'.
>>
>> The only clue I can find is during 'make all' for grib2c
>>libraries, the following warning message appeared:
>>
>> icc -c -I/home/tmfu/testlib/include
>>-DUSE_JPEG2000 -DUSE_PNG -L/home/tmfu/testlib/lib
>> -ljpeg -lpng pngunpack.c
>> pngunpack.c(63): warning #167: argument of type
>>"unsigned char *" is
>> incompatible with parameter of type "char *"
>>
iret=(g2int)dec_png(cpack,&width,&height,ctemp);
>> ^
>> pngunpack.c(72): (col. 10) remark: LOOP WAS
>>VECTORIZED.
>>
>> The same problem exists with the JPEG libraries in
>>'libgrib2c.a'. I've tried using gcc instead of icc,
>>different ways of linking the libraries, and even copying
>>all JPEG and PNG libraries and include files to the
>>grib2c code directory. Same result every time.
>>
>> If anybody have any suggestion, I would very much
>>appreciate it! Thanks in advance.
>>
>> Regards,
>> May Fu
>>
>>
>>
>> _______________________________________________
>> ncl-install mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-install
>
-----------------------
Tzung-May Fu
Assistant Professor
Department of Civil and Structural Engineering
The Hong Kong Polytechnic University
Tel: (+852) 2766 4489
Fax: (+852) 2334 6389
Email: May.Fu_at_polyu.edu.hk
Received on Fri Jan 09 2009 - 10:54:38 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 12 2009 - 16:22:00 MST