Last active
July 13, 2023 15:11
-
-
Save fabiante/f0225b5a2b7e55ff2b86534ba29c9451 to your computer and use it in GitHub Desktop.
Poppler Build Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits: https://stackoverflow.com/a/74313286/3647782 | |
FROM ubuntu:22.10 as ubuntu-base | |
RUN apt update && apt upgrade -y | |
FROM ubuntu-base as build | |
RUN apt install -y \ | |
wget \ | |
xz-utils \ | |
git | |
# Now go here and look for the latest download link and see what URL it points | |
# to: https://poppler.freedesktop.org/ | |
# Under the "Download" section I see: | |
# | |
# The latest stable release is poppler-22.11.0.tar.xz, released on | |
# November 1, 2022: | |
# | |
# Hovering my mouse over the download link shows it to be the link below. | |
# **Update the link and version in all commands below.** | |
# Download it | |
RUN wget https://poppler.freedesktop.org/poppler-22.11.0.tar.xz | |
RUN # Extract the compressed file and cd into the extracted dir | |
RUN tar -xf poppler-22.11.0.tar.xz | |
WORKDIR poppler-22.11.0 | |
# Build and install it. See the "INSTALL" file in this dir for *some* level of | |
# help. Most of my instructions below are NOT in there :(. | |
RUN mkdir -p build | |
WORKDIR build | |
RUN git clone git://git.freedesktop.org/git/poppler/test | |
# Install the "easy" dependencies first: | |
# I expect these dependencies to install on Ubuntu 20.04 without issue | |
RUN apt install -y \ | |
libfreetype-dev \ | |
libfontconfig-dev \ | |
libboost-dev \ | |
libpng-dev \ | |
zlib1g-dev \ | |
liblcms2-dev \ | |
libcurl4 \ | |
libcurl4-gnutls-dev | |
# Install the "hard" dependencies second: | |
# Try this too, but this may not work for you. If it fails, see below. I expect | |
# these dependencies to NOT install on Ubuntu 20.04 without issue. If they fail | |
# to install, you will use `aptitude` to install the failed ones instead, as I | |
# explain and do below. | |
RUN apt install -y \ | |
libjpeg-dev \ | |
libcairo-dev \ | |
libopenjp2-7-dev \ | |
libtiff-dev \ | |
libcurl4-gnutls-dev \ | |
libnss3-dev | |
# When I run `sudo apt install libjpeg-dev` alone, for instance, I see the | |
# following output errors: | |
# | |
# Reading package lists... Done | |
# Building dependency tree | |
# Reading state information... Done | |
# Some packages could not be installed. This may mean that you have | |
# requested an impossible situation or if you are using the unstable | |
# distribution that some required packages have not yet been created | |
# or been moved out of Incoming. | |
# The following information may help to resolve the situation: | |
# | |
# The following packages have unmet dependencies: | |
# libjpeg-dev : Depends: libjpeg8-dev but it is not going to be installed | |
# E: Unable to correct problems, you have held broken packages. | |
# So, we will use the `aptitude` package installer tool to to solve that. | |
# First, install aptitude. | |
#RUN apt install -y aptitude | |
# Install `libjpeg-dev` via `aptitude`: | |
#RUN aptitude install -y libjpeg-dev | |
# Assuming your output looks the same as mine, and the options it gives you are | |
# the same and in the same order, choose **no** then **yes** to downgrade | |
# `libjpeg-turbo8`, thereby allowing `libjpeg-dev` to install. See the arrows | |
# (<=========================) below which I use to indicate where I make my | |
# selections in the interactive prompts during the installation process via | |
# the 'aptitude' installation tool: | |
# | |
# | |
# $ sudo aptitude install libjpeg-dev | |
# The following NEW packages will be installed: | |
# libjpeg-dev libjpeg-turbo8-dev{ab} libjpeg8-dev{a} | |
# 0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 238 kB/241 kB of archives. After unpacking 1,041 kB will be used. | |
# The following packages have unmet dependencies: | |
# libjpeg-turbo8-dev : Depends: libjpeg-turbo8 (= 2.0.3-0ubuntu1) but 2.0.3-0ubuntu1.20.04.3 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) libjpeg-dev [Not Installed] | |
# 2) libjpeg-turbo8-dev [Not Installed] | |
# 3) libjpeg8-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) libjpeg-turbo8 [2.0.3-0ubuntu1.20.04.3 (now) -> 2.0.3-0ubuntu1 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# libjpeg-turbo8 | |
# The following NEW packages will be installed: | |
# libjpeg-dev libjpeg-turbo8-dev{a} libjpeg8-dev{a} | |
# 0 packages upgraded, 3 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 356 kB/359 kB of archives. After unpacking 1,040 kB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
# Get: 1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libjpeg-turbo8 amd64 2.0.3-0ubuntu1 [118 kB] | |
# Get: 2 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libjpeg-turbo8-dev amd64 2.0.3-0ubuntu1 [238 kB] | |
# Fetched 356 kB in 1s (490 kB/s) | |
# dpkg: warning: downgrading libjpeg-turbo8:amd64 from 2.0.3-0ubuntu1.20.04.3 to 2.0.3-0ubuntu1 | |
# (Reading database ... 474322 files and directories currently installed.) | |
# Preparing to unpack .../libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb ... | |
# Unpacking libjpeg-turbo8:amd64 (2.0.3-0ubuntu1) over (2.0.3-0ubuntu1.20.04.3) ... | |
# Selecting previously unselected package libjpeg-turbo8-dev:amd64. | |
# Preparing to unpack .../libjpeg-turbo8-dev_2.0.3-0ubuntu1_amd64.deb ... | |
# Unpacking libjpeg-turbo8-dev:amd64 (2.0.3-0ubuntu1) ... | |
# Selecting previously unselected package libjpeg8-dev:amd64. | |
# Preparing to unpack .../libjpeg8-dev_8c-2ubuntu8_amd64.deb ... | |
# Unpacking libjpeg8-dev:amd64 (8c-2ubuntu8) ... | |
# Selecting previously unselected package libjpeg-dev:amd64. | |
# Preparing to unpack .../libjpeg-dev_8c-2ubuntu8_amd64.deb ... | |
# Unpacking libjpeg-dev:amd64 (8c-2ubuntu8) ... | |
# Setting up libjpeg-turbo8:amd64 (2.0.3-0ubuntu1) ... | |
# Setting up libjpeg-turbo8-dev:amd64 (2.0.3-0ubuntu1) ... | |
# Setting up libjpeg8-dev:amd64 (8c-2ubuntu8) ... | |
# Setting up libjpeg-dev:amd64 (8c-2ubuntu8) ... | |
# Processing triggers for libc-bin (2.31-0ubuntu9.9) ... | |
# Install `libcairo-dev` the same way and with the same selections: | |
# RUN aptitude install libcairo-dev | |
# | |
# $ sudo aptitude install libcairo-dev | |
# Note: selecting "libcairo2-dev" instead of the virtual package "libcairo-dev" | |
# The following NEW packages will be installed: | |
# libcairo-script-interpreter2{a} libcairo2-dev libice-dev{a} libpixman-1-dev{a} libpthread-stubs0-dev{a} libsm-dev{a} libx11-dev{ab} libxau-dev{a} libxcb-render0-dev{a} libxcb-shm0-dev{a} libxcb1-dev{a} | |
# libxdmcp-dev{a} libxext-dev{a} libxrender-dev{a} x11proto-core-dev{a} x11proto-dev{a} x11proto-xext-dev{a} xorg-sgml-doctools{a} xtrans-dev{a} | |
# 0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 2,569 kB of archives. After unpacking 10.5 MB will be used. | |
# The following packages have unmet dependencies: | |
# libx11-dev : Depends: libx11-6 (= 2:1.6.9-2ubuntu1) but 2:1.6.9-2ubuntu1.2 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) libcairo2-dev [Not Installed] | |
# 2) libx11-dev [Not Installed] | |
# 3) libxext-dev [Not Installed] | |
# 4) libxrender-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) libx11-6 [2:1.6.9-2ubuntu1.2 (now) -> 2:1.6.9-2ubuntu1 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# libx11-6 | |
# The following NEW packages will be installed: | |
# libcairo-script-interpreter2{a} libcairo2-dev libice-dev{a} libpixman-1-dev{a} libpthread-stubs0-dev{a} libsm-dev{a} libx11-dev{a} libxau-dev{a} libxcb-render0-dev{a} libxcb-shm0-dev{a} libxcb1-dev{a} | |
# libxdmcp-dev{a} libxext-dev{a} libxrender-dev{a} x11proto-core-dev{a} x11proto-dev{a} x11proto-xext-dev{a} xorg-sgml-doctools{a} xtrans-dev{a} | |
# 0 packages upgraded, 19 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 3,141 kB of archives. After unpacking 10.5 MB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
# Install `libopenjp2-7-dev` the same way and with the same selections: | |
# RUN aptitude install libopenjp2-7-dev | |
# | |
# $ sudo aptitude install libopenjp2-7-dev | |
# The following NEW packages will be installed: | |
# libopenjp2-7-dev{b} | |
# 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 26.7 kB of archives. After unpacking 168 kB will be used. | |
# The following packages have unmet dependencies: | |
# libopenjp2-7-dev : Depends: libopenjp2-7 (= 2.3.1-1ubuntu4) but 2.3.1-1ubuntu4.20.04.1 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) libopenjp2-7-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) libopenjp2-7 [2.3.1-1ubuntu4.20.04.1 (now) -> 2.3.1-1ubuntu4 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# libopenjp2-7 | |
# The following NEW packages will be installed: | |
# libopenjp2-7-dev | |
# 0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 168 kB of archives. After unpacking 168 kB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
# Install `libtiff-dev` the same way and with the same selections: | |
# RUN aptitude install libtiff-dev | |
# | |
# $ sudo aptitude install libtiff-dev | |
# The following NEW packages will be installed: | |
# libjbig-dev{a} liblzma-dev{ab} libtiff-dev{b} libtiffxx5{a} | |
# 0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 461 kB of archives. After unpacking 1,796 kB will be used. | |
# The following packages have unmet dependencies: | |
# libtiff-dev : Depends: libtiff5 (= 4.1.0+git191117-2build1) but 4.1.0+git191117-2ubuntu0.20.04.3 is installed | |
# liblzma-dev : Depends: liblzma5 (= 5.2.4-1) but 5.2.4-1ubuntu1.1 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) liblzma-dev [Not Installed] | |
# 2) libtiff-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) liblzma5 [5.2.4-1ubuntu1.1 (now) -> 5.2.4-1 (focal)] | |
# 2) libtiff5 [4.1.0+git191117-2ubuntu0.20.04.3 (now) -> 4.1.0+git191117-2build1 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# liblzma5 libtiff5 | |
# The following NEW packages will be installed: | |
# libjbig-dev{a} liblzma-dev{a} libtiff-dev libtiffxx5{a} | |
# 0 packages upgraded, 4 newly installed, 2 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 715 kB of archives. After unpacking 1,788 kB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
# Install `libcurl4-gnutls-dev` the same way and with the same selections: | |
# RUN aptitude install libcurl4-gnutls-dev | |
# | |
# $ sudo aptitude install libcurl4-gnutls-dev | |
# The following NEW packages will be installed: | |
# libcurl4-gnutls-dev{b} | |
# 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 318 kB of archives. After unpacking 1,525 kB will be used. | |
# The following packages have unmet dependencies: | |
# libcurl4-gnutls-dev : Depends: libcurl3-gnutls (= 7.68.0-1ubuntu2) but 7.68.0-1ubuntu2.12 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) libcurl4-gnutls-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) libcurl3-gnutls [7.68.0-1ubuntu2.12 (now) -> 7.68.0-1ubuntu2 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# libcurl3-gnutls | |
# The following NEW packages will be installed: | |
# libcurl4-gnutls-dev | |
# 0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 549 kB of archives. After unpacking 1,524 kB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
# Install `libnss3-dev` the same way and with the same selections: | |
# RUN aptitude install libnss3-dev | |
# | |
# $ sudo aptitude install libnss3-dev | |
# The following NEW packages will be installed: | |
# libnspr4-dev{a} libnss3-dev{b} | |
# 0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded. | |
# Need to get 437 kB of archives. After unpacking 2,611 kB will be used. | |
# The following packages have unmet dependencies: | |
# libnss3-dev : Depends: libnss3 (= 2:3.49.1-1ubuntu1) but 2:3.49.1-1ubuntu1.8 is installed | |
# The following actions will resolve these dependencies: | |
# | |
# Keep the following packages at their current version: | |
# 1) libnss3-dev [Not Installed] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] n <========================= | |
# The following actions will resolve these dependencies: | |
# | |
# Downgrade the following packages: | |
# 1) libnss3 [2:3.49.1-1ubuntu1.8 (now) -> 2:3.49.1-1ubuntu1 (focal)] | |
# | |
# | |
# | |
# Accept this solution? [Y/n/q/?] y <========================= | |
# The following packages will be DOWNGRADED: | |
# libnss3 | |
# The following NEW packages will be installed: | |
# libnspr4-dev{a} libnss3-dev | |
# 0 packages upgraded, 2 newly installed, 1 downgraded, 0 to remove and 0 not upgraded. | |
# Need to get 1,608 kB of archives. After unpacking 2,473 kB will be used. | |
# Do you want to continue? [Y/n/?] y <========================= | |
RUN apt install -y cmake build-essential | |
RUN cmake -DTESTDATADRIR=./test -DCMAKE_INSTALL_MANDIR:PATH=/usr/local/share/man .. | |
RUN make | |
RUN make install | |
# re-initialize your bash terminal by re-sourcing your startup file | |
# RUN . ~/.bashrc | |
# Reload/find/link shared libraries from the new executable | |
# RUN ldconfig "$(which pdftoppm)" # PREFERRED | |
# OR (same thing on my system at least) | |
# RUN ldconfig /usr/local/bin/pdftoppm | |
# Ensure your version is now newer than it was when we started! | |
# Mine now outputs `pdftoppm version 22.11.0`! | |
# RUN pdftoppm -v | |
# Now run the `pdftoppm` command again to convert a PDF to a bunch of TIF files, | |
# for example: | |
# RUN pdftoppm "My Optional PDF Password" -tiff -r 300 "in.pdf" "path/to/output/dir" | |
# OR (if you don't have a password on the PDF): | |
# RUN pdftoppm -tiff -r 300 "in.pdf" "path/to/output/dir" | |
# It should work now. Done! | |
# NB: the man pages may not be be updated for the newest executables you just | |
# built. So, you may need to use `pdftoppm --help` instead of `man pdftoppm`. | |
ENTRYPOINT ["bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment