gcc Internal error on lxml installation CentOS

2019-05-19 04:28发布

I am having some trouble installing lxml on CentOS-6. I have tried the solutions of some similar questions like, pip install lxml error or Setup.py: install lxml with Python2.6 on CentOS but these did not work. How to install it correctly? after issuing,

pip install lxml

The log is like this,

Downloading/unpacking lxml
  Running setup.py egg_info for package lxml
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.4.0.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib64
Installing collected packages: lxml
  Running setup.py install for lxml
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.4.0.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib64
    building 'lxml.etree' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
    gcc: Internal error: Killed (program cc1)
    Please submit a full bug report.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed:
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

Building lxml version 3.4.0.

Building without Cython.

Using build configuration of libxslt 1.1.26

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-2.6/lxml/includes

running build_ext

building 'lxml.etree' extension

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w

gcc: Internal error: Killed (program cc1)

Please submit a full bug report.

See <http://bugzilla.redhat.com/bugzilla> for instructions.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
Storing complete log in /root/.pip/pip.log

Traceback in pip.log:

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 271, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 1185, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 592, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python2.6/site-packages/pip/util.py", line 662, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cAMY23-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml

I am using Python 2.6.6 on CentOS release 6.5.

1条回答
Explosion°爆炸
2楼-- · 2019-05-19 04:42

During fresh environment setups/package installation the most common issues one may face are as follows:

  1. gcc is not installed - a C compiler is needed for building Python packages as the core is C.

    $sudo yum install gcc

  2. 'error: command 'gcc' failed with exit status 1' happens when the header files (#include ) is not found i.e. the dependencies are not installed

    Solution: install the system level dependencies (development packages)

    $sudo yum install libxml2-devel libxml++-devel libxslt-devel

  3. while in your case, 'gcc: Internal error: Killed (program cc1)' can't be the above possibilities, the dependencies are there, as not some 'not found' error for any missing header files, or any other syntax level error. What has happened (probably), the gcc compiler crashed. There's a fair amount of possibility it's a memory problem i.e. low memory.

    Though you haven't mentioned whether you have setup a VM or a native installation - usually we allocate limited memory while setting up VM. If you're using VM the possible way out here is to increase the allocated memory for the CentOS VM, or free some memory by closing any unnecessary running programs and services.

P.S. I had the same problem while installing lxml, and resolved it with more memory.

查看更多
登录 后发表回答