danielgtaylor / jpeg-archive

Utilities for archiving JPEGs for long term storage.
1.17k stars 121 forks source link

Error "/opt/mozjpeg/lib/libjpeg.a: No such file or directory" on building jpeg-archive with Mozjpeg v4 #124

Open xfuturomax opened 3 years ago

xfuturomax commented 3 years ago

I've tried to build a docker image on alpine with version 4 of mozjpeg and got an error from subject. This is part of my Dockerfile:

...
ENV MOZJPEG_VERSION=4.0.3 \
    JPEGARCHIVE_VERSION=2.2.0
...
# mozjpeg
    cd /tmp; \
    curl -L -O https://github.com/mozilla/mozjpeg/archive/v$MOZJPEG_VERSION.tar.gz; \
    tar zxf v$MOZJPEG_VERSION.tar.gz; \
    cd mozjpeg-$MOZJPEG_VERSION; \
    mkdir build; \
    cd build; \
    cmake -G"Unix Makefiles" -DWITH_JPEG8=1 -DENABLE_STATIC=FALSE -DPNG_SUPPORTED=TRUE ../; \
    make; \
    make install; \
# jpeg-archive
    cd /tmp; \
    curl -L -O https://github.com/danielgtaylor/jpeg-archive/archive/v$JPEGARCHIVE_VERSION.tar.gz; \
    tar zxf v$JPEGARCHIVE_VERSION.tar.gz; \
    cd jpeg-archive-$JPEGARCHIVE_VERSION; \
    export CFLAGS="-fcommon"; \
    make; \
    make install; \
...

Generally, is it possible to build jpeg-archive with verison 4 of mozjpeg at this moment? I've also tried to build mozjpeg with -DCMAKE_INSTALL_LIBDIR=/opt/mozjpeg/lib/ and ln -s /opt/mozjpeg/lib64/ /opt/mozjpeg/lib; but unsuccessfully.

And jpeg-archive successfully builds with 3.3.1 version of mozjpeg.

zvezdochiot commented 3 years ago

❓ Maybe use jpeg-recompress based on the standard libjpeg: https://github.com/ImageProcessing-ElectronicPublications/jpeg-recompress ?

ThomasLohner commented 2 years ago

@xfuturomax for me this works on ubuntu 20.04. After this the jpeg-recompress binary is transportable because of static build:

apt-get update
apt-get install -y cmake zlib1g-dev libpng-dev git
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
mkdir build && cd build
cmake -G"Unix Makefiles" ../
make
make install
cd /
git clone https://github.com/danielgtaylor/jpeg-archive.git
cd jpeg-archive
LDFLAGS="--static“ make
make install
cd /
git clone https://github.com/kornelski/pngquant.git
apt-get install build-essential git pkg-config libpng-dev
./configure  --extra-ldflags=-static
make