OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.9k stars 2.55k forks source link

Error opening PNG on Ubuntu 18.04 #1122

Closed savelovrk7 closed 4 years ago

savelovrk7 commented 5 years ago

Expected behavior and actual behavior.

Expected behaviour: opening png-file. Actual behaviour: error: ERROR 1: libpng: bad parameters to zlib ERROR 1: /tmp/some.png, band 3: IReadBlock failed at X offset 0, Y offset 95 ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 95

Steps to reproduce the problem.

Open png-file with GDAL API.

Operating system

Ubuntu 18.04 64 bit

GDAL version and provenance

Built manually from current master branch

rouault commented 5 years ago

How did you build GDAL: with internal or external libpng ? Can you provide the end of the ./configure report where it reports all detected elements

destromark commented 5 years ago

building gdal with external libpng version: 1.6.34-1ubuntu0.18.04.1 end of ./configure report:

GDAL is now configured for x86_64-pc-linux-gnu

  Installation directory:    /usr/local
  C compiler:                gcc -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2
  C++ compiler:              g++ -std=c++11 -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2
  C++14 support:             no

  LIBTOOL support:           yes

  LIBZ support:              external
  LIBLZMA support:           no
  ZSTD support:              no
  cryptopp support:          no
  crypto/openssl support:    no
  GRASS support:             no
  CFITSIO support:           no
  PCRaster support:          internal
  LIBPNG support:            external
  DDS support:               no
  GTA support:               no
  LIBTIFF support:           internal (BigTIFF=yes)
  LIBGEOTIFF support:        internal
  LIBJPEG support:           external
  12 bit JPEG:               no
  12 bit JPEG-in-TIFF:       no
  LIBGIF support:            no
  JPEG-Lossless/CharLS:      no
  OGDI support:              no
  HDF4 support:              no
  HDF5 support:              no
  Kea support:               no
  NetCDF support:            no
  Kakadu support:            no
  JasPer support:            no
  OpenJPEG support:          no
  ECW support:               no
  MrSID support:             no
  MrSID/MG4 Lidar support:   no
  JP2Lura support:           no
  MSG support:               no
  GRIB support:              yes
  EPSILON support:           no
  WebP support:              no
  cURL support (wms/wcs/...):no
  PostgreSQL support:        no
  MRF support:               yes
  MySQL support:             no
  Ingres support:            no
  Xerces-C support:          no
  NAS support:               no
  Expat support:             no
  libxml2 support:           no
  Google libkml support:     no
  ODBC support:              no
  PGeo support:              no
  FGDB support:              no
  MDB support:               no
  PCIDSK support:            internal
  OCI support:               no
  GEORASTER support:         no
  SDE support:               no
  Rasdaman support:          no
  DODS support:              no
  SQLite support:            no
  PCRE support:              no
  SpatiaLite support:        no
  RasterLite2 support:       no
  Teigha (DWG and DGNv8):    no
  INFORMIX DataBlade support:no
  GEOS support:              no
  SFCGAL support:            no
  QHull support:             internal
  Poppler support:           no
  Podofo support:            no
  PDFium support:            no
  OpenCL support:            no
  Armadillo support:         no
  FreeXL support:            no
  SOSI support:              no
  MongoDB support:           no

  SWIG Bindings:             no

  Statically link PROJ:      no
  enable GNM building:       yes
  enable pthread support:    yes
  enable POSIX iconv support:yes
  hide internal symbols:     no 
rouault commented 5 years ago

The ubuntu18_04 configuration in Travis-CI does also have "LIBPNG support: external" with libpng 1.6.34 and the tests pass fine. So I suspect this is something to do with your build (or potentially the particular png you use). In case you try different ./configure options, make sure you 'make clean' before make

urmyfaith commented 4 years ago

@rouault why the internal libpng version is still in 1.2.x ? But the latest libpng has been up to 1.6.x .

urmyfaith commented 4 years ago

@savelovrk7 Rebuild gdal and try add --with-png=internal

cd gdla-x.x.x
./configure --with-png=internal  
urmyfaith commented 4 years ago

@rouault how to replace libpng to 1.6.x?

mloskot commented 4 years ago

@urmyfaith ./configure --help and learn the option to specify external libpng

https://github.com/OSGeo/gdal/blob/cdd564dc5d8bafca721029ff0fd1f7f68e69c3c3/gdal/configure.ac#L1795

urmyfaith commented 4 years ago

@mloskot I will try to build GDAL 2.4.3 with libpng 1.6.x hope it works.

urmyfaith commented 4 years ago

@mloskot seems works.

I am intergrating opencv and GADL into an iOS app.

Opecv is installed by pod, and GDAL is build into .a file by hand.

Bcz opencv and GDAL both use libpng. But different version of libpng lead to a crash.

Finally I fixed it by rebuild GDAL with the same libpng version which opencv used.

Thanks.

jratike80 commented 4 years ago

I understood that you solved your problem, there was no bug in GDAL, and this ticket can be closed. Is that right?