|Anonymous | Login | Signup for a new account||2018-12-19 11:26 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007688||OCaml||misc||public||2017-12-07 17:38||2017-12-11 23:17|
|Status||closed||Resolution||no change required|
|Target Version||Fixed in Version|
|Summary||0007688: Hard bootstrap procedure is broken|
|Description||At the begining of the makefile is described a "hard bootstrap procedure", that is supposed to work even if the set of C primitives used by stdlib has changed.|
However, in the current state, the procedure does not work and fails in the last "coreboot" phase.
I think we should solve this issue by either updating the doc of this bootstrap procedure, or even removing it (but then how one should do ?) or fixing the makefile.
Moreover, I think it would be good to test that this keep working in the future by adding a test in the CI. This is not the first time it breaks.
|Steps To Reproduce||In current trunk:|
$ make world
<start of hard bootstarp procedure as stated in Makefile:>
$ make coreboot
[add a primitive in the runtime, add call it from the stdlib]
$ make clean runtime coreall
$ make coreboot
< fails with :
../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot -use-prims ../byterun/primitives -I .. make_opcodes.ml -o make_opcodes
File "make_opcodes.ml", line 1:
Error: Error while linking ../boot/stdlib.cma(Pervasives):
The external function `caml_foo' is not available
FWIW, the changes I made in my test to add the new primitive are:
diff --git a/byterun/misc.c b/byterun/misc.c
index 46e40992b..bd2b7a441 100644
@@ -51,6 +51,11 @@ void caml_set_fields (value v, unsigned long start, unsigned long filler)
#endif /* DEBUG */
+CAMLprim value caml_foo(value x)
+ return x;
uintnat caml_verb_gc = 0;
void caml_gc_message (int level, char *msg, ...)
diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml
index faa421871..69b2cdb78 100644
@@ -546,3 +546,9 @@ let exit retcode =
let _ = register_named_value "Pervasives.do_at_exit" do_at_exit
+external foo : int -> int = "caml_foo"
+let _ = ignore (foo 5)
|Tags||No tags attached.|
I do not know whether the hard bootstrap procedure is currently working or not, but I believe your error is not related to that.
Indeed primitives are currently expected to be defined in the files listed in the PRIMS variable in byterun/Makefile, which does not currently contain misc.c.
It would be great if you could try adding misc.c to PRIMS and post back whether the bootstrap procedure is working or not.
Alright, I should not have defined caml_foo in misc.c.
If I define it in array.c instead, I get another error, *earlier*:
$ make coreall
boot/ocamlrun tools/make_opcodes -opcodes < byterun/caml/instruct.h > bytecomp/opcodes.ml
Fatal error: unknown C primitive `caml_foo'
Did you start the process from the beginning or try to continue from the bootstrap process you had started before? If the latter, could you test starting from a fresh repository (you can do git clean -fdx from the repository root to make sure you are starting from zero).
Also, note that the bootstrap instructions have been refreshed recently (https://github.com/ocaml/ocaml/pull/1434 [^]), but if I am not mistaken simply adding a primitive should work even with the old instructions.
> Also, note that the bootstrap instructions have been refreshed recently (https://github.com/ocaml/ocaml/pull/1434 [^] [^]), but if I am not mistaken simply adding a primitive should work even with the old instructions.
Ok, I was not aware of this recent change (merged yesterday ! that's a data race, actually). It indeed works with the current instructions.
Thanks, and sorry for the noise.
|2017-12-07 17:38||jacques-henri.jourdan||New Issue|
|2017-12-11 12:02||nojebar||Note Added: 0018738|
|2017-12-11 21:56||jacques-henri.jourdan||Note Added: 0018739|
|2017-12-11 22:29||nojebar||Note Added: 0018740|
|2017-12-11 23:16||jacques-henri.jourdan||Note Added: 0018741|
|2017-12-11 23:17||jacques-henri.jourdan||Status||new => closed|
|2017-12-11 23:17||jacques-henri.jourdan||Assigned To||=> jacques-henri.jourdan|
|2017-12-11 23:17||jacques-henri.jourdan||Resolution||open => no change required|
|Copyright © 2000 - 2011 MantisBT Group|