pcapy-ng icon indicating copy to clipboard operation
pcapy-ng copied to clipboard

pip install pcapy-ng fails

Open GhostDog98 opened this issue 3 years ago • 0 comments

When running sudo python3 -m pip install pcapy-ng, installation fails with the following error:

Collecting pcapy-ng
  Downloading pcapy-ng-1.0.9.tar.gz (38 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pcapy-ng
  Building wheel for pcapy-ng (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating build
      creating build/temp.linux-x86_64-3.9
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c bpfobj.cc -o build/temp.linux-x86_64-3.9/bpfobj.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcap_pkthdr.cc -o build/temp.linux-x86_64-3.9/pcap_pkthdr.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapdumper.cc -o build/temp.linux-x86_64-3.9/pcapdumper.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapobj.cc -o build/temp.linux-x86_64-3.9/pcapobj.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapy.cc -o build/temp.linux-x86_64-3.9/pcapy.o
      pcapy.cc: In function ‘PyObject* lookupdev(PyObject*, PyObject*)’:
      pcapy.cc:37:23: warning: ‘char* pcap_lookupdev(char*)’ is deprecated: use 'pcap_findalldevs' and use the first device [-Wdeprecated-declarations]
         37 |   dev = pcap_lookupdev(errbuff);
            |         ~~~~~~~~~~~~~~^~~~~~~~~
      In file included from /usr/include/pcap.h:43,
                       from pcapy.cc:12:
      /usr/include/pcap/pcap.h:394:18: note: declared here
        394 | PCAP_API char   *pcap_lookupdev(char *)
            |                  ^~~~~~~~~~~~~~
      creating build/lib.linux-x86_64-3.9
      g++ -pthread -B /home/ghostdog/anaconda3/compiler_compat -shared -Wl,-rpath,/home/ghostdog/anaconda3/lib -Wl,-rpath-link,/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib -Wl,-rpath,/home/ghostdog/anaconda3/lib -Wl,-rpath-link,/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib build/temp.linux-x86_64-3.9/bpfobj.o build/temp.linux-x86_64-3.9/pcap_pkthdr.o build/temp.linux-x86_64-3.9/pcapdumper.o build/temp.linux-x86_64-3.9/pcapobj.o build/temp.linux-x86_64-3.9/pcapy.o -lpcap -o build/lib.linux-x86_64-3.9/pcapy.cpython-39-x86_64-linux-gnu.so
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libm.so.6: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libm.so.6 when searching for /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: cannot find /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libm.so.6: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libm.so.6 when searching for /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libmvec.so.1: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libmvec.so.1 when searching for /usr/lib/libmvec.so.1
      /home/ghostdog/anaconda3/compiler_compat/ld: cannot find /usr/lib/libmvec.so.1
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libmvec.so.1: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libmvec.so.1 when searching for /usr/lib/libmvec.so.1
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/g++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pcapy-ng
  Running setup.py clean for pcapy-ng
Failed to build pcapy-ng
Installing collected packages: pcapy-ng
  Running setup.py install for pcapy-ng ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pcapy-ng did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      running install
      /home/ghostdog/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      creating build
      creating build/temp.linux-x86_64-3.9
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c bpfobj.cc -o build/temp.linux-x86_64-3.9/bpfobj.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcap_pkthdr.cc -o build/temp.linux-x86_64-3.9/pcap_pkthdr.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapdumper.cc -o build/temp.linux-x86_64-3.9/pcapdumper.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapobj.cc -o build/temp.linux-x86_64-3.9/pcapobj.o
      gcc -pthread -B /home/ghostdog/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -I/home/ghostdog/anaconda3/include -fPIC -O2 -isystem /home/ghostdog/anaconda3/include -fPIC -I/home/ghostdog/anaconda3/include/python3.9 -c pcapy.cc -o build/temp.linux-x86_64-3.9/pcapy.o
      pcapy.cc: In function ‘PyObject* lookupdev(PyObject*, PyObject*)’:
      pcapy.cc:37:23: warning: ‘char* pcap_lookupdev(char*)’ is deprecated: use 'pcap_findalldevs' and use the first device [-Wdeprecated-declarations]
         37 |   dev = pcap_lookupdev(errbuff);
            |         ~~~~~~~~~~~~~~^~~~~~~~~
      In file included from /usr/include/pcap.h:43,
                       from pcapy.cc:12:
      /usr/include/pcap/pcap.h:394:18: note: declared here
        394 | PCAP_API char   *pcap_lookupdev(char *)
            |                  ^~~~~~~~~~~~~~
      creating build/lib.linux-x86_64-3.9
      g++ -pthread -B /home/ghostdog/anaconda3/compiler_compat -shared -Wl,-rpath,/home/ghostdog/anaconda3/lib -Wl,-rpath-link,/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib -Wl,-rpath,/home/ghostdog/anaconda3/lib -Wl,-rpath-link,/home/ghostdog/anaconda3/lib -L/home/ghostdog/anaconda3/lib build/temp.linux-x86_64-3.9/bpfobj.o build/temp.linux-x86_64-3.9/pcap_pkthdr.o build/temp.linux-x86_64-3.9/pcapdumper.o build/temp.linux-x86_64-3.9/pcapobj.o build/temp.linux-x86_64-3.9/pcapy.o -lpcap -o build/lib.linux-x86_64-3.9/pcapy.cpython-39-x86_64-linux-gnu.so
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libm.so.6: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libm.so.6 when searching for /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: cannot find /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libm.so.6: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libm.so.6 when searching for /usr/lib/libm.so.6
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libmvec.so.1: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libmvec.so.1 when searching for /usr/lib/libmvec.so.1
      /home/ghostdog/anaconda3/compiler_compat/ld: cannot find /usr/lib/libmvec.so.1
      /home/ghostdog/anaconda3/compiler_compat/ld: /usr/lib/libmvec.so.1: unknown type [0x13] section `.relr.dyn'
      /home/ghostdog/anaconda3/compiler_compat/ld: skipping incompatible /usr/lib/libmvec.so.1 when searching for /usr/lib/libmvec.so.1
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/g++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pcapy-ng

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

This is also true if I manually clone the repo and run python3 setup.py install. It also fails if I run python3 setup.py install_lib, with the same error of failing to find a compatible version of libm/libmvec.

Running file /usr/lib/libm.so.6 returns /usr/lib/libm.so.6: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=2c8ff1d29b255da5b7371efd5caf57444d622838, for GNU/Linux 4.4.0, stripped

What do I do at this stage?

GhostDog98 avatar Sep 27 '22 22:09 GhostDog98