libvips / libvips

A fast image processing library with low memory needs.
https://libvips.github.io/libvips/
GNU Lesser General Public License v2.1
9.74k stars 677 forks source link

fix build with PDFium #1400

Closed revathi-murali closed 4 years ago

revathi-murali commented 5 years ago

We are upgrading to libvips 8.8.1 and looks like there are some changes made in 8.8.1 with pdfium linking and I get the following error when building vips:

`/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc++
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:750: libvips.la] Error 1
make[3]: *** [Makefile:877: install-recursive] Error 1
make[2]: *** [Makefile:632: install-recursive] Error 1
make[1]: *** [Makefile:943: install-strip] Error 2
make: *** [Makefile:9: build] Error 2

Command used to build libvips

aclocal && automake && \
    ./configure --prefix=/usr \
        --with-pdfium-includes=/usr/include/pdfium \
        --with-pdfium-libraries=/usr/lib \
        --without-python \
        --without-gsf \
        --enable-debug=no \
        --disable-dependency-tracking \
        --disable-static \
        --enable-silent-rules && \
    make -s install-strip

Since alpine uses musl libc, I am not sure if glibc/libc++ works fine on musl. Any pointers on this?

Note: We are using the following patches already

  1. https://github.com/jcupitt/docker-builds/blob/31cc11fcd160f2f722eb66841891e6d00c79da10/pdfium/data/build-pdfium.sh#L29-L33
jcupitt commented 5 years ago

Something about the way you've built pdfium, I guess. I know libvips itself builds fine on alpine.

C++ link problems are awful :( The two usual solutions are not to use -lc++, or to link with g++. You could check the .pc file that pdfium build makes.

revathi-murali commented 5 years ago

Sure I will check the .pc file and update you.

vposham commented 5 years ago

I had issues (exactly this one - https://github.com/jcupitt/docker-builds/issues/2) linking pdfium with vips 8.7.4.

So, Im currently using separate microservices - one to do image processing by using vips and bimg without pdfium for all image formats and another one for all PDF operations without using vips by calling pdfium (by using pdfium binaries) and libjpeg header files using cgo.

I always was tried to build vips on debain based systems and ran into https://github.com/jcupitt/docker-builds/issues/2 this issue.

@jcupitt, Do you suggest me to use alpine based base image for linking pdfium with vips even for 8.7.4to avoid this issue (https://github.com/jcupitt/docker-builds/issues/2)?

@revathi-murali , If you've managed to make vips 8.7.4 to work with pdfium, could you please share that docker file?

Thanks

jcupitt commented 4 years ago

Build with pdfium needs fixing :( Let's leave this issue as a reminder.

tomrucki commented 4 years ago

Taking binaries from https://github.com/bblanchon/pdfium-binaries and then installing libicu-dev libc++-dev libc++abi-dev it seems to work. But I'm not sure how valid that approach is?

jcupitt commented 4 years ago

If it works, that's great, thank you for the update.

We need to sit down and fix this properly :(

vposham commented 4 years ago

If anyone needs pdfium working with binaries (without libvips) - refer this - https://stackoverflow.com/a/60254335/7438923

asterikx commented 4 years ago

@jcupitt do you know if there is any progress on this?

I'm facing the same issue as OP. I need to build libvips with PDFium support for AWS Lambda (Amazon Linux 1).

I fetch the latest pre-built PDFium binary from https://github.com/bblanchon/pdfium-binaries and build libvips with the --with-pdfium-includes and --with-pdfium-libraries options pointing to the corresponding paths:

curl -L https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux.tgz > pdfium-linux.tgz && \
  mkdir -p /opt/pdfium-linux && \
  tar -xf pdfium-linux.tgz -C /opt
./configure \
  --prefix=/opt \
  --disable-gtk-doc \
  --without-magick \
  --with-expat=/opt && \
  --with-pdfium-includes=/opt/include \
  --with-pdfium-libraries=/opt/lib
make && \
  make install

Error message:

make[3]: Entering directory `/build/vips-8.9.2/libvips'
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -no-undefined -version-info 54:2:12   -o libvips.la -rpath /opt/lib  resample/libresample.la arithmetic/libarithmetic.la colour/libcolour.la conversion/libconversion.la convolution/libconvolution.la deprecated/libdeprecated.la foreign/libforeign.la freqfilt/libfreqfilt.la histogram/libhistogram.la draw/libdraw.la iofuncs/libiofuncs.la morphology/libmorphology.la mosaicing/libmosaicing.la create/libcreate.la -lz     -lpng12    -ltiff   -ljpeg   -pthread -lgthread-2.0 -lglib-2.0   -Wl,--export-dynamic -pthread -lgmodule-2.0 -lgobject-2.0 -lglib-2.0   -L/opt/lib -lexpat     -llcms2      -L/opt/lib -lpdfium -lc++ -licuuc         -lm 
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-amazon-linux/4.8.5/crtbeginS.o  -Wl,--whole-archive resample/.libs/libresample.a arithmetic/.libs/libarithmetic.a colour/.libs/libcolour.a conversion/.libs/libconversion.a convolution/.libs/libconvolution.a deprecated/.libs/libdeprecated.a foreign/.libs/libforeign.a freqfilt/.libs/libfreqfilt.a histogram/.libs/libhistogram.a draw/.libs/libdraw.a iofuncs/.libs/libiofuncs.a morphology/.libs/libmorphology.a mosaicing/.libs/libmosaicing.a create/.libs/libcreate.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath -Wl,/usr/lib64 -lz -lpng12 -ltiff -ljpeg -lgthread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -L/opt/lib /usr/lib64/libexpat.so -llcms2 -lpdfium -lc++ -licuuc -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5 -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/crtendS.o /usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64/crtn.o  -g -O2 -pthread -Wl,--export-dynamic -pthread   -pthread -Wl,-soname -Wl,libvips.so.42 -o .libs/libvips.so.42.12.2
/usr/bin/ld: cannot find -lc++
collect2: error: ld returned 1 exit status

