Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with sexplib/ppx_sexp_conv v0.11.0 #143

Closed
copy opened this issue Mar 22, 2018 · 18 comments · Fixed by ocaml/opam-repository#12062
Closed

Incompatible with sexplib/ppx_sexp_conv v0.11.0 #143

copy opened this issue Mar 22, 2018 · 18 comments · Fixed by ocaml/opam-repository#12062

Comments

@copy
Copy link

copy commented Mar 22, 2018

After upgrading sexplib and ppx_sexp_conv to v0.11.0 the following error appears when compiling nocrypto:

Error: The implementation (obtained by packing)
       does not match the interface src/nocrypto.mli:
       ...
       In module Hash:
       Values do not match:
         val hash_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> hash
       is not included in
         val hash_of_sexp : Sexplib.Sexp.t -> hash
       File "src/nocrypto.mli", line 217, characters 2-43:
         Expected declaration
       File "src/hash.ml", line 114, characters 0-86: Actual declaration
@gasche
Copy link

gasche commented Mar 26, 2018

I just noticed the same error and reported a bug upstream at ppx_sexp_conv: janestreet/ppx_sexp_conv#20 .

@hannesm
Copy link
Member

hannesm commented Mar 26, 2018

FWIW: diml has an explanation for this in ocaml/opam-repository#11628 (comment)

I've "fixed" this issue in ocaml/opam-repository#11636 by adding an upper bound of sexplib (<"v0.11.0") to nocrypto releases. of course a proper fix and a release of nocrypto would be welcome.

@gasche
Copy link

gasche commented Mar 26, 2018

Of course my curiosity was piqued as it revealed to be a build system issue. I have two bugfix branches, master-ocamlbuild-pack and v0.5.4-ocamlbuild-pack.

@hannesm: if you know how to get one of these in an OPAM-available release of nocrypto, that could be nice (the v0.5.4 branch would be suitable for a patch/-level fix, but I understand that we are not excited with opam-level patching anymore). I will get the ocamlbuild-side issue fixed, but an ocamlbuild update will not fix the nocrypto build, it still needs a change to the _tags file.

@hcarty
Copy link

hcarty commented Apr 11, 2018

Would a patch/-level fix be acceptable for now? This unfortunately prevents packages like tls from being installable alongside the master branch of ocamlformat, for example.

@gasche
Copy link

gasche commented Apr 11, 2018

@hcarty: yes, that seems acceptable to me given nocrypto's release management style. Would you be willing to submit a PR to opam-repository?

@hannesm
Copy link
Member

hannesm commented Apr 11, 2018

(no, I'm neither author nor maintainer of nocrypto) tbh, I'm really against depending on the ppx machinery at runtime, since this will increase the binary size of all my unikernels tremendously. in the past I've been removing runtime dependencies of various ppx in the MirageOS ecosystem. I'm not sure how to move forward, to me it looks like getting rid of ppx_sexp_conv entirely is the only viable solution.

@gasche
Copy link

gasche commented Apr 11, 2018

If you already depend on Base, there is no additional size cost. If you don't, then yes, you may want to use a serializer/deserializer that comes with smaller runtime dependencies (it may be possible to have something that is drop-in compatible with with sexp but with a smaller runtime).

@hannesm
Copy link
Member

hannesm commented Apr 11, 2018

Dear @gasche, there is no dependency on base in the MirageOS ecosystem (sexplib 0.9.0 required base, which increased the binary size by 5MB of every unikernel, which was fixed by the sexplib maintainers).

@gasche
Copy link

gasche commented Apr 11, 2018

Well I guess that you should complain to the sexplib maintainers again, as I suppose that they have some control over how ppx_sexplib sets its runtime dependencies -- it should be possible to only depend on sexplib.

@gasche
Copy link

gasche commented Apr 11, 2018

cc @trefis :-)

@ansiwen
Copy link

ansiwen commented Apr 11, 2018

I want to mention that my project uses the serializers, so please don’t remove them without replacement. Isn’t it possible to put them in a separate package, so they are only added if used?

Anyway I don’t understand, why the linker can’t remove unused code?

@gasche
Copy link

gasche commented Apr 11, 2018

The linker can remove unused compilation units (toplevel modules), but doesn't go at a finer-grained level, and it is easy to have (unused) definitions in your (used) module pull out extra undesirable dependency. A global tree-shaker / dead code remover link-time pass could be implemented in theory (and is an interesting subject, particularly for unikernels), but it is difficult (in theory and in practice) due the presence of side-effect-performing expressions at the toplevel of modules (can those initializing an otherwise-unused datastructure be also removed, or is their effect observable by other parts of the codebase?).

@ansiwen
Copy link

ansiwen commented Apr 11, 2018

Interesting. I was totally depending on the linker when I wrote C++ code for an embedded linux platform, and with statically linked libraries that worked very well. I though a decision, if a certain code-path is referenced somewhere in the binary, and if not to cut it out, would be similarly easy in ocaml. (Initialization code which is called can't of course just cut out without more sophisticated analysis.)

@hcarty
Copy link

hcarty commented Apr 16, 2018

@gasche Based on a simple local test, I still get the original build issue reported by @copy with your patch against 0.5.4. Sadly I can't spend more time on this currently.

@cfcs
Copy link

cfcs commented Apr 30, 2018

Has anyone pinged @pqwy about this? I don't know how to contact him now that he also stopped responding to emails, but this is an annoying issue to have to work around.

@j0sh
Copy link

j0sh commented May 20, 2018

As far as I can tell, we can't use nocrypto along with a ppxlib driven rewriter. The alternative is using the deprecated ppx_type_conv for rewriters. Would really appreciate a long-term fix here.

@copy
Copy link
Author

copy commented Jun 25, 2018

This has been fixed using opam patches in ocaml/opam-repository#12062 and released as nocrypto 0.5.4-1.

Will leave this issue open for a fix in this repository.

@cfcs
Copy link

cfcs commented Feb 5, 2019

should be fixed in latest master: a58c653

@copy copy closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

7 participants