jalan / pdftotext

Simple PDF text extraction
MIT License
870 stars 99 forks source link

Install on MacOS C++11 Error #80

Closed willmac321 closed 3 years ago

willmac321 commented 3 years ago

Hey I know this was addressed here: https://github.com/jalan/pdftotext/issues/53

But I appear to be running into a similar issue: System - macOS Big Sur v 11.2.3

python v 3.8.7 pip v 21.0.1

I do no have conda installed.

I have installed pkgconfig poppler with brew and am using pyenv for a virtual python env

getting this error:

Building` wheels for collected packages: pdftotext
  Building wheel for pdftotext (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/user/.venv/3.8.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/f70nyf017sl08mcphb12_gv00000gn/T/pip-install-pijkdutq/pdftotext_302d340f24f843c2a38d3922ef5a5546/setup.py'"'"'; __file__='"'"'/private/var/folders/79/f70nyf017sl08mcphb12_gv00000gn/T/pip-install-pijkdutq/pdftotext_302d340f24f843c2a38d3922ef5a5546/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/79/f70nyf017sl08mcphb12_gv00000gn/T/pip-wheel-21t2udzi
       cwd: /private/var/folders/79/f70nyf017sl08mcphb12_gv00000gn/T/pip-install-pijkdutq/pdftotext_302d340f24f843c2a38d3922ef5a5546/
  Complete output (32 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pdftotext' extension
  creating build
  creating build/temp.macosx-11.2-x86_64-3.8
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include -I/local/.venv/3.8.7/include -I/Users/user/.pyenv/versions/3.8.7/include/python3.8 -c pdftotext.cpp -o build/temp.macosx-11.2-x86_64-3.8/pdftotext.o -Wall -mmacosx-version-min=10.9
  In file included from pdftotext.cpp:3:
  In file included from /usr/local/include/poppler/cpp/poppler-document.h:25:
  /usr/local/include/poppler/cpp/poppler-global.h:51:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
      noncopyable(const noncopyable &) = delete;
                                         ^
  /usr/local/include/poppler/cpp/poppler-global.h:52:57: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
      const noncopyable &operator=(const noncopyable &) = delete;
                                                          ^
  In file included from pdftotext.cpp:5:
  /usr/local/include/poppler/cpp/poppler-page.h:41:23: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
      text_box(text_box &&) noexcept;
                        ^
  /usr/local/include/poppler/cpp/poppler-page.h:41:26: error: expected ';' at end of declaration list
      text_box(text_box &&) noexcept;
                           ^
                           ;
  /usr/local/include/poppler/cpp/poppler-page.h:42:34: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
      text_box &operator=(text_box &&) noexcept;
                                   ^
  /usr/local/include/poppler/cpp/poppler-page.h:42:37: error: expected ';' at end of declaration list
      text_box &operator=(text_box &&) noexcept;
                                      ^
                                      ;
  4 warnings and 2 errors generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pdftotext
willmac321 commented 3 years ago

CPPFLAGS="-std=c++11" pip3 install pdftotext
fixes this

jalan commented 3 years ago

Hmm, it shouldn't be necessary to manually set -std=c++11, as it is supposed to be set automatically when needed. I'm going to reopen this to take a look.

But, I don't have a mac to debug on, and CI systems don't seem to have Big Sur available yet, so it might be a while before I can investigate....

willmac321 commented 3 years ago

Hmm, it shouldn't be necessary to manually set -std=c++11, as it is supposed to be set automatically when needed. I'm going to reopen this to take a look.

But, I don't have a mac to debug on, and CI systems don't seem to have Big Sur available yet, so it might be a while before I can investigate....

Sounds good! Let me know if I can be of assistance with testing or coding to correct the issue. Thank you for taking a look at this. :)

willmac321 commented 3 years ago

@jalan Hey this was definitely a user error on my end, installing from requirements.txt with an old version (2.1.2) and I didn't think to check there first. Works great with version 2.1.5 Going to close again, sorry about the trouble!

jalan commented 3 years ago

:+1: Glad to know it works