I also tried to build from source (see PDFium repo), but the ./build/install-build-deps.sh script does not support Amazon Linux 1:

ERROR: The only supported distros are
    Ubuntu 14.04 LTS (trusty with EoL April 2022)
    Ubuntu 16.04 LTS (xenial with EoL April 2024)
    Ubuntu 18.04 LTS (bionic with EoL April 2028)
    Ubuntu 20.04 LTS (focal with Eol April 2030)
    Ubuntu 19.04 (disco)
    Ubuntu 19.10 (eoan)
    Debian 8 (jessie) or later

I appreciate any help!

jcupitt commented 4 years ago

Sorry, we've been getting ready for the 8.10 release. Perhaps in the 8.11 cycle.

asterikx commented 4 years ago

@jcupitt you don't have to apologize for anything ;) I'll try to use Poppler in the meantime. I hope improved PDFium support can make it into 8.11.

jahanford commented 4 years ago

Just to continue on from #1837, I am able to successfully build libvips 8.9.1 (haven't test 8.10+ yet) referencing the latest linux build from https://github.com/bblanchon/pdfium-binaries and have tested pdf to jpg renders via both CLI and Sharp with no issue. Fortunately the warning doesn't appear to be fatal. I am happy to provide a dockerfile or guidance for anyone struggling with the libc++ libicu linkage step.

asterikx commented 4 years ago

I am happy to provide a dockerfile or guidance for anyone struggling with the libc++ libicu linkage step.

@Projkt-James I would gladly see the Dockerfile 👍

vposham commented 4 years ago

I am happy to provide a dockerfile or guidance for anyone struggling with the libc++ libicu linkage step.

@Projkt-James I would gladly see the Dockerfile 👍

https://github.com/libvips/libvips/issues/1400#issuecomment-587005438

https://stackoverflow.com/a/60254335/7438923

jcupitt commented 4 years ago

Nice! Dockerfile copied here for reference:

FROM ubuntu:16.04
# Specify pdfium version
ARG PdfiumVersion=4026

# Install pkg-config, etc.
RUN apt-get -yqq update \
    && apt-get clean \
    && apt-get install -yqq apt-utils pkg-config tzdata \
    && dpkg-reconfigure -f noninteractive tzdata

# Create .pc file for pkg-config
RUN echo "\n" \
     "prefix=/home\n" \
     "Name: pdfium\n" \
     "Description: pdfium\n" \
     "Version: $PdfiumVersion\n" \
     "Requires:\n" \
     "Libs: -L/home/lib -lpdfium\n" \
     "Cflags: -I/home/include\n" >  /home/pdfium.pc

# Download and extract pdfium binary
RUN cd /home \
    && wget --quiet https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$PdfiumVersion/pdfium-linux.tgz \
    && tar -xf pdfium-linux.tgz \
    && rm pdfium-linux.tgz

# Setting up paths for pkg-config
ENV LD_LIBRARY_PATH=/home/lib
ENV PKG_CONFIG_PATH=/home/

## COPY YOUR APP TO /app/src/yourApp
# BUILD YOUR APP
WORKDIR /app/src/yourApp

