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

Compiler libs should not be linked when using ppx #161

Open
benedictleejh opened this issue Nov 30, 2016 · 1 comment
Open

Compiler libs should not be linked when using ppx #161

benedictleejh opened this issue Nov 30, 2016 · 1 comment
Labels

Comments

@benedictleejh
Copy link

benedictleejh commented Nov 30, 2016

As far as I understand from https://whitequark.org/blog/2014/04/16/a-guide-to-extension-points-in-ocaml/ and https://blogs.janestreet.com/extension-points-or-how-ocaml-is-becoming-more-like-lisp/, ppx is a pre-processing step in the compilation process. As such, once pre-processing is complete, the ppx libraries should no longer be needed.

However, obuild attempts to link in the ppx library and their dependencies into the final product. This should be unnecessary.

Edit:
I've created a repo that shows the problem: https://github.com/benedictleejh/obuild-issue-161

If you compile using ocamlbuild (ocamlbuild -use-ocamlfind calc.{byte|native}) everything works out fine. But compiling with obuild causes it to throw the error:

File "_none_", line 1:
Error: Files dist/build/calc/Parser.cmx
       and ~/.opam/4.02.3/lib/ocaml/compiler-libs/ocamlcommon.cmxa
       both define a module named Parser

Which shows it attempting to link the compiler-libs into the final compilation product.

@jeromemaloberti
Copy link
Contributor

Thank you, I will investigate.
From a first look, though, obuild doesn't link with compiler-libs, it adds the directory to -I, so the linker is confused by your Parser and the one already there.
compiler-libs is a dependency of ppx_tools, that is a dependency of ppx_conv.
So, I need to understand how ocamlfind (through ocamlbuild) deals with that.

@UnixJunkie UnixJunkie added the bug label Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants