Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install lxml on Centos 7 - error: command 'gcc' failed with exit status 4

I'm using python 3.4 in a virtual environment:

(af)[root@domain backend]# pip --version
pip 7.1.0 from /home/af/af-stage/backend/.ves/af/lib/python3.4/site-packages (python 3.4)

Installation of lxml failed "error: command 'gcc' failed with exit status 4":

(af)[root@domain backend]# pip install lxml
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting lxml
  Using cached lxml-3.5.0.tar.gz
Building wheels for collected packages: lxml
  Running setup.py bdist_wheel for lxml
  Complete output from command /home/af/af-stage/backend/.ves/af/bin/python3.4 -c "import setuptools;__file__='/tmp/pip-build-tlogtyk2/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpod9hcw0ypip-wheel-:
  Building lxml version 3.5.0.
  Building without Cython.
  Using build configuration of libxslt 1.1.28
  Building against libxml2/libxslt in the following directory: /usr/lib64
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.4
  creating build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/__init__.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/builder.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/sax.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/cssselect.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-3.4/lxml
  creating build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.linux-x86_64-3.4/lxml/includes
  creating build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/builder.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/diff.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/defs.py -> build/lib.linux-x86_64-3.4/lxml/html
  copying src/lxml/html/clean.py -> build/lib.linux-x86_64-3.4/lxml/html
  creating build/lib.linux-x86_64-3.4/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.linux-x86_64-3.4/lxml/isoschematron
  copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-3.4/lxml
  copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/schematron.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/c14n.pxd -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.4/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.linux-x86_64-3.4/lxml/includes
  creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources
  creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng
  creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl
  creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.linux-x86_64-3.4
  creating build/temp.linux-x86_64-3.4/src
  creating build/temp.linux-x86_64-3.4/src/lxml
  gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
  {standard input}: Assembler messages:
  {standard input}:1531298: Error: unknown pseudo-op: `.uleb'
  gcc: internal compiler error: Killed (program cc1)
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <http://bugzilla.redhat.com/bugzilla> for instructions.
  Compile failed: command 'gcc' failed with exit status 4
  creating tmp
  cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitpm92p5c8.c -o tmp/xmlXPathInitpm92p5c8.o
  cc tmp/xmlXPathInitpm92p5c8.o -L/usr/lib64 -lxml2 -o a.out
  error: command 'gcc' failed with exit status 4

  ----------------------------------------
  Failed building wheel for lxml
Failed to build lxml
Installing collected packages: lxml
  Running setup.py install for lxml
    Complete output from command /home/af/af-stage/backend/.ves/af/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-tlogtyk2/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-99hwjy1o-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/af/af-stage/backend/.ves/af/include/site/python3.4/lxml:
    Building lxml version 3.5.0.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    Building against libxml2/libxslt in the following directory: /usr/lib64
    running install
    running build
    running build_py
    copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.4/lxml/includes
    running build_ext
    building 'lxml.etree' extension
    gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
    {standard input}: Assembler messages:
    {standard input}:1320351: Error: unknown pseudo-op: `.uleb1'
    gcc: internal compiler error: Killed (program cc1)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    Compile failed: command 'gcc' failed with exit status 4
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInit3tj66iu0.c -o tmp/xmlXPathInit3tj66iu0.o
    cc tmp/xmlXPathInit3tj66iu0.o -L/usr/lib64 -lxml2 -o a.out
    error: command 'gcc' failed with exit status 4

    ----------------------------------------
Command "/home/af/af-stage/backend/.ves/af/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-tlogtyk2/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-99hwjy1o-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/af/af-stage/backend/.ves/af/include/site/python3.4/lxml" failed with error code 1 in /tmp/pip-build-tlogtyk2/lxml

Notes:
I've already done yum install libxslt-devel libxml2-devel

like image 376
ericn Avatar asked Jan 16 '16 10:01

ericn


2 Answers

You just need to use yum install python-lxml. Of course, lxml module depend on libxml2 libxslt libxml2-devel libxslt-devel.

like image 59
user2189897 Avatar answered Oct 29 '22 16:10

user2189897


This worked for me: yum install -y libxml2 libxml2-devel libxslt libxslt-devel

like image 2
Andrea Bergonzo Avatar answered Oct 29 '22 17:10

Andrea Bergonzo