From 8634626032a5aaf33785b4547711799f2ceb3261 Mon Sep 17 00:00:00 2001 From: alanechang Date: Fri, 1 Dec 2023 13:48:42 -0500 Subject: [PATCH 1/4] change runtime_stdlib install dir --- ocaml/HACKING.jst.adoc | 2 +- ocaml/Makefile.common-jst | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ocaml/HACKING.jst.adoc b/ocaml/HACKING.jst.adoc index 90e3e459fba..ee99b3c2427 100644 --- a/ocaml/HACKING.jst.adoc +++ b/ocaml/HACKING.jst.adoc @@ -123,4 +123,4 @@ Then build the compiler — the following command will build the compiler us We can now benchmark our compiler against `typecore.ml`. The following `_bootinstall` is built using the opam switch and has FP enabled. $ cd _build/main - $ perf stat -r 5 ../_bootinstall/bin/ocamlc.opt -strict-sequence -principal -w +a-4-9-40-41-42-44-45-48-66-70 -warn-error A -bin-annot -safe-string -strict-formats -w -67 -g -bin-annot -I .ocamlcommon.objs/byte -I ../install/runtime_stdlib/lib/ocaml_runtime_stdlib/ -intf-suffix .ml -no-alias-deps -o .ocamlcommon.objs/byte/typecore.cmo -c -impl typecore.ml + $ perf stat -r 5 ../_bootinstall/bin/ocamlc.opt -strict-sequence -principal -w +a-4-9-40-41-42-44-45-48-66-70 -warn-error A -bin-annot -safe-string -strict-formats -w -67 -g -bin-annot -I .ocamlcommon.objs/byte -I ../runtime_stdlib_install/lib/ocaml_runtime_stdlib/ -intf-suffix .ml -no-alias-deps -o .ocamlcommon.objs/byte/typecore.cmo -c -impl typecore.ml diff --git a/ocaml/Makefile.common-jst b/ocaml/Makefile.common-jst index a67c64457a5..abe3061dc80 100644 --- a/ocaml/Makefile.common-jst +++ b/ocaml/Makefile.common-jst @@ -45,7 +45,7 @@ define dune_main_context (profile main) (paths (PATH ("$(CURDIR)/_build/_bootinstall/bin" :standard)) - (OCAMLLIB ("$(CURDIR)/_build/install/runtime_stdlib/lib/ocaml_runtime_stdlib"))) + (OCAMLLIB ("$(CURDIR)/_build/runtime_stdlib_install/lib/ocaml_runtime_stdlib"))) (env (_ (flags (:standard -warn-error +A)) (env-vars ("OCAMLPARAM" "$(BUILD_OCAMLPARAM)")))))) @@ -71,7 +71,8 @@ boot-runtest: boot-compiler runtime-stdlib: boot-compiler RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_runstd) --only-package=ocaml_runtime_stdlib @install # dune does not believe the compiler can make .cmxs unless the following file exists - @touch _build/install/runtime_stdlib/lib/ocaml_runtime_stdlib/dynlink.cmxa + $(cpl) -R _build/install/runtime_stdlib _build/runtime_stdlib_install + @touch _build/runtime_stdlib_install/lib/ocaml_runtime_stdlib/dynlink.cmxa compiler: runtime-stdlib RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_main) --only-package=ocaml @install \ @@ -164,9 +165,10 @@ cpl=$(if $(filter linux,$(SYSTEM)),cp -l,cp -L) _install: compiler rm -rf _install mkdir -p _install/{bin,lib/ocaml} - $(cpl) _build/install/{runtime_stdlib,main}/bin/* _install/bin/ + $(cpl) _build/runtime_stdlib_install/bin/* _install/bin/ + $(cpl) _build/install/main/bin/* _install/bin/ ( cd _install/bin; for i in *.opt; do ln -s $$i $${i%.opt}; done ) - $(cpl) -R _build/install/runtime_stdlib/lib/ocaml_runtime_stdlib/* _install/lib/ocaml/ + $(cpl) -R _build/runtime_stdlib_install/lib/ocaml_runtime_stdlib/* _install/lib/ocaml/ rm -f _install/lib/ocaml/{META,dune-package,Makefile.config,dynlink.cmxa} $(cpl) -R _build/install/main/lib/ocaml/* _install/lib/ocaml/ if [ "x$(legacy_layout)" == "xyes" ] ; \ From b80c268913b51ae976e1fe39db00591707bf30c0 Mon Sep 17 00:00:00 2001 From: alanechang Date: Fri, 1 Dec 2023 14:16:21 -0500 Subject: [PATCH 2/4] remove note --- HACKING.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/HACKING.md b/HACKING.md index ca733dba7d1..07a8275b0b9 100644 --- a/HACKING.md +++ b/HACKING.md @@ -95,10 +95,6 @@ To rebuild after making changes, you can just type `make`. You need to have a working OCaml 4.14 or 4.14.1 compiler on your PATH before doing so, e.g. installed via OPAM. - -The build currently fails when using the latest version of `dune` (3.11.1). -To install a known-good dune, run `opam pin add dune 3.8.1`. - There is a special target `make hacking` which starts Dune in polling mode. The rebuild performed here is equivalent to `make ocamlopt` in the upstream distribution: it rebuilds the compiler itself, but doesn't rebuild the stdlib or anything else with the new compiler. From dcd6e5ec5ff0945729c9c90f0b995fb624830734 Mon Sep 17 00:00:00 2001 From: alanechang Date: Fri, 1 Dec 2023 17:17:38 -0500 Subject: [PATCH 3/4] remove old --- ocaml/Makefile.common-jst | 1 + 1 file changed, 1 insertion(+) diff --git a/ocaml/Makefile.common-jst b/ocaml/Makefile.common-jst index abe3061dc80..a8d87c56800 100644 --- a/ocaml/Makefile.common-jst +++ b/ocaml/Makefile.common-jst @@ -71,6 +71,7 @@ boot-runtest: boot-compiler runtime-stdlib: boot-compiler RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_runstd) --only-package=ocaml_runtime_stdlib @install # dune does not believe the compiler can make .cmxs unless the following file exists + rm -rf _build/runtime_stdlib_install $(cpl) -R _build/install/runtime_stdlib _build/runtime_stdlib_install @touch _build/runtime_stdlib_install/lib/ocaml_runtime_stdlib/dynlink.cmxa From 9a253c8224e7ff9ba639b46ccb6051237b3d78ef Mon Sep 17 00:00:00 2001 From: Diana Kalinichenko Date: Fri, 10 May 2024 10:20:14 -0400 Subject: [PATCH 4/4] Update docs --- HACKING.md | 5 +---- ocaml/Makefile.common-jst | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/HACKING.md b/HACKING.md index bdc87079e11..d8e8d3fd0ce 100644 --- a/HACKING.md +++ b/HACKING.md @@ -96,10 +96,7 @@ To rebuild after making changes, you can just type `make`. You need to have a working OCaml 4.14 or 4.14.1 compiler on your PATH before doing so, e.g. installed via OPAM. You also need to have dune and menhir. - -The build currently fails when using the latest version of `dune` (3.11.1). -To install a known-good dune, run `opam pin add dune 3.8.1`. `menhir` should be pinned to a specific -version as well: `opam pin add menhir 20210419`. +`menhir` should be pinned to a specific version: `opam pin add menhir 20210419`. There is a special target `make hacking` which starts Dune in polling mode. The rebuild performed here is equivalent to `make ocamlopt` in the upstream distribution: it rebuilds the diff --git a/ocaml/Makefile.common-jst b/ocaml/Makefile.common-jst index b0417f160ff..105768d5608 100644 --- a/ocaml/Makefile.common-jst +++ b/ocaml/Makefile.common-jst @@ -70,9 +70,11 @@ boot-runtest: boot-compiler runtime-stdlib: boot-compiler RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_runstd) --only-package=ocaml_runtime_stdlib @install -# dune does not believe the compiler can make .cmxs unless the following file exists rm -rf _build/runtime_stdlib_install +# Dune 3.11+ clears `_build/install` before building, move the runtime stdlib +# to a separate directory. $(cpl) -R _build/install/runtime_stdlib _build/runtime_stdlib_install +# Dune does not believe the compiler can make .cmxs unless the following file exists. @touch _build/runtime_stdlib_install/lib/ocaml_runtime_stdlib/dynlink.cmxa compiler: runtime-stdlib