Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocrmypdf --version crashes with pikepdf 2.2.1 #698

Closed
so-o opened this issue Dec 19, 2020 · 6 comments
Closed

ocrmypdf --version crashes with pikepdf 2.2.1 #698

so-o opened this issue Dec 19, 2020 · 6 comments

Comments

@so-o
Copy link

so-o commented Dec 19, 2020

Here is the core dump:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6ddb51f in pybind11::detail::type_caster_base<QPDFObjectHandle>::make_move_constructor<QPDFObjectHandle, void>(QPDFObjectHandle const*)::{lambda(void const*)#1}::_FUN(void const*) ()
   from .../OCRmyPDF/lib/python3.8/site-packages/pikepdf/_qpdf.cpython-38-x86_64-linux-gnu.so

OCRmyPDF 11.4.0
pikepdf 2.2.1
qpdf 10.0.4
python 3.8.5

Could be an issue with pikepdf.

@jbarlow83
Copy link
Collaborator

Can you provide some additional information, in particular what OS is this, and what commands did you use to install it?

@so-o
Copy link
Author

so-o commented Dec 19, 2020

Ubuntu 20.04 LTS. OCRmyPDF 11.4. qpdf 10.0.4 and pikepdf 2.2.1 were installed from the deposits on github.

$ python3 -m venv OCRmyPDF
$ cd OCRmyPDF
$ source bin/activate
$ pip3 install wheel
$ pip3 show wheel # wheel 0.36.2
$ pip3 install pikepdf
$ pip3 show pikepdf # pikepdf 2.2.0
$ pip3 install ocrmypdf
$ ocrmypdf --version
11.4

No crash. Now if I do a pip3 install . from the source tree of pikepdf on github, ocrmypdf crashes.

@jbarlow83
Copy link
Collaborator

I pushed pikepdf 2.2.1 to pypi. Please try that instead. The binary wheels provide their own version of libqpdf and should bypass the issue you encountered.

There are no C++ code changes between 2.2.0 and 2.2.1, so the difference is something to do with custom compilation of qpdf and pikepdf.

The command pip3 install pikepdf will not automatically find 10.0.4 on its own without some explicit custom steps and probably linked against whatever qpdf ships with Ubuntu 20.04. I'm not sure why it linked at all.

@so-o
Copy link
Author

so-o commented Dec 21, 2020

Installing pikepdf 2.2.1 from the wheel on pypi works, and the PDF/A-1B generated by OCRmyPDF is valid for veraPDF. Thanks!

The version of qpdf installed on Ubuntu 20.04 is 9.1.1. I did install in /usr/local/lib version 10.0.4 of qpdf compiled from the git deposit. The directory /usr/local/lib is listed in /etc/ld.so.conf.d/libc.conf. I did a sudo ldconfig before installing pikepdf from the source tree. I can't uninstall the official qpdf, many programs depend on it. Why isn't the linker using the libraries in /usr/local/lib?

@so-o
Copy link
Author

so-o commented Dec 21, 2020

I found a way! In the source tree of pikepdf, in a venv (see my notes above):

$ export LDFLAGS='-L/usr/local/lib'
$ pip3 install .

@jbarlow83
Copy link
Collaborator

I updated the pikepdf install instructions to mention LDFLAGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants