mozjpeg icon indicating copy to clipboard operation
mozjpeg copied to clipboard

MozJPEG can't read the image (PNG support is disabled in this build) - 20191129

Open grantmucha opened this issue 4 years ago • 7 comments

Ubuntu 19.10 mozjpeg version 4.0.0 (build 20191129)

MozJPEG can't read the image (PNG support is disabled in this build)

  • state current version in error message
  • which builds support PNG

If this is not supported at all, update error message.

grantmucha avatar Dec 07 '19 20:12 grantmucha

PNG reading is supported only if:

  • your copy of MozJPEG has been built with PNG support ON
  • and libpng was installed on the machine where MozJPEG was built

If you already have a binary/existing MozJPEG installation, there's no way to enable PNG support. You must uninstall it, and build a new one from scratch.

kornelski avatar Dec 07 '19 21:12 kornelski

This is fine, any build docs on this? I see no mention of png in BUILDING.md.

grantmucha avatar Dec 07 '19 22:12 grantmucha

cmake has PNG_SUPPORTED option. I think it's -DPNG_SUPPORTED=ON.

kornelski avatar Dec 08 '19 00:12 kornelski

this png question keeps coming up (https://github.com/mozilla/mozjpeg/issues/337)

out of curiosity, what's the necessity specifically for libpng?

yours: https://github.com/kornelski/lodepng-rust or: https://github.com/image-rs/image-png

are these not good alternatives that can simply be compiled into MozJPEG? png handling is such a common requirement, it feels like any flag should be for excluding png support, rather than including it.

leeoniya avatar Jan 23 '20 20:01 leeoniya

The flag is default ON on master.

There's no particular reason to use libpng, other than it's "standard". Linux distributions prefer unbundling of dependencies, and they will have libpng, but not lodepng as a standalone dynamic library.

libpng is used only by C demo tools. If you're using Rust, then nothing stops you from combining lodepng and mozjpeg crates.

kornelski avatar Jan 23 '20 23:01 kornelski

PNG_SUPPORTED flag is not used in sharedlib/CMakeLists.txt at all.

So only static version of mozjpeg supportes PNG. Use *-static for PNG support for now.

dofuuz avatar Sep 20 '20 09:09 dofuuz

I am trying to build the project on x64 platform:

$ uname -a
Linux debian 5.8.7-1-amd64 #1 SMP x86_64 GNU/Linux

$ CFLAGS=-m32 LDFLAGS=-m32 cmake -G"Unix Makefiles" .
CMake Error at CMakeLists.txt:7 (project):
  Generator

    Unix Makefiles

  does not support platform specification, but platform

    x32

  was specified.

Also there is a difference in how build procedure is described in BUILDING.md

    cd {build_directory}
    cmake -G"Unix Makefiles" [additional CMake flags] {source_directory}
    make

### 32-bit Build on 64-bit Linux/Unix/Mac
 
Use export/setenv to set the following environment variables before running
CMake:
 
    CFLAGS=-m32
    LDFLAGS=-m32

and BUILDING.txt

Non-Release Source Build (e.g. GitHub clone)
--------------------------------------------
 
  cd {source_directory}
  autoreconf -fiv
  cd {build_directory}
  sh {source_directory}/configure [additional configure flags]
  make

32-bit Build on 64-bit Linux
----------------------------
 
Add
 
  --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
 
to the configure command line.

I believe that BUILDING.txt is outdated... shouldn't it be removed then?

Any help is appreciated.

dmak avatar Sep 22 '20 16:09 dmak