How to install optional libev package for Lwt

I’m trying to use Lwt with the optional libev feature.
All that’s missing from my environment is the the libev library :

$ ./discover.exe -ocamlc-config ocamlc_config -lwt-config lwt_config DEBUG=y
found config var ext_obj: ...................... .o
found config var default_executable_name: ...... a.out
found config var ccomp_type: ................... cc
found config var system: ....................... macosx
found config var os_type: ...................... Unix
found config var use_libev: .................... true
testing for pkg-config: ........................ available
testing for libev: ............................. unavailable
testing for pthread: ........................... available

Some required C libraries were not found. If a C library <lib> is installed in a non-standard location, set <LIB>_CFLAGS and <LIB>_LIBS accordingly. 

So I need to install libev. I downloaded the source from http://software.schmorp.de/pkg/libev.html. I was unable to find any installation instructions in the README or in the ev.pod file, so as a random guess I tried the following : ./configure followed by ./install-sh, but I get the error message ./install-sh: no input file specified What is the role of this input file I’m supposed to provide the install script with ?

Which platform are you using ? Can’t you install libev using your package manager ?

1 Like

Looks like you are on macOS. I suggest using Homebrew (or maybe MacPorts) to install libev.

For building libev from source, it looks like they are using the standard GNU build process. So, you probably need ./configure, then make, then sudo make install. But it’s much better to use Homebrew for this.

Thanks, that solved part of my problem, but now there are many more missing packages now (see below). However, as I am not told that those packages are required this time, I presume that I may ignore them and go ahead with the installation ?

$ ./discover.exe -ocamlc-config ocamlc_config -lwt-config lwt_config DEBUG=y
found config var ext_obj: ...................... .o
found config var default_executable_name: ...... a.out
found config var ccomp_type: ................... cc
found config var system: ....................... macosx
found config var os_type: ...................... Unix
found config var use_libev: .................... true
testing for pkg-config: ........................ available
testing for libev: ............................. available
testing for pthread: ........................... available
testing for eventfd: ........................... unavailable
testing for fd passing: ........................ available
testing for sched_getcpu: ...................... unavailable
testing for affinity getting/setting: .......... unavailable
testing for credentials getting (Linux): ....... unavailable
testing for credentials getting (NetBSD): ...... unavailable
testing for credentials getting (OpenBSD): ..... unavailable
testing for credentials getting (FreeBSD): ..... unavailable
testing for credentials getting (getpeereid): .. available
testing for fdatasync: ......................... unavailable
testing for netdb_reentrant: ................... unavailable
testing for reentrant gethost*: ................ unavailable
testing for nanosecond stat support: ........... *timespec.tv_nsec
testing for BSD mincore: ....................... available

Yes, this is fine. The remaining unavailable items aren’t packages, but OS features that differ between the various Unix-like OSes. Lwt will either work around each one, or compile the corresponding Lwt API to raise Lwt_sys.Not_available. The results you are getting look normal for macOS.