andreas / ocaml-graphql-server

GraphQL servers in OCaml
MIT License
624 stars 60 forks source link

Websocket conflict #203

Closed EmileTrotignon closed 2 years ago

EmileTrotignon commented 3 years ago

I was trying to use Disml with Irmin. Irmin depends on graphql. I cannot link my executable because Disml depends on websocket, and graphql also defines a websocket module. This results in a linking error :

/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)

It should be quite simple to fix, just renaming the Websocket module should do the trick.

EmileTrotignon commented 3 years ago

I have experimented myself, and renaming the websocket module in graphql-cohttp indeed does the trick. Its very easy and fast to do.