lovell / sharp-libvips

Packaging scripts to prebuild libvips and its dependencies - you're probably looking for https://github.com/lovell/sharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined symbol when building with poppler

olivier-lacroix opened this issue · comments

Hi there,

I am trying to build libvips with PDF support. main additions to build/lin.sh are as follow:

mkdir ${DEPS}/openjpeg
$CURL https://github.com/uclouvain/openjpeg/archive/v${VERSION_OPENJPEG}.tar.gz | tar xzC ${DEPS}/openjpeg --strip-components=1
cd ${DEPS}/openjpeg
mkdir build
cd build
LDFLAGS=${LDFLAGS/\$/} cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TARGET} \
  -DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_CODEC=OFF
make install/strip

mkdir ${DEPS}/poppler
$CURL https://poppler.freedesktop.org/poppler-${VERSION_POPPLER}.tar.xz | tar xJC ${DEPS}/poppler --strip-components=1
cd ${DEPS}/poppler
# Disable building pdf-fullrewrite - which fails
sed -i'.bak' '/.*pdf-fullrewrite[ _].*/d' test/CMakeLists.txt
mkdir build
cd build
LDFLAGS=${LDFLAGS/\$/} cmake .. -G"Unix Makefiles" \
  -DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=${TARGET}/lib \
  -DBUILD_GTK_TESTS=OFF -DBUILD_QT5_TESTS=OFF -DBUILD_QT6_TESTS=OFF -DBUILD_CPP_TESTS=OFF -DENABLE_SPLASH=OFF -DENABLE_UTILS=OFF \
  -DENABLE_CPP=OFF -DENABLE_GTK_DOC=OFF -DENABLE_QT5=OFF -DENABLE_QT6=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=release
make install/strip

This mostly works, binary artefacts being produced, and I am able to process some pdf files with sharp.

Unfortunately, it fails for some files, with the following error

nodejs: symbol lookup error: /[...]/node_modules/sharp/build/Release/../../vendor/8.10.5/lib/libvips.so.42: undefined symbol: opj_stream_default_create

My (limited) understanding is that openjpeg fails to be linked properly into poppler and/or libvips.

Any advice / idea on what I am missing here?

yes indeed @lovell . Since it seems to be a failure of poppler to link in libopenjp2, I have also reported the issue there

Any idea or advice to make poppler pull in openjp2 properly by any chance?

@lovell, I was able to solve this with the help of @kleisauke in libvips/libvips#1944

I understand poppler creates license issues. @jcupitt mentioned that the next version of libvips (8.11) would have "easy" support for pdfium. @lovell, is this something you would consider including in default binaries?

For reference, the working patch here

@lovell . OK thanks. a small maybe then :-)