# RUN your app which is linked to pdfium
ENTRYPOINT [“./yourApp"]
jcupitt commented 4 years ago

I've fixed build with pdfium -- it builds cleanly against the current binary from https://github.com/bblanchon/pdfium-binaries

There's a comment in pdfiumload.c with build notes:

/* How to build against PDFium:
 *
 * Download the prebuilt binary from: 
 *
 *      https://github.com/bblanchon/pdfium-binaries
 *
 * Untar to the libvips install prefix, for example:
 *
 *      cd ~/vips
 *      tar xf ~/pdfium-linux.tgz
 *
 * Create a pdfium.pc like this (update the version number):
 *

VIPSHOME=/home/john/vips
cat > $VIPSHOME/lib/pkgconfig/pdfium.pc << EOF
     prefix=$VIPSHOME
     exec_prefix=\${prefix}
     libdir=\${exec_prefix}/lib
     includedir=\${prefix}/include
     Name: pdfium
     Description: pdfium
     Version: 4290
     Requires:
     Libs: -L\${libdir} -lpdfium
     Cflags: -I\${includedir}
EOF

 * 
 */

Then just ./configure etc and it should build cleanly and work.

I'll try to add support for VipsSource as well.

jcupitt commented 4 years ago

OK, all done! I'll close. This will be in 8.11. Thanks for explaining how to fix the linking.

asterikx commented 4 years ago

I decided to give it a try again. My setup differs slightly since I need to build for lambda (everything must end up in /opt)

Unfortunately, libvips is no detecting my pdfium installation. I created pdfium.pc in /opt/lib/pkgconfig (which is in my PKG_CONFIG_PATH) with the following content:

prefix=/opt
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: pdfium
Description: pdfium
Version: 4313
Requires:
Libs: -L${libdir} -lpdfium
Cflags: -I${includedir}

and extracted the pre-built binaries into /opt.

libvips' output includes the following lines:

checking for PDFIUM... libraries (none), headers -I/opt/include
PDF import with PDFium:                 no

I can't really see what is wrong with my setup.

I hope someone can help me here.

Dockerfile ```Dockerfile FROM lambci/lambda:build-go1.x AS compile-image ENV BUILD_DIR="/tmp/build" ENV INSTALL_DIR="/opt" # Create all necessary directories # RUN set -Eeuxo pipefail \ && mkdir -p ${BUILD_DIR} \ ${INSTALL_DIR}/{bin,doc,include,lib,lib64,libexec,sbin,share} \ ${INSTALL_DIR}/{lib,lib64}/pkgconfig # Install Development Tools # WORKDIR /tmp RUN set -Eeuxo pipefail \ && yum -y update \ && yum -y install \ gcc72-c++ \ nasm \ ninja-build \ && yum -y clean all RUN pip3 install meson # Set GCC to 7.2.1-2 (default is 4.8.5-28 on lambci/lambda:build-go1.x image) RUN update-alternatives --set gcc /usr/bin/gcc72 # Configure Default Compiler Variables # ENV PKG_CONFIG_PATH="${INSTALL_DIR}/lib64/pkgconfig:${INSTALL_DIR}/lib/pkgconfig" \ PKG_CONFIG="/usr/bin/pkg-config" \ PATH="${INSTALL_DIR}/bin:${PATH}" ENV LD_LIBRARY_PATH="${INSTALL_DIR}/lib64:${INSTALL_DIR}/lib" # Install Libpng (http://www.linuxfromscratch.org/blfs/view/svn/general/libpng.html) # # Pre-installed on Amazon Linux: 1.2.49 # Required by (optional): libvips # ENV LIBPNG_VERSION=1.6.37 ENV LIBPNG_BUILD_DIR=${BUILD_DIR}/libpng RUN set -Eeuxo pipefail \ && mkdir -p ${LIBPNG_BUILD_DIR} \ && curl -L https://downloads.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.xz \ | tar xJC ${LIBPNG_BUILD_DIR} --strip-components=1 WORKDIR ${LIBPNG_BUILD_DIR}/ RUN set -Eeuxo pipefail \ && ./configure \ --prefix=${INSTALL_DIR} \ --with-sysroot=${INSTALL_DIR} \ --disable-static \ && make V=0 \ && make install # Install Libjpeg-Turbo (http://www.linuxfromscratch.org/blfs/view/svn/general/libjpeg.html) # # Pre-installed on Amazon Linux: no # Required by (optional): libvips # ENV LIBJPEG_TURBO_VERSION=2.0.5 ENV LIBJPEG_TURBO_BUILD_DIR=${BUILD_DIR}/libjpeg RUN set -Eeuxo pipefail \ && mkdir -p ${LIBJPEG_TURBO_BUILD_DIR}/build \ && curl -L https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-${LIBJPEG_TURBO_VERSION}.tar.gz \ | tar xzC ${LIBJPEG_TURBO_BUILD_DIR} --strip-components=1 WORKDIR ${LIBJPEG_TURBO_BUILD_DIR}/build/ RUN set -Eeuxo pipefail \ && cmake .. \ -DCMAKE_PREFIX_PATH=${INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ -DCMAKE_BUILD_TYPE=RELEASE \ -DENABLE_STATIC=FALSE \ -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \ && make V=0 \ && make install # Install libexif (http://www.linuxfromscratch.org/blfs/view/svn/general/libexif.html) # # Pre-installed on Amazon Linux: no # Required by (optional): libvips # https://github.com/libvips/libvips/issues/1749#issuecomment-666312296 # ENV LIBEXIF_VERSION=0.6.22 ENV LIBEXIF_VERSION_SNAKECASE=0_6_22 ENV LIBEXIF_BUILD_DIR=${BUILD_DIR}/libexif RUN set -Eeuxo pipefail \ && mkdir -p ${LIBEXIF_BUILD_DIR} \ && curl -L https://github.com/libexif/libexif/releases/download/libexif-${LIBEXIF_VERSION_SNAKECASE}-release/libexif-${LIBEXIF_VERSION}.tar.xz \ | tar xJC ${LIBEXIF_BUILD_DIR} --strip-components=1 WORKDIR ${LIBEXIF_BUILD_DIR} RUN set -Eeuxo pipefail \ && ./configure --prefix=${INSTALL_DIR} \ --disable-static \ && make V=0 \ && make install # Install Little CMS (http://www.linuxfromscratch.org/blfs/view/svn/general/lcms2.html) # # Pre-installed on Amazon Linux: 2.6 # Required by (recommended): libvips # https://github.com/libvips/libvips/issues/1749#issuecomment-666606745 # ENV LCMS2_VERSION=2.11 ENV LCMS2_BUILD_DIR=${BUILD_DIR}/lcms RUN set -Eeuxo pipefail \ && mkdir -p ${LCMS2_BUILD_DIR} \ && curl -L https://downloads.sourceforge.net/lcms/lcms2-${LCMS2_VERSION}.tar.gz \ | tar xzC ${LCMS2_BUILD_DIR} --strip-components=1 WORKDIR ${LCMS2_BUILD_DIR}/ RUN set -Eeuxo pipefail \ && ./configure \ --prefix=${INSTALL_DIR} \ --disable-static \ && make V=0 \ && make install # Install orc (https://gitlab.freedesktop.org/gstreamer/orc/-/blob/master/.gitlab-ci.yml#L15) # # Pre-installed on Amazon Linux: no # Required by (recommended): libvips # https://github.com/libvips/libvips/issues/1749#issuecomment-666312296 # ENV ORC_VERSION=0.4.32 ENV ORC_BUILD_DIR=${BUILD_DIR}/orc RUN set -Eeuxo pipefail \ && mkdir -p ${ORC_BUILD_DIR} \ && curl -L https://gstreamer.freedesktop.org/src/orc/orc-${ORC_VERSION}.tar.xz \ | tar xJC ${ORC_BUILD_DIR} --strip-components=1 WORKDIR ${ORC_BUILD_DIR} RUN set -Eeuxo pipefail \ && mkdir build \ && cd build \ && meson --prefix=${INSTALL_DIR} --werror \ && ninja \ && ninja install # Install PDFium (http://www.linuxfromscratch.org/blfs/view/svn/general/cmake.html) # # Pre-installed on Amazon Linux: no # ENV PDFIUM_VERSION=4313 RUN set -Eeuxo pipefail \ && mkdir -p ${INSTALL_DIR} \ && curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${PDFIUM_VERSION}/pdfium-linux.tgz \ | tar xC ${INSTALL_DIR} RUN echo -e "\ prefix=${INSTALL_DIR}\n\ exec_prefix=\${prefix}\n\ libdir=\${exec_prefix}/lib\n\ includedir=\${prefix}/include\n\ Name: pdfium\n\ Description: pdfium\n\ Version: ${PDFIUM_VERSION}\n\ Requires:\n\ Libs: -L\${libdir} -lpdfium\n\ Cflags: -I\${includedir}\n" > ${INSTALL_DIR}/lib/pkgconfig/pdfium.pc RUN cat ${INSTALL_DIR}/lib/pkgconfig/pdfium.pc # Install libvips (https://libvips.github.io/libvips/install.html) # # Pre-installed on Amazon Linux: no # ENV LIBVIPS_VERSION=8.10.2 ENV LIBVIPS_BUILD_DIR=${BUILD_DIR}/libvips RUN set -Eeuxo pipefail \ && mkdir -p ${LIBVIPS_BUILD_DIR} \ && curl -L https://github.com/libvips/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz \ | tar xzC ${LIBVIPS_BUILD_DIR} --strip-components=1 WORKDIR ${LIBVIPS_BUILD_DIR} RUN set -Eeuxo pipefail \ && ./configure --prefix=${INSTALL_DIR} \ --without-gsf \ --without-fftw \ --without-magick \ --without-OpenEXR \ --without-nifti \ --without-heif \ # --without-pdfium \ --with-pdfium-includes=${INSTALL_DIR}/include \ --with-pdfium-libraries=${INSTALL_DIR}/lib \ --without-rsvg \ --without-openslide \ --without-matio \ --without-cfitsio \ --without-libwebp \ --without-pangoft2 \ --without-tiff \ --without-giflib \ --without-imagequant \ --disable-gtk-doc \ && make V=0 \ && make install \ # not sure what this does and how to copy it (lambda layers are unpacked to /opt) && echo /opt/lib > /etc/ld.so.conf.d/libvips.conf \ && ldconfig FROM lambci/lambda:build-go1.x AS runtime-image ENV SOURCE_DIR="/opt" ENV INSTALL_DIR="/opt" ENV PATH="/opt/bin:${PATH}" \ LD_LIBRARY_PATH="${INSTALL_DIR}/lib64:${INSTALL_DIR}/lib" # Install zip # RUN set -Eeuxo pipefail \ && yum update -y \ && yum -y install zip \ && yum -y clean all # Copy all binaries/libaries # RUN set -Eeuxo pipefail \ && mkdir -p ${INSTALL_DIR}/{etc,bin,var,share,lib} COPY --from=compile-image /lib64/libuuid.so.* ${INSTALL_DIR}/lib/ COPY --from=compile-image ${SOURCE_DIR}/share/ /tmp/share COPY --from=compile-image ${SOURCE_DIR}/bin/ ${INSTALL_DIR}/bin/ COPY --from=compile-image ${SOURCE_DIR}/var/ ${INSTALL_DIR}/var/ COPY --from=compile-image ${SOURCE_DIR}/lib/ ${INSTALL_DIR}/lib/ COPY --from=compile-image ${SOURCE_DIR}/lib64/ ${INSTALL_DIR}/lib/ ```
asterikx commented 4 years ago

When I add the options --with-pdfium-includes=${INSTALL_DIR}/include and --with-pdfium-libraries=${INSTALL_DIR}/lib, livips recognizes pdfium.

However, the built later fails with:

make[3]: Entering directory `/tmp/build/libvips/libvips'
  CXXLD    libvips.la
/usr/bin/ld: cannot find -lc++
collect2: error: ld returned 1 exit status
make[3]: *** [libvips.la] Error 1
make[3]: Leaving directory `/tmp/build/libvips/libvips'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/build/libvips/libvips'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/build/libvips'
make: *** [all] Error 2

which it doesn't when built without pdfium support.

Shouldn't --with-pdfium-includes and --with-pdfium-libraries options normally be unnecessary since libvips will auto-detect those using pkgconfig?

jcupitt commented 4 years ago

Hi @asterikx, thanks for testing this.

libvips' output includes the following lines: checking for PDFIUM... libraries (none), headers -I/opt/include

That looks odd. I see:

checking for PDFIUM... yes
configure: WARNING: PDFium found, disabling poppler

I wonder if you don't have git master libvips, or if you've not run autogen.sh since updating it?

For reference, my config.log looks like this:

configure:20958: checking for PDFIUM
configure:20965: $PKG_CONFIG --exists --print-errors "pdfium >= 4200"
configure:20968: $? = 0
configure:20982: $PKG_CONFIG --exists --print-errors "pdfium >= 4200"
configure:20985: $? = 0
configure:21027: result: yes
configure:21034: WARNING: PDFium found, disabling poppler

My pkg-config shows:

john@yingna ~/GIT/libvips (master) $ pkg-config pdfium --libs
-L/home/john/vips/lib -lpdfium
john@yingna ~/GIT/libvips (master) $ pkg-config pdfium --cflags
-I/home/john/vips/include
jcupitt commented 4 years ago

Oh heh I just saw your dockerfile, sorry.

Yes, this fix is git master libvips only, and you will need to use autogen.sh, not configure.

asterikx commented 4 years ago

@jcupitt thank you! It finally works 🙂

nator commented 3 years ago

Sorry for noise on this ticket, but I've gotten this built locally and I'm not sure how to tell if it's actually using PDFium? I see this in config.log:

3035-configure:21056: checking for RSVG
3036-configure:21063: $PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.40.3 cairo >= 1.2"
3037-configure:21066: $? = 0
3038-configure:21080: $PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.40.3 cairo >= 1.2"
3039-configure:21083: $? = 0
3040-configure:21129: result: yes

but vips -l still shows poppler?


          VipsForeignLoadPdfFile (pdfload), load PDF with libpoppler (.pdf), priority=0, is_a, get_flags, get_flags_filename, header, load
          VipsForeignLoadPdfBuffer (pdfload_buffer), load PDF with libpoppler, priority=0, is_a_buffer, get_flags, get_flags_filename, header, load```

Is there any way to tell if pdfium is actually being used by libvips? Should I remove poppler from the system so there's no chance it's used?
jcupitt commented 3 years ago

Hi @nator,

You should see:

$ vips -l | grep -i pdf
        VipsForeignLoadPdf (pdfload_base), load PDF with PDFium, priority=0
...

If you have both pdfium and poppler installed, libvips will pick pdfium, so I would guess your pdfium install probably failed somehow. Did you make the .pc file?

nator commented 3 years ago

Oops I pasted the entirely wrong line from config.log :(

configure:20848: gcc -c -g -O2 -I/usr/local/include  conftest.c >&5
configure:20848: $? = 0
configure:20882: gcc -o conftest -g -O2 -I/usr/local/include   conftest.c -L/usr/local/lib -lpdfium -lc++ -licuuc  >&5
configure:20882: $? = 0
configure:20912: result: libraries /usr/local/lib, headers -I/usr/local/include
configure:20930: WARNING: PDFium found, disabling poppler

Yes, I made the .pc file, but let me double check everything one last time now that I know to expect "load PDF with PDFium" in vips -l. Thanks for answering!

jcupitt commented 3 years ago

The safest check is the summary at the end of configure. During configure you should see:

...
checking for HEIF_AVIF... no
checking for struct heif_decoding_options.convert_hdr_to_8bit... no
checking for PDFIUM... yes
configure: WARNING: PDFium found, disabling poppler
checking for RSVG... yes
checking for ZLIB... yes
...

Then in the summary at the end:

...
file import with matio:         yes
PDF import with PDFium:         yes
PDF import with poppler-glib:       no
  (requires poppler-glib 0.16.0 or later)
SVG import with librsvg-2.0:        yes
...
nator commented 3 years ago

I think I mixed up my docker scripts and I've been building 8.10.2 instead of master. :( Trying that...

jcupitt commented 3 years ago

There's 8.10.4 now and it includes a fixed PDFium build. I'd try that.

nator commented 3 years ago

Hmm. I'm stumped:

root@28d2d1efdea9:/vips-8.10.4# grep PDF config.log 
configure:20825: checking for PDFIUM
configure:20930: WARNING: PDFium found, disabling poppler
| #define HAVE_PDFIUM 1
PDF import with PDFium:         yes
PDF import with poppler-glib:       no

root@28d2d1efdea9:/# vips -v
vips-8.10.4-Mon Dec 14 09:20:17 UTC 2020

root@28d2d1efdea9:/# vips -l | grep -i pdf                                                                                                                   
        VipsForeignLoadPdf (pdfload_base), load PDF with libpoppler, priority=0
          VipsForeignLoadPdfFile (pdfload), load PDF with libpoppler (.pdf), priority=0, is_a, get_flags, get_flags_filename, header, load
          VipsForeignLoadPdfBuffer (pdfload_buffer), load PDF with libpoppler, priority=0, is_a_buffer, get_flags, get_flags_filename, header, load

With 8.10.4 I did not use autogen.sh -- is that still required maybe? I'm building on Ubuntu 20.04 due to upstream requirements, if that helps debug this at all...

nator commented 3 years ago

ah, built by hand and I see lots of build errors I was missing in docker:

In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c: In function ‘vips_foreign_load_pdf_close’:
pdfiumload.c:148:33: warning: passing argument 1 of ‘FPDF_ClosePage’ from incompatible pointer type [-Wincompatible-pointer-types]
  148 |  VIPS_FREEF( FPDF_ClosePage, pdf->page );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:905:57: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  905 | FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
      |                                               ~~~~~~~~~~^~~~
In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c:149:37: warning: passing argument 1 of ‘FPDF_CloseDocument’ from incompatible pointer type [-Wincompatible-pointer-types]
  149 |  VIPS_FREEF( FPDF_CloseDocument, pdf->doc );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:913:65: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  913 | FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document);
      |                                                   ~~~~~~~~~~~~~~^~~~~~~~
In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c: In function ‘vips_foreign_load_pdf_get_page’:
pdfiumload.c:222:34: warning: passing argument 1 of ‘FPDF_ClosePage’ from incompatible pointer type [-Wincompatible-pointer-types]
  222 |   VIPS_FREEF( FPDF_ClosePage, pdf->page );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:905:57: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  905 | FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
      |                                               ~~~~~~~~~~^~~~
pdfiumload.c:229:39: warning: passing argument 1 of ‘FPDF_LoadPage’ from incompatible pointer type [-Wincompatible-pointer-types]
  229 |   if( !(pdf->page = FPDF_LoadPage( pdf->doc, page_no )) ) {
      |                                    ~~~^~~~~
      |                                       |
      |                                       struct fpdf_document_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:662:65: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  662 | FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
      |                                                   ~~~~~~~~~~~~~~^~~~~~~~
pdfiumload.c:229:19: warning: assignment to ‘struct fpdf_page_t__ **’ from incompatible pointer type ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} [-Wincompatible-pointer-types]
  229 |   if( !(pdf->page = FPDF_LoadPage( pdf->doc, page_no )) ) {
      |                   ^
pdfiumload.c: In function ‘vips_foreign_load_pdf_set_image’:
pdfiumload.c:289:30: warning: passing argument 1 of ‘FPDF_GetMetaText’ from incompatible pointer type [-Wincompatible-pointer-types]
  289 |   len = FPDF_GetMetaText( pdf->doc, metadata->tag, text, 1024 );
      |                           ~~~^~~~~
      |                              |
      |                              struct fpdf_document_t__ **
In file included from pdfiumload.c:71:
/usr/include/fpdf_doc.h:388:72: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  388 | FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
      |                                                          ~~~~~~~~~~~~~~^~~~~~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_header’:
pdfiumload.c:331:39: warning: passing argument 1 of ‘FPDF_GetPageCount’ from incompatible pointer type [-Wincompatible-pointer-types]
  331 |  pdf->n_pages = FPDF_GetPageCount( pdf->doc );
      |                                    ~~~^~~~~
      |                                       |
      |                                       struct fpdf_document_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:650:63: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  650 | FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document);
      |                                                 ~~~~~~~~~~~~~~^~~~~~~~
In file included from ../../libvips/include/vips/vips.h:116,
                 from pdfiumload.c:62:
pdfiumload.c:366:26: warning: passing argument 1 of ‘FPDF_GetPageWidth’ from incompatible pointer type [-Wincompatible-pointer-types]
  366 |    FPDF_GetPageWidth( pdf->page ) * pdf->scale );
      |                       ~~~^~~~~~
      |                          |
      |                          struct fpdf_page_t__ **
../../libvips/include/vips/util.h:71:40: note: in definition of macro ‘VIPS_RINT’
   71 | #define VIPS_RINT( V ) __builtin_rint( V )
      |                                        ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:685:62: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  685 | FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page);
      |                                                    ~~~~~~~~~~^~~~
In file included from ../../libvips/include/vips/vips.h:116,
                 from pdfiumload.c:62:
pdfiumload.c:368:27: warning: passing argument 1 of ‘FPDF_GetPageHeight’ from incompatible pointer type [-Wincompatible-pointer-types]
  368 |    FPDF_GetPageHeight( pdf->page ) * pdf->scale );
      |                        ~~~^~~~~~
      |                           |
      |                           struct fpdf_page_t__ **
../../libvips/include/vips/util.h:71:40: note: in definition of macro ‘VIPS_RINT’
   71 | #define VIPS_RINT( V ) __builtin_rint( V )
      |                                        ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:707:63: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  707 | FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page);
      |                                                     ~~~~~~~~~~^~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_generate’:
pdfiumload.c:457:37: warning: passing argument 2 of ‘FPDF_RenderPageBitmap’ from incompatible pointer type [-Wincompatible-pointer-types]
  457 |   FPDF_RenderPageBitmap( bitmap, pdf->page,
      |                                  ~~~^~~~~~
      |                                     |
      |                                     struct fpdf_page_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:860:64: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  860 |                                                      FPDF_PAGE page,
      |                                                      ~~~~~~~~~~^~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_file_header’:
pdfiumload.c:614:17: warning: assignment to ‘struct fpdf_document_t__ **’ from incompatible pointer type ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} -Wincompatible-pointer-types]
  614 |  if( !(pdf->doc = FPDF_LoadDocument( file->filename, NULL )) ) {
      |                 ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libgsf-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-7 -I/usr/include/libpng16 -I/usr/include/libexif -I/usr/lib/x86_64-linux-gnu/hdf5/serial/include -pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/local/include -I/usr/include/OpenEXR -I/usr/include/openslide -I/usr/include/x86_64-linux-gnu -g -O2 -MT pdfload.lo -MD -MP -MF .deps/pdfload.Tpo -c pdfload.c -o pdfload.o >/dev/null 2>&1
pdfiumload.c: In function ‘vips_foreign_load_pdf_buffer_header’:
pdfiumload.c:690:17: warning: assignment to ‘struct fpdf_document_t__ **’ from incompatible pointer type ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} -Wincompatible-pointer-types]
  690 |  if( !(pdf->doc = FPDF_LoadMemDocument( buffer->buf->data,
      |                 ^

I'm using the 4355 PDFium binary, perhaps that's too new...

nator commented 3 years ago

Build with master and I'm sorted. Phew. Sorry for the endless thread :)

jcupitt commented 3 years ago

You're right, looking at the code you need git master libvips (8.11) for pdfium, I'd forgotten. Anyway, I'm glad it's working.

I made a demo Dockerfile that builds git master libvips against pdfium on 20.04, it might help someone:

https://github.com/jcupitt/docker-builds/blob/master/libvips-pdfium-ubuntu20.04/Dockerfile

nator commented 3 years ago

Thanks John! That Dockerfile looks great :)

On Tue, Dec 15, 2020 at 11:06 AM John Cupitt notifications@github.com wrote:

You're right, looking at the code you need git master libvips (8.11) for pdfium, I'd forgotten. Anyway, I'm glad it's working.

I made a demo Dockerfile that builds git master libvips against pdfium on 20.04, it might help someone:

https://github.com/jcupitt/docker-builds/blob/master/libvips-pdfium-ubuntu20.04/Dockerfile

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libvips/libvips/issues/1400#issuecomment-745430199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTZAXBFJLTXNMFEALMUETSU6JRPANCNFSM4INUWS3Q .

jahanford commented 3 years ago

ah, built by hand and I see lots of build errors I was missing in docker:

In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c: In function ‘vips_foreign_load_pdf_close’:
pdfiumload.c:148:33: warning: passing argument 1 of ‘FPDF_ClosePage’ from incompatible pointer type [-Wincompatible-pointer-types]
  148 |  VIPS_FREEF( FPDF_ClosePage, pdf->page );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:905:57: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  905 | FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
      |                                               ~~~~~~~~~~^~~~
In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c:149:37: warning: passing argument 1 of ‘FPDF_CloseDocument’ from incompatible pointer type [-Wincompatible-pointer-types]
  149 |  VIPS_FREEF( FPDF_CloseDocument, pdf->doc );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:913:65: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  913 | FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document);
      |                                                   ~~~~~~~~~~~~~~^~~~~~~~
In file included from ../../libvips/include/vips/vips.h:130,
                 from pdfiumload.c:62:
pdfiumload.c: In function ‘vips_foreign_load_pdf_get_page’:
pdfiumload.c:222:34: warning: passing argument 1 of ‘FPDF_ClosePage’ from incompatible pointer type [-Wincompatible-pointer-types]
  222 |   VIPS_FREEF( FPDF_ClosePage, pdf->page );
../../libvips/include/vips/memory.h:42:28: note: in definition of macro ‘VIPS_FREEF’
   42 |                 (void) F( (S) ); \
      |                            ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:905:57: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  905 | FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
      |                                               ~~~~~~~~~~^~~~
pdfiumload.c:229:39: warning: passing argument 1 of ‘FPDF_LoadPage’ from incompatible pointer type [-Wincompatible-pointer-types]
  229 |   if( !(pdf->page = FPDF_LoadPage( pdf->doc, page_no )) ) {
      |                                    ~~~^~~~~
      |                                       |
      |                                       struct fpdf_document_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:662:65: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  662 | FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
      |                                                   ~~~~~~~~~~~~~~^~~~~~~~
pdfiumload.c:229:19: warning: assignment to ‘struct fpdf_page_t__ **’ from incompatible pointer type ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} [-Wincompatible-pointer-types]
  229 |   if( !(pdf->page = FPDF_LoadPage( pdf->doc, page_no )) ) {
      |                   ^
pdfiumload.c: In function ‘vips_foreign_load_pdf_set_image’:
pdfiumload.c:289:30: warning: passing argument 1 of ‘FPDF_GetMetaText’ from incompatible pointer type [-Wincompatible-pointer-types]
  289 |   len = FPDF_GetMetaText( pdf->doc, metadata->tag, text, 1024 );
      |                           ~~~^~~~~
      |                              |
      |                              struct fpdf_document_t__ **
In file included from pdfiumload.c:71:
/usr/include/fpdf_doc.h:388:72: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  388 | FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
      |                                                          ~~~~~~~~~~~~~~^~~~~~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_header’:
pdfiumload.c:331:39: warning: passing argument 1 of ‘FPDF_GetPageCount’ from incompatible pointer type [-Wincompatible-pointer-types]
  331 |  pdf->n_pages = FPDF_GetPageCount( pdf->doc );
      |                                    ~~~^~~~~
      |                                       |
      |                                       struct fpdf_document_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:650:63: note: expected ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} but argument is of type ‘struct fpdf_document_t__ **’
  650 | FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document);
      |                                                 ~~~~~~~~~~~~~~^~~~~~~~
In file included from ../../libvips/include/vips/vips.h:116,
                 from pdfiumload.c:62:
pdfiumload.c:366:26: warning: passing argument 1 of ‘FPDF_GetPageWidth’ from incompatible pointer type [-Wincompatible-pointer-types]
  366 |    FPDF_GetPageWidth( pdf->page ) * pdf->scale );
      |                       ~~~^~~~~~
      |                          |
      |                          struct fpdf_page_t__ **
../../libvips/include/vips/util.h:71:40: note: in definition of macro ‘VIPS_RINT’
   71 | #define VIPS_RINT( V ) __builtin_rint( V )
      |                                        ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:685:62: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  685 | FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page);
      |                                                    ~~~~~~~~~~^~~~
In file included from ../../libvips/include/vips/vips.h:116,
                 from pdfiumload.c:62:
pdfiumload.c:368:27: warning: passing argument 1 of ‘FPDF_GetPageHeight’ from incompatible pointer type [-Wincompatible-pointer-types]
  368 |    FPDF_GetPageHeight( pdf->page ) * pdf->scale );
      |                        ~~~^~~~~~
      |                           |
      |                           struct fpdf_page_t__ **
../../libvips/include/vips/util.h:71:40: note: in definition of macro ‘VIPS_RINT’
   71 | #define VIPS_RINT( V ) __builtin_rint( V )
      |                                        ^
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:707:63: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  707 | FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page);
      |                                                     ~~~~~~~~~~^~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_generate’:
pdfiumload.c:457:37: warning: passing argument 2 of ‘FPDF_RenderPageBitmap’ from incompatible pointer type [-Wincompatible-pointer-types]
  457 |   FPDF_RenderPageBitmap( bitmap, pdf->page,
      |                                  ~~~^~~~~~
      |                                     |
      |                                     struct fpdf_page_t__ **
In file included from pdfiumload.c:70:
/usr/include/fpdfview.h:860:64: note: expected ‘FPDF_PAGE’ {aka ‘struct fpdf_page_t__ *’} but argument is of type ‘struct fpdf_page_t__ **’
  860 |                                                      FPDF_PAGE page,
      |                                                      ~~~~~~~~~~^~~~
pdfiumload.c: In function ‘vips_foreign_load_pdf_file_header’:
pdfiumload.c:614:17: warning: assignment to ‘struct fpdf_document_t__ **’ from incompatible pointer type ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} -Wincompatible-pointer-types]
  614 |  if( !(pdf->doc = FPDF_LoadDocument( file->filename, NULL )) ) {
      |                 ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libgsf-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-7 -I/usr/include/libpng16 -I/usr/include/libexif -I/usr/lib/x86_64-linux-gnu/hdf5/serial/include -pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/local/include -I/usr/include/OpenEXR -I/usr/include/openslide -I/usr/include/x86_64-linux-gnu -g -O2 -MT pdfload.lo -MD -MP -MF .deps/pdfload.Tpo -c pdfload.c -o pdfload.o >/dev/null 2>&1
pdfiumload.c: In function ‘vips_foreign_load_pdf_buffer_header’:
pdfiumload.c:690:17: warning: assignment to ‘struct fpdf_document_t__ **’ from incompatible pointer type ‘FPDF_DOCUMENT’ {aka ‘struct fpdf_document_t__ *’} -Wincompatible-pointer-types]
  690 |  if( !(pdf->doc = FPDF_LoadMemDocument( buffer->buf->data,
      |                 ^

I'm using the 4355 PDFium binary, perhaps that's too new...

I was building with 8.9.1 and majority of the warnings are non fatal from what I can tell. A lot of the issues I was having inside docker for older libvips versions was linking of libcxx and libicu.