-
Notifications
You must be signed in to change notification settings - Fork 412
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
Add a test about dune-sites where plugin links extra libary. #4348
Conversation
c2f5dc8
to
3bce0da
Compare
@bobot Did you manage to find some free time to look at it? diff --git a/../../../default/test/blackbox-tests/test-cases/sites.t/run.t b/test/blackbox-tests/test-cases/sites.t/run.t.corrected
index 174ce491e..c0da368a0 100644
--- a/../../../default/test/blackbox-tests/test-cases/sites.t/run.t
+++ b/test/blackbox-tests/test-cases/sites.t/run.t.corrected
@@ -1,5 +1,7 @@
$ dune build ./app.exe @install
$ dune exec ./app.exe
+ Fatal error: exception Dynlink.Error (Dynlink.Cannot_open_dll "Dynlink.Error (Dynlink.Cannot_open_dll \"Failure(\\\"/home/kakadu/.opam/4.12.0+options/lib/ocaml/unix.cmxs: undefined symbol: camlStdlib__callback__register_exception_16\\\")\")")
+ [2]
|
The problem is that a plugin depends on threads and not the main program. It is a limitation of the OCaml runtime. The only fix currently is at runtime to not try to load threads, and raise a good error instead. Sorry for the delay. |
3bce0da
to
aeb1c72
Compare
I made some modifications directly to the branch: moving the tests, adding a working version |
aeb1c72
to
4a8fd0e
Compare
Umm, does this mean that plugins are now always linked with Isn't that a problem in OCaml >= 4.08? |
Indeed I still added the |
I always get confused with the meaning of Does the use of |
To be clear, the particular case I worry about is:
Now, application |
@ejgallego I fixed a test in a manner I understood your concerns. Are you less worried now? |
Thanks a lot, it is great we are testing this case. I will have a detailed look tomorrow. |
To be clear, |
Oh, I see; thanks for the comment @bobot ; on the other hand I think that silently adding I find it pretty weird that just by adding |
I think it is weirder to add |
Why they would be not usable? Adding
A use case for what? |
Which libraries don't like
Perhaps but I don't know it. There are many difficulties to implement a plugin engine without linking all the modules of the static libraries:
The library granularity is clearer and simpler. |
I can't come up with an example now, but I imagine with large things such as My point is that we are using -linkall in the executable, so, I have a project, then I add
What's the problem with just referencing the modules that are used? |
I moved the discussion to its own issue #4957 |
ff4010d
to
ac872ff
Compare
@Kakadu I rebased the commits and changed the order in which the tests are added in order to see that there is 2 fixes. @ejgallego Can you review? even if the current state of the art of plugins in OCaml is not statisfying you 😸 |
I'm having issues with running my old example about sites. The manual mentions a library |
It is in dune, how are you installing the development version of dune? Perhaps the pin is not pinning every package the dune repository provides. |
https://gist.github.com/Kakadu/92c8181f89b13c3e584893c173bd34cb#file-log-txt-L75 Am I doing something wrong? It could be separate issue though... P.S. I moved my complains to separate issue #4966 |
For now this test gives a dynlink error about missiing library. See also ocaml#4320 Signed-off-by: Dmitrii Kosarev <Dmitrii.Kosarev@pm.me>
Signed-off-by: François Bobot <francois.bobot@cea.fr>
Signed-off-by: François Bobot <francois.bobot@cea.fr>
Signed-off-by: François Bobot <francois.bobot@cea.fr>
thread.cmxs doesn't exists. The tests is more interresting because it fails. Signed-off-by: François Bobot <francois.bobot@cea.fr>
Signed-off-by: François Bobot <francois.bobot@cea.fr>
Signed-off-by: François Bobot <francois.bobot@cea.fr>
Signed-off-by: Dmitrii Kosarev <Dmitrii.Kosarev@pm.me>
It should make @ejgallego less worried Signed-off-by: Dmitrii Kosarev <Dmitrii.Kosarev@pm.me>
3778884
to
da4bf15
Compare
$ dune build ./app.exe @install | ||
$ dune exec ./app.exe | ||
The library is being used by two plugins finished initialization | ||
Fatal error: exception Dune_site_plugins__Plugins.Thread_library_required_by_plugin_but_not_required_by_main_executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails with a crash for me locally:
Fatal error: exception Dune_site_plugins__Plugins.Thread_library_required_by_plugin_but_not_required_by_main_executable
+ Raised at Dune_site_plugins__Plugins.load_gen in file "otherlibs/site/src/plugins/plugins.ml", line 200, characters 6-89
+ Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
+ Called from Dune_site_plugins__Plugins.load_gen in file "otherlibs/site/src/plugins/plugins.ml", line 204, characters 4-36
+ Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
+ Called from Dune_site_plugins__Plugins.load_gen in file "otherlibs/site/src/plugins/plugins.ml", line 204, characters 4-36
+ Called from Stdlib__list.iter in file "list.ml", [2] line 110, characters 12-15
+ Called from Dune__exe__App in file "app.ml", line 2, characters 9-42
[2]
Could you do something about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have something like "backtrace printing is always activated"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm not sure what "backtrace printing is always activated" means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like export OCAMLRUNPARAM=b
in ~/.bashrc
...
For my your problem is not easily reproducible too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kakadu I see. That may well be it: my ~/.bashrc
collects settings from various sources, and I wouldn't be surprised if one of them does what you say.
@ejgallego Sorry the changes is not well placed, are you going to move it? |
CHANGES: - Fix missing -linkall flag when linking library dune-sites.plugin ( ocaml/dune#4348, @Kakadu, @bobot, reported by @Kakadu) - No longer reference deprecated Toploop functions when using dune files in OCaml syntax. (ocaml/dune#4834, fixes ocaml/dune#4830, @nojb) - Use the stag format API to be compatible with OCaml 5.0 (ocaml/dune#5351, @emillon). - Fix post-processing of dune-package (fix ocaml/dune#4389, @strub)
For now this test gives a dynlink error about missiing library. See also
#4320
@bobot ^^