OCaml 4.07 support#39
Conversation
| Description: Freestanding OCaml runtime | ||
| Cflags: -I${includedir} | ||
| Libs: ${libdir}/libasmrun.a ${libdir}/libotherlibs.a ${libdir}/libnolibc.a ${libdir}/libopenlibm.a @@PKG_CONFIG_EXTRA_LIBS@@ | ||
| Libs: ${libdir}/libasmrun.a ${libdir}/libnolibc.a ${libdir}/libopenlibm.a @@PKG_CONFIG_EXTRA_LIBS@@ |
There was a problem hiding this comment.
i'm not entirely sure about this -- is the order of the .a archives relevant?
There was a problem hiding this comment.
it is not, but the escaping in configure.sh needs some additional \
There was a problem hiding this comment.
I'm not sure what you mean. The archives should be listed in dependency order, but your change doesn't change that.
There was a problem hiding this comment.
Ah, I see now, you move libotherlibs.a into PKG_CONFIG_EXTRA_LIBS for OCaml < 4.07.0. That might break some linkers.
There was a problem hiding this comment.
yes, and escaping the $ from configure.sh via Makeconf and Makefile doesn't seem to be possible for me.... we may need to introduce some other mechanism
Relevant changes in 4.07 - unix.c now #include <sys/ioctl.h> (since 852b595ff3), but an empty one is fine (only use is in caml_nun_rows_fd in an #ifdef TIOCGWINSZ), see ocaml/ocaml#1431 -> provide an empty ioctl via nolibc - bigarray is now part of the stdlib ocaml/ocaml#1685 -> libotherlibs.a is no longer needed (neither built nor linked) To support these changes, an empty sys/ioctl.h is added to nolibc. Also, `ocaml-freestanding.pc.in` now contains in `Libs`: -L${libdir} -lasmrum -lnolibc -lopenlibm (instead of ${libdir}/lib for each library). `configure.sh` adds -lotherlibs to these flags in the case that OCAML_GTE_4_07_0 is false. The `Makefile` treats libotherlibs.a as dependency only if OCAML_GTE_4_07_0 is false.
|
I force-pushed this branch - now that 4.07.0 is released (and a ocaml-src.4.07.0 is available in opam-repository). I couldn't figure out the levels of escape to inject a |
|
this links and nearly works, but linking a MirageOS unikernel requires one more symbol in 4.07.0 land (which is part of otherlibs - which we avoid to compile and use in this PR): NOTE: please take a look at ecd2515 for the solution using |
|
@hannesm IIUC this depends on a fix for mirage/mirage#911 before I can meaningfully test it? |
|
yes, Drup fixed mirage on 4.07.0 with mirage/functoria#153 and mirage/mirage#912 - which I plan to merge soon |
|
@hannesm I've tested this (using --dev-repo pins of mirage and functoria) and it seems fine. What is the issue you were trying to fix with shell escaping? Regarding the change in library ordering in the .pc file, this should actually be fine as long as no libraries that depend on libotherlibs come after it in the link step. As far as I can tell, that should never happen. Modifying nolibc/stubs.c at build time is a bit hacky, but it'll do for now. |
in current master, the |
|
NB functoria 2.2.1 and mirage 3.1.1 are now released to opam-repository -- which support OCaml 4.07. |
|
I had another look at this; the fact that configure.sh modifies nolibc/stubs.c is a bit annoying when working out of a Git tree, since it a) dirties the tree and b) is not idempotent. Could you move that specific action into Makefile, under the |
|
CI is broken due to ocaml/ocaml-ci-scripts#232 which now uses opam2 (thx to @samoht - see https://discuss.ocaml.org/t/ocaml-ci-scripts-are-now-using-opam2-by-default/2379 as well), not sure what to do here - we can tell travis to use opam1, or update the opam file to opam2. what do you think? |
|
given that the main opam-repository will only switch to 2.0.0 on september 17th (according to https://opam.ocaml.org/blog/opam-2-0-0-repo-upgrade-roadmap/), I guess it is wise to use opam1 until then here as well (to avoid having to downgrade opam files for potential new releases) -- I'll shortly add a commit here to stick travis to opam1 |
|
@hannesm what was the error with the CI script and opam2? I can help fixing those :-) |
|
@samoht from https://travis-ci.org/mirage/ocaml-freestanding/jobs/413023314 it's easy enough to fix, but will break opam1.. |
|
Or we can also add |
|
I'm not a big fan about ignoring warnings in the CI scripts -- it is usually hard to get rid of once ignored warnings (similar to |
|
@hannesm Thanks, this all looks good to me, including sticking with OPAM 1.x for now. |
Relevant changes in 4.07
(only use is in caml_nun_rows_fd in an #ifdef TIOCGWINSZ), see
Remove dependencies on curses/terminfo/termcap C library ocaml/ocaml#1431
-> provide an empty ioctl via nolibc
Add bigarray to the stdlib ocaml/ocaml#1685
-> libotherlibs.a is no longer needed (neither built nor linked)
this compiles, but has not been extensively tested due to ppx issues in 4.07 (and thus unable to build the mirage tool, but working on some hacks for that)