Compile issue

Help
Brian
2007-10-01
2013-05-09
  • Brian
    Brian
    2007-10-01

    Hi, Can anyone tell me why I am getting the error below? Where do I find constants.c?
    Thanks,
    Brian

    [root@dyn-160-39-254-43 pylibpcap-0.6.1]# python setup.py build
    running build
    running build_ext
    building '_pcapmodule' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -DSWIG_COBJECT_TYPES -I/usr/include/python2.5 -c pcap.c -o build/temp.linux-i686-2.5/pcap.o
    pcap.c:2522:23: error: constants.c: No such file or directory
    pcap.c: In function ‘init_pcap’:
    pcap.c:4245: error: ‘pcapmodule_DLT’ undeclared (first use in this function)
    pcap.c:4245: error: (Each undeclared identifier is reported only once
    pcap.c:4245: error: for each function it appears in.)
    error: command 'gcc' failed with exit status 1

     
    • Wim Lewis
      Wim Lewis
      2007-10-02

      constants.c should be autogenerated by the build script. If you run the mk-constants.py script it'll write out constants.c in the current directory, but I'm not sure why this isn't happening automatically...

       
    • Jeff
      Jeff
      2007-11-22

      hi
      I hit the same problem as Brian above - seems the 0.6.1 tarball is missing mk-constants.py script all together (and once it's there, it is not run by setup.py either).

      So when i add it (from the 0.5.1 tarball) now i get swig errors, can anyone help i would appreciate it - i am rapidly thinking that getting basic pcap up and running on python has taken me longer than doing it in C !

      python 2.5, linux FC5 i686

      [root@wcary6af pylibpcap-0.6.1]# python mk-constants.py
      [root@wcary6af pylibpcap-0.6.1]# ./setup.py build
      running build
      running build_ext
      building '_pcapmodule' extension
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_COBJECT_TYPES -I/usr/local/include/python2.5 -c pcap.c -o build/temp.linux-i686-2.5/pcap.o
      In file included from pcap.c:2522:
      constants.c:8: error: ‘SWIG_PY_INT’ undeclared here (not in a function)
      pcap.c: In function ‘init_pcap’:
      pcap.c:4246: error: ‘struct swig_const_info’ has no member named ‘value’
      pcap.c:4246: warning: passing argument 1 of ‘PyInt_FromLong’ makes integer from pointer without a cast
      error: command 'gcc' failed with exit status 1
      [root@wcary6af pylibpcap-0.6.1]#

      thanks
      -jeff