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

META template and Melange #284

Open
jchavarri opened this issue Apr 26, 2024 · 4 comments
Open

META template and Melange #284

jchavarri opened this issue Apr 26, 2024 · 4 comments

Comments

@jchavarri
Copy link

Hi, I am trying to make ppx_deriving compatible with Melange. Unfortunately, Melange is not compatible with packages that have a META template, and Dune diligently makes that check when trying to build Melange packages.

When removing the META template, some packages that depend on it like bpf or nocrypto fail to build because the PPX does not kick in, so the generated functions are not there.

I wonder if there's a way to configure ppx_deriving in a way where the META template is not necessary, like other PPXs? So that Melange support can be added. I have read the Dune docs about META files but I'm still confused about why it's necessary in ppx_deriving case. Thanks!

cc @anmonteiro @rgrinberg

@jchavarri
Copy link
Author

Related PR: #170

@rgrinberg
Copy link
Contributor

I think this template shouldn't be necessary anymore. It's only needed for pre ppxlib ppx's. If anyone is using bpf and nocrypto, those projects could easily be upgraded to modern ppx's.

@anmonteiro
Copy link
Contributor

IIRC @jchavarri got an error when trying to remove the META file.

@jchavarri could you paste the error you got when you get a chance?

@jchavarri
Copy link
Author

The error happens when trying to install packages that rely on ppx_deriving. these packages won't get the generated functions (like if the ppx was not applied):

e.g.

#=== ERROR while compiling bpf.0.2 ============================================#
# path        ~/code/monorepo/_opam/.opam-switch/build/bpf.0.2
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml pkg/pkg.ml build --dev-pkg false
# exit-code   1
# env-file    ~/.opam/log/bpf-2468535-a919d3.env
# output-file ~/.opam/log/bpf-2468535-a919d3.out
### output ###
# [...]
# ocamlfind ocamlc -c -g -bin-annot -safe-string -w +a-4 -I src -o src/eBPF.cmi src/eBPF.mli
# ocamlfind ocamlopt -c -g -bin-annot -safe-string -w +a-4 -w -32 -package ppx_deriving.enum -I src -o src/eBPF.cmx src/eBPF.ml
# + ocamlfind ocamlopt -c -g -bin-annot -safe-string -w +a-4 -w -32 -package ppx_deriving.enum -I src -o src/eBPF.cmx src/eBPF.ml
# File "src/eBPF.ml", line 187, characters 13-25:
# 187 | let mode x = mode_to_enum x lsl 5
#                    ^^^^^^^^^^^^
# Error: Unbound value mode_to_enum
# Command exited with code 2.
# pkg.ml: [ERROR] cmd ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-j' '4' '-tag' 'debug'
#      '-build-dir' '_build' 'opam' 'pkg/META' 'CHANGES.md' 'README.md'
#      'src/bpf.a' 'src/bpf.cmxs' 'src/bpf.cmxa' 'src/bpf.cma' 'src/eBPF.cmx'
#      'src/eBPF.cmi' 'src/eBPF.mli']: exited with 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants