frescobaldi / python-poppler-qt5

Python binding to libpoppler-qt5
Other
42 stars 32 forks source link

Building 21.1.0 fails with unsupported function return type #43

Closed heirecka closed 3 years ago

heirecka commented 3 years ago

When I try building python-poppler-qt5-21.1.0 with the following

python3.9 /usr/x86_64-pc-linux-gnu/bin/sip-build --build-dir /var/tmp/paludis/build/dev-python-python-poppler-qt5-21.1.0/work/PYTHON_ABIS/3.9 --no-make --qmake /usr/x86_64-pc-linux-gnu/lib/qt5/bin/qmake --target-dir /usr/x86_64-pc-linux-gnu/lib/python3.9/site-packages --verbose

it fails with

Querying qmake about your Qt installation...
/usr/x86_64-pc-linux-gnu/lib/qt5/bin/qmake -query
These bindings will be built: Poppler-Qt5.
Generating the Poppler-Qt5 bindings...

sip-build: poppler-form.sip:152: ::Poppler::FormFieldChoice::choicesWithExportValues() unsupported function return type - provide %MethodCode and a C++ signature

This is with sip-5.5.0, PyQt5-5.15.2 and poppler-21.01.0.

marlemion commented 3 years ago

Same here (on Cygwin, python 3.8). V 0.75.0 compiles.

heirecka commented 3 years ago

I think the culprit is

%If(POPPLER_V0_87_0 -)
   QVector< QPair< QString, QString > > choicesWithExportValues () const;
%End

introduced in 5cc4e529c57f9a838ab935811488c2230b3110fe.

I tried something along the lines of

-    QVector< QPair< QString, QString > > choicesWithExportValues () const;
+    typedef QPair<QString, QString> StringPair;
+    QVector<StringPair> choicesWithExportValues () const;

which passes through sip, but gives me an compilation error later on.

wbsoft commented 3 years ago

Probably a definition needs to be added to types.sip, but I'm not sure how exactly.

andrewbernard commented 3 years ago

Same identical problem here using Arch Linux. Any possibility of a fix? Totally unable to build and use Frescobaldi.

bnavigator commented 3 years ago

I made a fix in #45

limburgher commented 3 years ago

Applied, new error... building 'popplerqt5' extension sip5 -I /usr/share/sip -t POPPLER_V0_87_0 -c build/temp.linux-x86_64-3.9 -b build/temp.linux-x86_64-3.9/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -n PyQt5.sip -t WS_X11 -t Qt_5_15_0 poppler-qt5.sip usage: sip5 [-h] [-V] [-a FILE] [--abi-version VERSION] [-B TAG] [-c DIR] [-D] [-e] [-f] [-g] [-I DIR] [-j FILES] [-n NAME] [-o] [-P] [-r] [-s SUFFIX] [-t TAG] [-w] [-x FEATURE] [-X ID:FILE] [-y FILE] [FILE] sip5: error: unrecognized arguments: -b poppler-qt5.sip

bnavigator commented 3 years ago

What is your build call and SIP version? Don't use the deprecated sip5 command but pip or one of the sip- commands directly.

https://www.riverbankcomputing.com/static/Docs/sip/introduction.html#overview

limburgher commented 3 years ago

I had patched in sip5 specifically; when I took that out, it was fine. Sorry for the noise. :)

andrewbernard commented 3 years ago

Helllo, sorry to be totally dumb, but is this not yet in master?

How can I get and apply this fix?

On Wed, 24 Feb 2021 at 04:07, Ben Greiner notifications@github.com wrote:

I made a fix in #45 https://github.com/frescobaldi/python-poppler-qt5/pull/45

bnavigator commented 3 years ago

Several options:

You still have to build it, of course.

andrewbernard commented 3 years ago

Pardon my base ignorance.

I did this:

Get the archive from my branch: https://github.com/bnavigator/python-poppler-qt5/archive/map-qvector-qpair.zip

Here is the result:

