Using Disml with Irmin

I am programming a little discord bot with Disml.
What I want to do is quite simple, but it still requires a database. I was thinking of trying to use Irmin as a database, but I cannot manage to build a project with both irmin-unix and disml linked.
The error I get is a linking error. There is a lot of text detailing which symbols are at fault and then :

collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

A minimal example of this error can be found here : GitHub - EmileTrotignon/disml_irmin

I understand that it may not be possible to solve this issue, and maybe I should just use another database lib, but Irmin looks really nice. Any help appreciated !

You would need to post the complete error message to be able to (perhaps) suggest a solution.

Cheers,
Nicolas

I thought it was a little long, but here you go :

/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__data_begin':
:(.data+0x0): multiple definition of `camlWebsocket__data_begin'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.data+0x0): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__fun_2509':
:(.text+0x0): multiple definition of `camlWebsocket__code_begin'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.text+0x0): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__fun_3261':
/home/emile/.opam/4.12.0/.opam-switch/build/websocket.2.14/_build/default/core/websocket.ml:292: multiple definition of `camlWebsocket__fun_3261'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o):/home/emile/.opam/4.12.0/.opam-switch/build/graphql-cohttp.0.13.0/_build/default/graphql-cohttp/src/websocket.ml:120: first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket':
:(.data+0x3c0): multiple definition of `camlWebsocket'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.data+0x2b0): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__gc_roots':
:(.data+0x488): multiple definition of `camlWebsocket__gc_roots'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.data+0x360): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__entry':
/home/emile/.opam/4.12.0/.opam-switch/build/websocket.2.14/_build/default/core/websocket.ml:378: multiple definition of `camlWebsocket__entry'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o):/home/emile/.opam/4.12.0/.opam-switch/build/graphql-cohttp.0.13.0/_build/default/graphql-cohttp/src/websocket.ml:357: first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__code_end':
:(.text+0x28d9): multiple definition of `camlWebsocket__code_end'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.text+0x272c): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__data_end':
:(.data+0x8e8): multiple definition of `camlWebsocket__data_end'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.data+0x888): first defined here
/usr/bin/ld: /home/emile/.opam/4.12.0/lib/websocket/websocket.a(websocket.o): in function `camlWebsocket__frametable':
:(.data+0x8f0): multiple definition of `camlWebsocket__frametable'; /home/emile/.opam/4.12.0/lib/graphql-cohttp/graphql_cohttp.a(websocket.o)::(.data+0x890): first defined here
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

The websocket and graphql-cohttp libraries both define a Websocket module, so you can’t link them together.

Irmin depends on graphql-cohttp, and disml depends on websocket.

You could report an issue on graphql’s tracker, they might have some ideas on how to work around that.

Thanks ! I might do so then. Or maybe I will just do two executables with pipes.
However, I think there should be a nicer error message in such cases. Is that in the realm of possibility ?

Please do so. Otherwise these things will never be fixed. It seems that graphql-cohttp vendored websockets, so either the vendoring should be undone or graphql-cohttp should rename its vendored compilation units.

1 Like