izderadicka / pdfparser

Python binding to libpoppler with focus on text extraction
97 stars 45 forks source link

installation issues #4

Closed simontoftnielsen closed 7 years ago

simontoftnielsen commented 7 years ago

Hi, Spend all day trying to get this to work. I am running Ubuntu 16.04 LTS on a virtual machine. I have built poppler using the build_poppler shell script you provided. It ran smoothly!

Running setup.py with the install command however returns the error: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Googling suggested me to sudo apt-get a bunch of packages. So I installed/updated:

build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev python-dev gcc python-dateutil python-docutils python-feedparser python-gdata python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python3-dev python3.5-dev libffi-dev

I did not install all of them at once. Just tried a different suggested solutions - and there were a lot... Anyway. I still can't get it to work. Any suggestions?

All the best, Simon

simontoftnielsen commented 7 years ago

ALSO... I get a lot of warnings saying: 'warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 I have no clue what this means :-)

izderadicka commented 7 years ago

Warnings are not important only errors. Usual problem is that setup must know where poppler source is. So either use POPPLER_ROOT environment variable or have it in poppler_src under in directory where setup.py script is. If this is not issue then exact compiler error is needed.

On July 12, 2017 4:19:37 PM GMT+02:00, simontoftnielsen notifications@github.com wrote:

ALSO... I get a lot of warnings saying: 'warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 I have no clue what this means :-)

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/izderadicka/pdfparser/issues/4#issuecomment-314783871

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

oplahcinski commented 7 years ago

@simontoftnielsen I had this problem when i was compiling in centos 7.

I've made a fix in my pip installable branch https://github.com/oplahcinski/pdfparser/blob/pip-installable/setup.py#L68

In the master branch you can see its empty https://github.com/izderadicka/pdfparser/blob/master/setup.py#L16

It gives you a ton of warnings about the override but you should see an actual error saying something like "‘nullptr’ was not declared in this scope".

I had GCC 4.8 so nullptr was supported but you have to add that extra compile arg to make it work.

see https://stackoverflow.com/questions/3756473/what-header-file-needs-to-be-included-for-using-nullptr-in-g#comment29860682_3756481

jurrian commented 7 years ago

I had the same problem compiling this as a docker image with alpine linux. @oplahcinski made the correct fix, I did the same and it fixed the problem.

For debugging purposes, these are the compilation errors I got:

cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from pdfparser/poppler.cpp:484:0:
/tmp/poppler/poppler/PDFDoc.h:295:3: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
   void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
   ^
In file included from pdfparser/poppler.cpp:484:0:
/tmp/poppler/poppler/PDFDoc.h:295:153: error: 'nullptr' was not declared in this scope
   void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
                                                                                                                                                         ^
/tmp/poppler/poppler/PDFDoc.h:296:156: error: 'nullptr' was not declared in this scope
   GBool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
                                                                                                                                                            ^
/tmp/poppler/poppler/PDFDoc.h:301:135: error: 'nullptr' was not declared in this scope
                            CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts = nullptr);
                                                                                                                                       ^
/tmp/poppler/poppler/PDFDoc.h:315:146: error: 'nullptr' was not declared in this scope
   void markObject (Object *obj, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
                                                                                                                                                  ^
/tmp/poppler/poppler/PDFDoc.h:324:99: error: 'nullptr' was not declared in this scope
                     int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts = nullptr)
                                                                                                   ^
izderadicka commented 7 years ago

Merged PR from @oplahcinski , thanks a lot for that. I'm usually too lazy to make reasonable setup scripts, sorry for that. README is better too, with tested installation recipes . I'm going for beer now :-) and you are all invited if you'll be near Prague in future.