Installing pikepdf on Elastic Beanstalk

312 views Asked by At

I first tried adding pikepdf in requirements.txt

src/qpdf/annotation.cpp:14:10: fatal error: qpdf/QPDFAnnotationObjectHelper.hh: No such file or directory

I think it was missing a dependency. So I tried installing qpdf using yum install qpdf-devel

However, that is only able to install version 5.0.1, and there is a requirement of qpdf 10.6.2.

Then, I tried to build qpdf from the source.

packages:
  yum:
    python3-devel: []
    git: []
    gcc-c++: []
    libjpeg-turbo-devel: []

container_commands:
  01_upgrade_pip:
    command: "source /var/app/venv/*/bin/activate && python -m pip install --upgrade pip"
    leader_only: true
  04_wget:
    command: "wget https://github.com/qpdf/qpdf/releases/download/release-qpdf-10.6.2/qpdf-10.6.2.tar.gz"
  05_targxf:
    command: "tar -xf qpdf-10.6.2.tar.gz"
  06_cd:
    command: |
      cd qpdf-10.6.2
      ./configure
      make
      sudo make install 
      sudo ldconfig
  07_pikepdf:
    command: "source /var/app/venv/*/bin/activate && python -m pip install pikepdf"

With this, I believe I made some progress as the code deployed, but in the page I tried to load pikepdf, there was an error.

from . import _qpdf
ImportError: /var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pikepdf/_qpdf.cpython-38-aarch64-linux-gnu.so: undefined symbol: _ZTIN16QPDFObjectHandle15ParserCallbacksE

...

raise ImportError(_msg) from _e
ImportError: pikepdf's extension library failed to import

Here's what I got when building, I believe qpdf built correctly:

libraries have been installed in:
    /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
    - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
        during execution
    - add LIBDIR to the 'LD_RUN_PATH' environment variable
        during linking
    - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

Is there another way?

0

There are 0 answers