Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 203887 - runnning debugedit on executables compiled with ocamlc -custom kills them
Summary: runnning debugedit on executables compiled with ocamlc -custom kills them
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 200044 203886
  Show dependency tree
 
Reported: 2007-12-31 14:45 UTC by Alexis Ballier
Modified: 2008-01-12 03:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis Ballier gentoo-dev 2007-12-31 14:45:51 UTC
$ cat foo.ml 
let _ = Printf.printf "hello world\n";;
$ ocamlc -custom foo.ml
$ ./a.out 
hello world
$ debugedit a.out
$ ./a.out 
No bytecode file specified.


ocamlc -custom uses a nasty trick to have runnable executables withtout needing an interpreter, some packages use it (see ocamlc manpage for details).
It embeds an interpreter and the bytecode in one file. I knew stripping them removed the bytecode, but running debugedit on them also does.

See [1] for a probably better reference.

As a result, some ocaml packages are broken if one has installsources in its features:
FEATURES="installsources" emerge ocsigen
$ ocsigen 
No bytecode file specified.
If I remove installsources from my features, its working fine.


I'm assigning this bug to dev-portage as it seems the sanest thing to do would be to restrict the installsources feature but it doesnt seem to be possible as of now.


[1] http://caml.inria.fr/pub/ml-archives/caml-list/2002/08/492887df149fb58b1c21ffa89e6fee66.en.html
Comment 1 Olivier Crete (RETIRED) gentoo-dev 2007-12-31 16:07:33 UTC
The real solution is for the ocaml crap to use a proper elf section... But if they're not going to do that, then I guess the second best solution is to add a RESTRICT=installsources

That said, from a Gentoo PoV, isnt it better to install the bytecode separately from the installer, so as not to have multiple copies of the installer, some possibly outdated?
Comment 2 Alexis Ballier gentoo-dev 2008-01-01 14:57:55 UTC
(In reply to comment #1)
> That said, from a Gentoo PoV, isnt it better to install the bytecode separately
> from the installer, so as not to have multiple copies of the installer, some
> possibly outdated?

well, ocaml upstream provides this (a "little bit" broken) way of doing things, some ocaml packages upstream use it, I dont think it would be a good idea to differ from them. Moreover, it'll need a wrapper if you want an executable in */bin
I dont know the ocaml bytecode internals, but I suspect they are also incompatible from one ocaml version to another as if you try to mix different packages compiled with different ocaml versions eveything will break. And anyway , the possibility to have an old interpreter is a non issue because of that need to rebuild all ocaml packages when upgrading the ocaml compiler.

Comment 3 Zac Medico gentoo-dev 2008-01-12 03:39:31 UTC
This has been released in 2.1.4.