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

error: command 'gcc' failed with exit status 1 #23

Closed
johndurning opened this issue Sep 13, 2018 · 24 comments
Closed

error: command 'gcc' failed with exit status 1 #23

johndurning opened this issue Sep 13, 2018 · 24 comments

Comments

@johndurning
Copy link

johndurning commented Sep 13, 2018

Hi,

I'm having trouble installing pdftotext. I'm using Python 3.6 on Anaconda 5.2.0 and pip version 18.0. There seems to be a problem with gcc so I did conda install libgcc but that didn't make any difference. I also made sure python3-dev was installed.

john@john-Virtual-Machine:~/py3eg$` pip install pdftotext
Collecting pdftotext
  Using cached https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz
Building wheels for collected packages: pdftotext
  Running setup.py bdist_wheel for pdftotext ... error
  Complete output from command /home/john/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9uyu6ggf/pdftotext/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 /tmp/pip-wheel-epbnqs4m --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'pdftotext' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  gcc -pthread -B /home/john/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=0 -I/home/john/anaconda3/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
   #include <poppler/cpp/poppler-document.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for pdftotext
  Running setup.py clean for pdftotext
Failed to build pdftotext
Installing collected packages: pdftotext
  Running setup.py install for pdftotext ... error
    Complete output from command /home/john/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9uyu6ggf/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-sx0bea7r/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'pdftotext' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    gcc -pthread -B /home/john/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=0 -I/home/john/anaconda3/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
     #include <poppler/cpp/poppler-document.h>
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/john/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9uyu6ggf/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-sx0bea7r/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-9uyu6ggf/pdftotext/

Any help would be greatly appreciated.

Thanks!

@jalan
Copy link
Owner

jalan commented Sep 13, 2018

Are the poppler dev libraries installed?

@johndurning
Copy link
Author

I think so.

john@john-Virtual-Machine:~$ dpkg -l | grep poppler
ii  libpoppler-glib8:amd64  0.62.0-2ubuntu2.2  amd64   PDF rendering library (GLib-based shared library)
ii  libpoppler73:amd64  0.62.0-2ubuntu2.2  amd64   PDF rendering library
ii  poppler-data  0.4.8-2  all  encoding data for the poppler PDF rendering library
ii  poppler-utils  0.62.0-2ubuntu2.2  amd64  PDF utilities (based on Poppler)

That should be ok, shouldn't it?

@jalan
Copy link
Owner

jalan commented Sep 14, 2018

Since this project uses poppler's CPP interface, you also need the libpoppler-cpp-dev package

@johndurning
Copy link
Author

Great, that worked. Thanks!

@jalan jalan closed this as completed Sep 15, 2018
@lhyGit
Copy link

lhyGit commented Nov 9, 2018

I had the same error on macOS. Also I don't find any way to install the libpoppler-cpp-dev package on macOS. I tried brew search libpoppler, but no such formula or related formulae exist. Any help would be greatly appreciated.

@lhyGit
Copy link

lhyGit commented Nov 9, 2018

It's interesting that I actually have the header file 'poppler-document.h' under the poppler path, which is '/usr/local/Cellar/poppler/0.71.0/include/poppler/cpp/poppler-document.h'. I think the compiler gcc couldn't find the header file for some reason but I don't know why specifically. Any ideas?

@jalan
Copy link
Owner

jalan commented Nov 9, 2018

@lhyGit libpoppler-cpp-dev is one of the packages needed on Debian-based systems. For macOS, the packages you need are installed via brew install pkg-config poppler

If you still have issues after installing those, can you provide the output of pip --verbose install pdftotext here?

@jalan
Copy link
Owner

jalan commented Nov 10, 2018

Reopening so I don't lose track of this

@jalan jalan reopened this Nov 10, 2018
@lhyGit
Copy link

lhyGit commented Nov 12, 2018

output.txt
Thanks for replying. This is the output of pip install. The compiler just couldn't find 'poppler-document.h', but it's actually under the poppler path.

@jalan
Copy link
Owner

jalan commented Nov 15, 2018

It looks like you're using anaconda, which is known to provide a strange build environment. Can you try to first install poppler via anaconda and then pip install pdftotext again? https://anaconda.org/conda-forge/poppler

@jalan
Copy link
Owner

jalan commented Nov 25, 2018

Closing after no response for ten days. Will reopen if further information is provided.

@jalan jalan closed this as completed Nov 25, 2018
@thsunkid
Copy link

thsunkid commented Jan 16, 2019

Hi jalan,

I have same issue in pdftotext version 2.1.1 in MacOS when install from pip: pip install pdftotext.

Collecting pdftotext
Using cached https://files.pythonhosted.org/packages/21/35/60094dbadd9de2035873390b1cac25e01da605844eba6a07a53a82fa4adc/pdftotext-2.1.1.tar.gz
Building wheels for collected packages: pdftotext
Running setup.py bdist_wheel for pdftotext ... error
Complete output from command /Users/thesunkid/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-install-b1ig7hrs/pdftotext/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/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-wheel-9fekba4s --python-tag cp36:
/Users/thesunkid/anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running bdist_wheel
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.macosx-10.7-x86_64-3.6
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/thesunkid/anaconda3/include -arch x86_64 -I/Users/thesunkid/anaconda3/include -arch x86_64 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/Users/thesunkid/anaconda3/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -Wall -mmacosx-version-min=10.9
In file included from pdftotext.cpp:5:
/usr/local/include/poppler/cpp/poppler-page.h:39:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
text_box(text_box&&);
^
/usr/local/include/poppler/cpp/poppler-page.h:40:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
text_box& operator=(text_box&&);
^
2 warnings generated.
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/Users/thesunkid/anaconda3/lib -arch x86_64 -L/Users/thesunkid/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -lpoppler-cpp -o build/lib.macosx-10.7-x86_64-3.6/pdftotext.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1

Failed building wheel for pdftotext
Running setup.py clean for pdftotext
Failed to build pdftotext
Installing collected packages: pdftotext
Running setup.py install for pdftotext ... error
Complete output from command /Users/thesunkid/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-install-b1ig7hrs/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-record-0e3hxpvj/install-record.txt --single-version-externally-managed --compile:
/Users/thesunkid/anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.macosx-10.7-x86_64-3.6
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/thesunkid/anaconda3/include -arch x86_64 -I/Users/thesunkid/anaconda3/include -arch x86_64 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/Users/thesunkid/anaconda3/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -Wall -mmacosx-version-min=10.9
In file included from pdftotext.cpp:5:
/usr/local/include/poppler/cpp/poppler-page.h:39:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
text_box(text_box&&);
^
/usr/local/include/poppler/cpp/poppler-page.h:40:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
text_box& operator=(text_box&&);
^
2 warnings generated.
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/Users/thesunkid/anaconda3/lib -arch x86_64 -L/Users/thesunkid/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -lpoppler-cpp -o build/lib.macosx-10.7-x86_64-3.6/pdftotext.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1

Command "/Users/thesunkid/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-install-b1ig7hrs/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-record-0e3hxpvj/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0h/fhqgpcw54h14k55y7wz6yyvr0000gn/T/pip-install-b1ig7hrs/pdftotext/

I've tried several times but it still doesn't work. Can you make any suggestion?

@GD-A-150800
Copy link

GD-A-150800 commented Feb 18, 2019

I am not able to install libpoppler-cpp-dev in anaconda environment on windows.
What should i do?
I get this message:
conda install libpoppler-cpp-dev
Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • libpoppler-cpp-dev

Current channels:

To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

@jalan
Copy link
Owner

jalan commented Feb 18, 2019

@GD-A-150800 Please don't post new unrelated questions on a closed issue.

I'm sorry to say that there is no support for Windows. The relevant issue in this case is #16.

@YuhangTsim
Copy link

output.log
/usr/local/opt/poppler/include/poppler/cpp/poppler-page.h:39:22: error: expected ‘,’ or ‘...’ before ‘&&’ token
text_box(text_box&&);
^
/usr/local/opt/poppler/include/poppler/cpp/poppler-page.h:39:24: error: invalid constructor; you probably meant ‘poppler::text_box (const poppler::text_box&)’
text_box(text_box&&);
^
/usr/local/opt/poppler/include/poppler/cpp/poppler-page.h:40:33: error: expected ‘,’ or ‘...’ before ‘&&’ token
text_box& operator=(text_box&&);
^
/usr/local/opt/poppler/include/poppler/cpp/poppler-page.h:70:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
std::unique_ptr<text_box_data> m_data;

@Ciangi
Copy link

Ciangi commented Jun 5, 2019

Collecting pdftotext
  Using cached https://files.pythonhosted.org/packages/21/35/60094dbadd9de2035873390b1cac25e01da605844eba6a07a53a82fa4adc/pdftotext-2.1.1.tar.gz
Building wheels for collected packages: pdftotext
  Building wheel for pdftotext (setup.py) ... error
  ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-O5algo/pdftotext/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 /tmp/pip-wheel-oMHm6f --python-tag cp27:
  ERROR: running bdist_wheel
  running build
  running build_ext
  building 'pdftotext' extension
  creating build
  creating build/temp.linux-x86_64-2.7
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/include/python2.7 -c pdftotext.cpp -o build/temp.linux-x86_64-2.7/pdftotext.o -Wall
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from pdftotext.cpp:5:0:
  /usr/local/include/poppler/cpp/poppler-page.h:39:22: error: expected ‘,’ or ‘...’ before ‘&&’ token
       text_box(text_box&&);
                        ^
  /usr/local/include/poppler/cpp/poppler-page.h:39:24: error: invalid constructor; you probably meant ‘poppler::text_box (const poppler::text_box&)’
       text_box(text_box&&);
                          ^
  /usr/local/include/poppler/cpp/poppler-page.h:40:33: error: expected ‘,’ or ‘...’ before ‘&&’ token
       text_box& operator=(text_box&&);
                                   ^
  /usr/local/include/poppler/cpp/poppler-page.h:70:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
       std::unique_ptr<text_box_data> m_data;
            ^
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pdftotext
  Running setup.py clean for pdftotext
Failed to build pdftotext
Installing collected packages: pdftotext
  Running setup.py install for pdftotext ... error
    ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-O5algo/pdftotext/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-TF1_ts/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_ext
    building 'pdftotext' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/include/python2.7 -c pdftotext.cpp -o build/temp.linux-x86_64-2.7/pdftotext.o -Wall
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from pdftotext.cpp:5:0:
    /usr/local/include/poppler/cpp/poppler-page.h:39:22: error: expected ‘,’ or ‘...’ before ‘&&’ token
         text_box(text_box&&);
                          ^
    /usr/local/include/poppler/cpp/poppler-page.h:39:24: error: invalid constructor; you probably meant ‘poppler::text_box (const poppler::text_box&)’
         text_box(text_box&&);
                            ^
    /usr/local/include/poppler/cpp/poppler-page.h:40:33: error: expected ‘,’ or ‘...’ before ‘&&’ token
         text_box& operator=(text_box&&);
                                     ^
    /usr/local/include/poppler/cpp/poppler-page.h:70:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
         std::unique_ptr<text_box_data> m_data;
              ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-O5algo/pdftotext/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-TF1_ts/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-O5algo/pdftotext/

@jalan
Copy link
Owner

jalan commented Jun 5, 2019

@Ciangi what system are you building on?

@Ciangi
Copy link

Ciangi commented Jun 5, 2019

Ubuntu 16.04
python2.7

@jalan
Copy link
Owner

jalan commented Jun 5, 2019

I just booted into a fresh Ubuntu 16.04 machine and it installed just fine.

Your system looks fishy. Poppler headers on Ubuntu are usually in /usr/include, not /usr/local/include. Did you manually install poppler instead of using the one provided by Ubuntu?

@Ciangi
Copy link

Ciangi commented Jun 5, 2019

I manually installed poppler. but i noticed that i have pdftotext installed, don't know why but it is and works ...

@owen9825
Copy link

owen9825 commented Aug 4, 2019

I ended up having to uninstall linuxbrew. I started suspecting this to be the issue after seeing that the the header was in the linuxbrew path:

/home/linuxbrew/.linuxbrew/include/poppler/cpp/poppler-page.h:38:15: error: does not match expected signature 'poppler::text_box& poppler::text_box::operator=(poppler::text_box&)'
error: command 'gcc' failed with exit status 1
----------------------------------------

@nazreen
Copy link

nazreen commented Dec 19, 2019

I'm using this in a Dockerized environment and simply doing apt-get install libpoppler-cpp-dev did it for me
thanks @jalan !

@DarpanDRaj
Copy link

I'm using this in a Dockerized environment and simply doing apt-get install libpoppler-cpp-dev did it for me
thanks @jalan !

This is the proper one for ubuntu users using python3

@akhidwivedi
Copy link

what to be done if same issues are appearing in windows????

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