why does compiling a python extension give errors about limits.h?

Asked by Dan Connolly

I tried to install cx_Oracle without luck. (Details below). I reduced the problem to this one-line C program:

--8<--
#include <Python.h>
--8<--

compiling it gives:

--8<--
(cx-bug)connolly@pav:~/Desktop$ gcc -I/usr/include/python2.7 t.c
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/syslimits.h:7:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:34,
                 from /usr/include/python2.7/Python.h:19,
                 from t.c:1:
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory
compilation terminated.
--8<--

full cx_Oracle install problem log:

--8<--
(cx-bug)connolly@pav:~/Desktop$ ORACLE_HOME=/opt/instantclient_11_2/ pip install cx_Oracle
Downloading/unpacking cx-Oracle
  Running setup.py egg_info for package cx-Oracle

Installing collected packages: cx-Oracle
  Running setup.py install for cx-Oracle
    building 'cx_Oracle' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/opt/instantclient_11_2/sdk/include -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.1.2
    In file included from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/syslimits.h:7:0,
                     from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:34,
                     from /usr/include/python2.7/Python.h:19,
                     from cx_Oracle.c:6:
    /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/connolly/pyenv/cx-bug/bin/python -c "import setuptools;__file__='/home/connolly/pyenv/cx-bug/build/cx-Oracle/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Umtpht-record/install-record.txt --install-headers /home/connolly/pyenv/cx-bug/include/site/python2.7:
    running install

running build

running build_ext

building 'cx_Oracle' extension

creating build

creating build/temp.linux-x86_64-2.7-11g

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/opt/instantclient_11_2/sdk/include -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.1.2

In file included from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/syslimits.h:7:0,

                 from /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:34,

                 from /usr/include/python2.7/Python.h:19,

                 from cx_Oracle.c:6:

/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/connolly/pyenv/cx-bug/bin/python -c "import setuptools;__file__='/home/connolly/pyenv/cx-bug/build/cx-Oracle/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Umtpht-record/install-record.txt --install-headers /home/connolly/pyenv/cx-bug/include/site/python2.7 failed with error code 1 in /home/connolly/pyenv/cx-bug/build/cx-Oracle
Storing complete log in /home/connolly/.pip/pip.log
--8<--

some version info:

(cx-bug)connolly@pav:~/Desktop$ uname -a
Linux pav 3.5.0-34-generic #55~precise1-Ubuntu SMP Fri Jun 7 16:25:50 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

(cx-bug)connolly@pav:~/Desktop$ dpkg -l | grep python-dev
ii python-dev 2.7.3-0ubuntu2.2 header files and a static library for Python (default)

(cx-bug)connolly@pav:~/Desktop$ dpkg -l | grep linux-headers
ii linux-headers-3.2.0-41 3.2.0-41.66 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-41-generic 3.2.0-41.66 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.2.0-44 3.2.0-44.69 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-44-generic 3.2.0-44.69 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.2.0-45 3.2.0-45.70 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-45-generic 3.2.0-45.70 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.2.0-48 3.2.0-48.74 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-48-generic 3.2.0-48.74 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.2.0-49 3.2.0-49.75 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-49-generic 3.2.0-49.75 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.5.0-27 3.5.0-27.46~precise1 Header files related to Linux kernel version 3.5.0
ii linux-headers-3.5.0-27-generic 3.5.0-27.46~precise1 Linux kernel headers for version 3.5.0 on 64 bit x86 SMP
ii linux-headers-3.5.0-28 3.5.0-28.48~precise1 Header files related to Linux kernel version 3.5.0
ii linux-headers-3.5.0-28-generic 3.5.0-28.48~precise1 Linux kernel headers for version 3.5.0 on 64 bit x86 SMP
ii linux-headers-3.5.0-31 3.5.0-31.52~precise1 Header files related to Linux kernel version 3.5.0
ii linux-headers-3.5.0-31-generic 3.5.0-31.52~precise1 Linux kernel headers for version 3.5.0 on 64 bit x86 SMP
ii linux-headers-3.5.0-32 3.5.0-32.53~precise1 Header files related to Linux kernel version 3.5.0
ii linux-headers-3.5.0-32-generic 3.5.0-32.53~precise1 Linux kernel headers for version 3.5.0 on 64 bit x86 SMP
ii linux-headers-3.5.0-34 3.5.0-34.55~precise1 Header files related to Linux kernel version 3.5.0
ii linux-headers-3.5.0-34-generic 3.5.0-34.55~precise1 Linux kernel headers for version 3.5.0 on 64 bit x86 SMP
ii linux-headers-generic 3.2.0.49.59 Generic Linux kernel headers
ii linux-headers-generic-lts-quantal 3.5.0.34.41 Generic Linux kernel headers

Question information

Language:
English Edit question
Status:
Answered
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Steve Kowalik (stevenk) said :
#1

This is not the right place for that question, but it sounds like you don't have the 'linux-libc-dev' package installed.

Can you help with this problem?

Provide an answer of your own, or ask Dan Connolly for more information if necessary.

To post a message you must log in.