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
weird bug with custom toplevels #2979
Comments
Comment author: administrator Hi Markus,
I was able to reproduce this behavior (under Linux). The problem is Caml custom bytecode executables do indeed need to look inside What your example demonstrates is that the kernel doesn't follow this Cheers,
|
Comment author: administrator Hi Xavier, On Fri, 26 Oct 2001, Xavier Leroy wrote:
I have just tried other OSes and found out that the same problem appears Maybe this problem should be mentioned in the docs, i.e. that one Cheers, -- |
Comment author: administrator
Interesting. A look at the Linux sources reveal that this is For Linux, there is an alternative to relying on argv[0], which is to
|
Comment author: administrator On Fri, 26 Oct 2001, Xavier Leroy wrote:
Good idea! Most European academic institutions are intending to shift more Cheers, -- |
Comment author: administrator XL, 2001-10-30: for Linux, take contents of /proc/self/exe as argv[0]. For |
Original bug ID: 557
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
assume that I have a customized toplevel "mocaml" somewhere in my $PATH,
which also contains support for Tk.
Now I create another customized toplevel with the same name in another
directory, but without Tk-support:
ocamlmktop -custom -o mocaml
Now I write a small script "mocaml_test", which looks e.g. as follows
(set the script header to the toplevel without Tk-support):
#!/home/mottl/mocaml
print_endline "Hello world!"
After chmoding it executable, calling it directly will lead to the
following error (at least on my Linux-box and the Alpha):
Fatal error: unknown C primitive `camltk_return'
Renaming the toplevel to, say, "foobar" (not in path) and changing the
script header accordingly will lead to the intended result.
The upper example is actually a bit misleading, and it took me a while to
figure out what was happening, because the problem does not really have to
do with Tk-support: note that using the name of another binary in the path
(say, "cat") for the toplevel, is likely to result in the following error:
Fatal error: the file ./mocaml_test is not a bytecode executable file
It seems that the interpreter tries to find itself and unfortunately
does so in the PATH. There it will find the other executable instead,
which is probably the reason for the problems above.
Regards,
Markus
--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus
The text was updated successfully, but these errors were encountered: