mirage/mirage-tcpip

Missing requires in META file?

talex5 opened this issue · 5 comments

I was getting this stange error:

       In module TCPV4:
       Type declarations do not match:
         type error = TCPV4.error
       is not included in
         type error = private [> Mirage_protocols.Tcp.error ]   

when doing just
module Sock : Mirage_stack_lwt.V4 = Tcpip_stack_socket

Trying in utop I found I couldn't load the stack-socket library directly unless I first loaded some other libraries:

utop # #load "/Users/tal/.opam/4.04.0+afl/lib/io-page-unix/io_page_unix.cma";;
utop # #require "tcpip.stack-socket";;
Error: Reference to undefined global `Udpv4_socket'
utop # #require "tcpip.udpv4-socket";;
utop # #require "tcpip.stack-socket";;
Error: Reference to undefined global `Tcpv4_socket'
utop # #require "tcpip.tcpv4-socket";;
utop # #require "tcpip.stack-socket";;

Adding manual dependencies on tcpip.tcpv4-socket and tcpip.udpv4-socket allowed my code to compile.

(the #load is for mirage/io-page#50)

Also, when linking with jbuilder I had to specify the libraries in the correct order (tcpip.tcpv4-socket tcpip.udpv4-socket tcpip.unix tcpip.stack-socket). If I put tcpip.stack-socket first, it failed to link with:

Error: Required module `Tcpv4_socket' is unavailable

Test case:

test.ml:

let x = Tcpip_stack_socket.disconnect

jbuild:

(jbuild_version 1)

(executable (
  (name test)
  (libraries (tcpip.stack-socket))
))

(tested with docker run --rm -it ocaml/opam:debian-9_ocaml-4.04.0)

$ opam install tcpip jbuilder
$ jbuilder build --dev test.exe
Error: No implementations provided for the following modules:
         Udpv4_socket referenced from /home/opam/.opam/4.04.0/lib/tcpip/stack-socket/tcpip_stack_socket.cmxa(Tcpip_stack_socket)
         Tcpv4_socket referenced from /home/opam/.opam/4.04.0/lib/tcpip/stack-socket/tcpip_stack_socket.cmxa(Tcpip_stack_socket)
o

Belated thanks for the report and the test cases; I agree that this is annoying and we should fix it.

Trying to load tcpip.stack-socket in utop now appears to work as expected, so closing as "works for me" - please feel free to reopen if I've misunderstood or this still seems broken.