-1

I'm trying to run a rust program that I've been using on Ubuntu on an AlmaLinux distro.

It utilizes the pcap crate, which is installed.

When I try to compile the application, I'm getting a

/user/bin/ld: cannot find -lpcap
    collect2: error: ld returned 1 exit status

My initial thought was that libpcap was not installed on this machine, but in fact, it is. I've uninstalled and reinstalled it just in case there was something wrong with the initial install.

Any ideas on what could be wrong?

PilotGuy
  • 41
  • 1
  • 6
  • Can you locate the pcap DLL (s) and copy it/them to the same folder your app's binaries reside in? Or to the root folder of your project may enable the linking step of the build. – Todd Jan 06 '23 at 20:51
  • @Stargateur I did not. That package isn't available through "dnf install libpcap-devel". – PilotGuy Jan 06 '23 at 21:27

1 Answers1

1

You need to install pcap with lib and header, on AlmaLinux this mean devel package. You can use https://pkgs.org/search/?q=pcap to search what packet you need to install, on your case probably https://almalinux.pkgs.org/9/almalinux-crb-x86_64/libpcap-devel-1.10.0-4.el9.i686.rpm.html. This package require you activate CRB repository, see doc https://wiki.almalinux.org/repos/AlmaLinux.html.

dnf config-manager --set-enabled crb
dnf install libpcap-devel
Stargateur
  • 24,473
  • 8
  • 65
  • 91
  • That worked perfectly. I'm fairly new to linux so I'm still learning my way around. Thank you for the pointers. This will probably help me in other places, too. – PilotGuy Jan 06 '23 at 21:57
  • "I'm fairly new to linux so I'm still learning my way around. ... This will probably help me in other places, too." Yes. On *most* Linuxes, not just on AlmaLinux, if you're building a program that uses a library - not just libpcap, *any* library - you will need to install a developer package for the library. Most Linux distributions have, for a library, separate packages to install shared libraries for programs that use that library and to install headers (and, usually, a static library) for people trying to compile programs that use that library. – user16139739 Feb 28 '23 at 07:41