python setup.py build_ext --pyqt-sip-dir=/usr/lib/python3.9/site-packages/PyQt5/bindings running build_ext building 'popplerqt5' extension /usr/bin/sip -I /usr/share/sip -t POPPLER_V21_01_0 -c build/temp.linux-x86_64-3.9 -b build/temp.linux-x86_64-3.9/poppler-qt5.sbf -I /usr/lib/python3.9/site-packages/PyQt5/bindings -n PyQt5.sip -t Qt_5_15_0 -t WS_X11 poppler-qt5.sip sip: poppler-form.sip:152: ::Poppler::FormFieldChoice::choicesWithExportValues() unsupported function return type - provide %MethodCode and a C++ signature error: command '/usr/bin/sip' failed with exit code 1

For this, I know how to clone a repository, but I don't know how to find a pull request and apply it. Can you please give more detailed commands?

Clone the git repository and checkout the PR with the gh cli or using git directly.

Similarly, I don't know how to do this:

Apply https://github.com/frescobaldi/python-poppler-qt5/issues/45.patch to existing sourcecode

I sincerely apologise for asking basic git questions here, but these less common usages always seem to be beyond my limited grasp of git.

Andrew

On Wed, 24 Feb 2021 at 09:50, Ben Greiner notifications@github.com wrote:

Several options:

Get the archive from my branch: https://github.com/bnavigator/python-poppler-qt5/archive/map-qvector-qpair.zip Clone the git repository and checkout the PR with the gh cli or using git directly. Apply https://github.com/frescobaldi/python-poppler-qt5/issues/45.patch to existing sourcecode ...

andrewbernard commented 3 years ago

Stupidly having neglected to check out the branch map-qvector-qpair, having done so I get a long cascade of errors about SIP_NULLPRT not declared, and gcc fails.

build/temp.linux-x86_64-3.9/sippopplerqt5cmodule.cpp:1782:5: error: ‘SIP_NULLPTR’ was not declared in this scope; did you mean ‘Q_NULLPTR’?

heirecka commented 3 years ago

Just to confirm, the patch from #45 makes it build fine again for me.

bnavigator commented 3 years ago

@andrewbernard:

  1. This is not a git support forum
  2. The options I listed are independent. You just need one.

Mind you again. This is all for building python-poppler-qt5 from source. There are no pre-built wheels for you yet.

error: command '/usr/bin/sip' failed with exit code 1

The sip command is old and deprecated. Your distribution ships an old version of SIP v4. Maybe the new data type can not be converted by SIP v4. Get a newer SIP (e.g. pip install sip and use sip-install or pip instead of setup.py)

For this, I know how to clone a repository, but I don't know how to find a pull request and apply it. Can you please give more detailed commands?

Just follow the links. Visit the Github page instead of reading this thread in the mail reader.

Similarly, I don't know how to do this: Apply https://github.com/frescobaldi/python-poppler-qt5/pull/45.patch to existing sourcecode

This completely independent of git. Also note that the link was wrong initially. I edited the post. Another reason to read the thread on the website.

To build, you need to have all build dependencies, including qmake and the poppler-qt5 headers. (search for -devel or -dev packages in your distribution, eg. libqt5-qtbase-devel andpoppler-qt5-devel)

wget https://files.pythonhosted.org/packages/70/13/264e20336f7951044a8dd49cb1460bd318e2ebacff1753f908e6544ec933/python-poppler-qt5-21.1.0.tar.gz
wget https://github.com/frescobaldi/python-poppler-qt5/pull/45.patch
python3 -m venv popplerbuild
source popplerbuild/bin/activate
tar xf python-poppler-qt5-21.1.0.tar.gz
cd python-poppler-qt5-21.1.0
patch -p1 < ../45.patch
pip install --upgrade pip
# you need qmake in PATH
export PATH=$PATH:/usr/lib64/qt5/bin/
# This builds the wheel, which you can install into any venv or user-site
pip wheel -v .
wbsoft commented 3 years ago

Thanks for the help! I may need some help with improving the build process and install instructions. Currently I maintain version etc in both setup.py and pyproject.toml, which is a bit cumbersome...