-
Notifications
You must be signed in to change notification settings - Fork 415
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
Uses -custom #2505
Comments
Additionally, we now use |
It's actually not trivial to avoid. This is the first time I hear that |
We had a discussion on caml-devel about this. Currently, we use However, using Regarding the patch to allow custom program to be stripped, integrating it in OCaml could be an option. However, looking at it it looks a little bit specific to Debian. Would it be possible to have something that is more portable? Finally, before doing anything, I would also like to push back a little; why is bad to have binaries that can't be stripped? For instance, a valid option would be to change the stripping tool to skip custom byte programs. |
In spirit, there is nothing specific to Debian in the idea. The Debian-specific bits are about activating the effect of the patch only while building packages, keeping the former behaviour elsewhere. I wrote the patch in 2008. Now, I would apply the new behaviour unconditionally since it's so easy to install a vanilla OCaml thanks to OPAM, so we can afford to not care about people wanting the original behaviour.
The patch currently doesn't apply to 4.08.0 in a way that I'll have to rewrite it basically from scratch.
The policy in Debian is to build everything with debugging symbols, so that users can provide useful reports in case of crashes without having to recompile packages. The Debian toolchain automatically strips binaries and puts debugging symbols in separate packages to keep the main package small. (This could also benefit to custom OCaml runtimes by the way.)
I don't consider as valid an option to workaround a broken behaviour. And it sounds wrong to bake OCaml-specific knowledge in a language-agnostic tool. |
What is the broken behaviour? |
Generating binaries that cannot be stripped. |
I had a look at this. It's actually more difficult than expected to solve this problem in general. For instance, an executable might depend on a private library that has stubs and we currently don't install the I had a look at how
At runtime, the startup code:
This can lead to weird behaviors: $ echo 'print_endline "custom"' > custom.ml
$ echo 'print_endline "normal"' > normal.ml
$ ocamlc -custom custom.ml -o custom
$ ocamlc normal.ml -o normal
$ ./custom
custom
$ ./normal
normal
$ ocamlrun custom
custom
$ ocamlrun normal
normal
$ ( exec -a ./custom ocamlrun normal )
custom
$ echo 'print_endline "custom2"' > custom2.ml
$ ocamlc -custom custom2.ml -o custom2
$ ( exec -a ./custom2 ./custom )
custom2 Oh dear, I understand why custom is considered a dirty hack... I wonder if we couldn't change the implementation of |
This is exactly what my patch did. |
@glondu could you post a link to the source of your patch ? Thanks! |
@nojb I think it's the link in @glondu's first comment. /cc @dra27 who might be interested in this discussion as well. In the end, the compiler patch seems to me like the way forward. It'd would turn |
See ocaml/ocaml#8872 |
I think this has been fixed in #2692 |
Looking at doc/dune-files.rst, dune uses
ocamlc -custom
to generate binaries on bytecode architectures.-custom
is deprecated, please provide a way to avoid it.One problem is that resulting binaries are not strippable. I once submitted a patch to OCaml to fix that, but it has been rejected by @xavierleroy saying that
-custom
was deprecated and should not be used.The patch has been ported to OCaml 4.05.0, but I'd rather not port it to 4.08.0 as diverging from upstream this way is painful.
The text was updated successfully, but these errors were encountered: