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.native-toplevel fix #4249

Merged
4 commits merged into from
Feb 24, 2021
Merged

compiler-libs.native-toplevel fix #4249

4 commits merged into from
Feb 24, 2021

Conversation

nojb
Copy link
Collaborator

@nojb nojb commented Feb 17, 2021

Fixes #4248

Since Native-toplevel is not a valid module name, I had to change Module.of_string to Module.of_string_allow_invalid, but perhaps there is a better way?

nojb added 2 commits February 17, 2021 16:06
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
@nojb nojb changed the title Native toplevel fix compiler-libs.native-toplevel fix Feb 17, 2021
@ghost
Copy link

ghost commented Feb 17, 2021

This value seems to be generated in meta.ml (in the main_modules function). Maybe we could generate a different value there?

BTW, I'm confused as to what this code in meta.ml does. For the builtin meta, we are supposed to generate the same thing as the META files distributed by findlib. @rgrinberg do you know what's going on there?

@rgrinberg
Copy link
Member

BTW, I'm confused as to what this code in meta.ml does. For the builtin meta, we are supposed to generate the same thing as the META files distributed by findlib. @rgrinberg do you know what's going on there?

It's to support root_module for libraries that aren't define with dune. We "guess" the list of toplevel modules from the list of cmi's for such libraries. This is useful for libraries such as Unix for example.

Since Native-toplevel is not a valid module name, I had to change Module.of_string to Module.of_string_allow_invalid, but perhaps there is a better way?

I suppose we could just hard code it to the empty list for some libs.

@ghost
Copy link

ghost commented Feb 18, 2021

What I'm thinking is the following: when findlib is installed, we don't use our builtin META files. Instead we use the ones installed by findlib and these don't have a main_modules field. What happens in this case?

_
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost
Copy link

ghost commented Feb 24, 2021

We hit this issue while testing at Jane Street as well. I added a String.map ~f:(function '-' -> '_' | c -> c_) where we generated the offending main_modules field instead of allowing invalid module names.

I'm still curious as to why our builtin meta files are not the same as the one embed in findlib. This feels like a recipe for troubles.

@ghost ghost merged commit a22fe43 into ocaml:main Feb 24, 2021
@nojb nojb deleted the native-toplevel-fix branch February 24, 2021 10:59
@nojb
Copy link
Collaborator Author

nojb commented Feb 24, 2021

We hit this issue while testing at Jane Street as well. I added a String.map ~f:(function '-' -> '_' | c -> c_) where we generated the offending main_modules field instead of allowing invalid module names.

Thanks!

rgrinberg pushed a commit that referenced this pull request Mar 8, 2021
- compiler-libs.{toplevel => native-toplevel}
- make sure to generate main_modules field with valid module names for builtin meta files

Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Mar 8, 2021
…ne-action-plugin, dune-private-libs and dune-glob (2.8.4)

CHANGES:

- Fix crash when META file for `compiler-libs.toplevel` is present
  (@jeremiedimino, ocaml/dune#4249)
@rgrinberg rgrinberg added this to the 2.8.4 milestone Mar 29, 2021
This pull request was closed.
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

Successfully merging this pull request may close these issues.

Crash when ocamlfind not installed because of duplicate compiler-libs.toplevel META
3 participants