Search code examples
bashdockerubuntudockerfilepdf2htmlex

pdf2htmlEX custom docker image - building problems with fatal error


Funds

There is this app that has been outdated for quite some time and unsupporeted: https://github.com/pdf2htmlEX/pdf2htmlEX

The last release was in July 2020.

But since then there has been a poppler and fontforge update, which some people in the repo have updated (just no new release...)

So I thought I would make a custom image for my own project with a Dockerfile.

I read about the problems with building and went through the fixed steppes one by one.

Dockerfile

FROM ubuntu:latest

RUN apt-get update && apt-get -y install \
bash \
git-all

WORKDIR /tmp

RUN git clone https://github.com/pdf2htmlEX/pdf2htmlEX

WORKDIR /tmp/pdf2htmlEX

ENV DEBIAN_FRONTEND=noninteractive

# These 9 steps equal with the ./buildScripts/buildInstallLocallyApt (I tried that one too)

RUN ./buildScripts/versionEnvs
RUN ./buildScripts/reportEnvs
RUN ./buildScripts/getBuildToolsApt
RUN ./buildScripts/getDevLibrariesApt
RUN ./buildScripts/getPoppler
RUN ./buildScripts/buildPoppler
RUN ./buildScripts/getFontforge
RUN ./buildScripts/buildFontforge
RUN ./buildScripts/buildPdf2htmlEX

Problem

enter image description here

All steps run well, except the buildPdf2htmlEx.

[ 22%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/outline.cc.o
[ 25%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/state.cc.o
[ 28%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/text.cc.o
[ 31%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/BackgroundRenderer.cc.o
[ 34%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/SplashBackgroundRenderer.cc.o
[ 37%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/CairoBackgroundRenderer.cc.o
[ 40%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/const.cc.o
[ 42%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/encoding.cc.o
[ 45%] Building C object CMakeFiles/pdf2htmlEX.dir/src/util/ffw.c.o
In file included from /tmp/pdf2htmlEX/pdf2htmlEX/../fontforge/fontforge/baseviews.h:31,
from /tmp/pdf2htmlEX/pdf2htmlEX/src/util/ffw.c:17:
/tmp/pdf2htmlEX/pdf2htmlEX/../fontforge/inc/ffglib.h:33:10: fatal error: gio/gio.h: No such file or directory
33 | #include <gio/gio.h>
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/pdf2htmlEX.dir/build.make:286: CMakeFiles/pdf2htmlEX.dir/src/util/ffw.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/pdf2htmlEX.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

What should be the problem?

If I try to install the pdf2htmlEX application in a Linux (Ubuntu and Alpine too) VM, it works fine.

I want to replace these few lines in my Dockerfile with the steps mentioned above.

RUN wget https://github.com/pdf2htmlEX/pdf2htmlEX/releases/download/v0.18.8.rc1/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb
RUN mv pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb pdf2htmlEX.deb
RUN apt-get install -y ./pdf2htmlEX.deb

Solution

  • i made my own dockerfile for the same reasone (not an update for years).

    Maybe there are some error, i admit that i don't make docker image every day (sorry).

    If it can help you, it seams to work.

    FROM ubuntu:22.04
    
    RUN apt-get update && apt-get upgrade && apt-get install -y sudo gzip zip git
    
    RUN git clone https://github.com/pdf2htmlEX/pdf2htmlEX.git
    
    WORKDIR ./pdf2htmlEX
    ENV UNATTENDED="-y"
    RUN buildScripts/getBuildToolsApt
    RUN buildScripts/buildInstallLocallyApt
        
    #ENTRYPOINT ["pdf2htmlEX"]