OCaml <=14.12 doesn't support glibc>=2.34
valfur03 opened this issue · 9 comments
- Operating System: Arch Linux
- Revery Version: 0.32.0 (currently on
master) - OCaml version: 14.12
- Native, Bytecode, or JS build: no idea
I am trying to build revery on Arch Linux, but it fails when compiling OCaml. I found this comment on an OCaml repository's issue (ocaml/ocaml#10250 (comment)) that completely seems related to the problem. The glibc is at version 2.35 on my system, but OCaml <14.12 doesn't support glibc>=2.34. The wiki doesn't seem to mention that compatibility issue.
This should have been fixed in opam in ocaml/opam-repository#19855 and for esy in
esy-ocaml/ocaml#60, both back in January.
You can try removing the esy.lock directory and rebuilding, but otherwise the error description "fails when compiling OCaml" isn't very actionable.
The bigger problem seems to be that esy-sdl2 is broken (revery-ui/esy-sdl2#21) and needs to be updated. But it's been forked in such a backwards way that I'm not sure how to go about doing so. It's been done before though (by @zbaylin) so should be possible.
There are also build problems with GCC 12, e.g. I get this on Fedora 37:
interp.c: In function 'caml_interprete':
interp.c:253:21: error: storing the address of local variable 'lbl_ACC0' in 'caml_instr_base' [-Werror=dangling-pointer=]
253 | caml_instr_base = Jumptbl_base;
| ^
interp.c:51:26: note: 'lbl_ACC0' declared here
51 | # define Instruct(name) lbl_##name
| ^~~~
interp.c:323:5: note: in expansion of macro 'Instruct'
323 | Instruct(ACC0):
| ^~~~~~~~
In file included from interp.c:25:
caml/fix_code.h:38:15: note: 'caml_instr_base' declared here
38 | extern char * caml_instr_base;
| ^~~~~~~~~~~~~~~
Which got fixed here in 4.14.x: ocaml/ocaml@f280aaa and in 4.12: ocaml/ocaml@7481281
Although FWIW I can install 'OCaml 4.12.1' from opam... is there a way to tell esy to use the OCaml compiler installed by OPAM or the system compiler?
Line 71 in 141f70f
"ocaml" package version 4.12.x is hosted on this branch https://github.com/esy-ocaml/ocaml/tree/4.12.1+esy
You should open a PR (or I can) to this branch by cherry-picking the commit you cited.
After that you need to wait for someone to review and merge your PR and publish it.
In the meantime you can consume your own fork with esy resolution syntax.
You have an example just above
Line 68 in 141f70f
Thanks for the hints (I wasn't familiar with how esy works, just opam).
I had to use resolutions to pin my fork (otherwise the solver failed thinking the version is not <4.13). Also for future reference the json here is quite picky: you can't have trailing , for example, and the part after # has to be a commit hash, it cannot be a branch or git describe output:
+ },
+ "resolutions" : {
+ "ocaml": "edwintorok/ocaml#c9af44073b"
}
PR here esy-ocaml/ocaml#64
FWIW revery itself still doesn't build, even with that 4.12.1 bugfix, but it gets further and fails here:
(cd _build/default && /var/home/edwin/.esy/3_______________________________________________________________/i/ocaml-009b8de8/bin/ocamlc.opt -w -9 -g -bin-annot -I src/api/.ppx_deriving_api.objs/byte -I /var/home/edwin/.esy/3_______________________________________________________________/i/ocaml-009b8de8/lib/ocaml/compiler-libs -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ocaml_compiler_libs-opam__c__v0.12.4-b4b6b35f/lib/ocaml-compiler-libs/common -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ocaml_compiler_libs-opam__c__v0.12.4-b4b6b35f/lib/ocaml-compiler-libs/shadow -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ocaml_migrate_parsetree-opam__c__1.8.0-f7b9c475/lib/ocaml-migrate-parsetree -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppx__derivers-opam__c__1.2.1-01696764/lib/ppx_derivers -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppxlib-opam__c__0.15.0-13a3ac19/lib/ppxlib -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppxlib-opam__c__0.15.0-13a3ac19/lib/ppxlib/ast -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppxlib-opam__c__0.15.0-13a3ac19/lib/ppxlib/print_diff -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppxlib-opam__c__0.15.0-13a3ac19/lib/ppxlib/stdppx -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__ppxlib-opam__c__0.15.0-13a3ac19/lib/ppxlib/traverse_builtins -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__result-opam__c__1.5-945f851c/lib/result -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__sexplib0-opam__c__v0.14.0-02514ae2/lib/sexplib0 -I /var/home/edwin/.esy/3_______________________________________________________________/i/opam__s__stdlib_shims-opam__c__0.3.0-b081998e/lib/stdlib-shims -intf-suffix .ml -no-alias-deps -o src/api/.ppx_deriving_api.objs/byte/ppx_deriving.cmo -c -impl src/api/ppx_deriving.pp.ml)
File "ppx_deriving.cppo.ml", line 673, characters 28-74:
Error: Unbound module Migrate_parsetree.OCaml_current.Ast.Ast_helper
Hint: Did you mean Ast_mapper?
It looks like esy install has updated esy.lock/ quite significantly: 57 files changed, 761 insertions(+), 3114 deletions(-), however esy build won't work without esy install (claims no lockfile)
The following change to package.json gets me a bit closer to being able to build it (the versions in package.json appeared to be too old to work with 4.12.1, OTOH with ocaml-lsp-server we need to be careful to avoid pulling in the 5.0 version which 'opam' knows how to avoid, but 'esy' doesn't and I had to work that around by adding a ^1.9.0 in the devDependencies):
diff --git a/package.json b/package.json
index cae6b349..63eefd69 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
"dependencies": {
"@opam/bos": "0.2.0",
"@opam/ctypes": "0.15.1",
- "@opam/dune": "^2.5.0",
+ "@opam/dune": ">=2.5.0 <4",
"@opam/dune-configurator": "*",
"@opam/reason": "^3.6.2",
"@opam/lru": "bryphe/lru:lru.opam#2708c70",
@@ -45,7 +45,7 @@
"@opam/lwt_ppx": "^1.1.0",
"@opam/markup": "0.8.2",
"@opam/ppx_deriving": "*",
- "@opam/ppx_optcomp": "v0.14.0",
+ "@opam/ppx_optcomp": ">=v0.14.0 <=v0.16.0",
"@opam/omd": "ocaml/omd:omd.opam#1535e3c",
"@opam/uucp": "*",
"@opam/uutf": "*",
@@ -70,6 +70,9 @@
"devDependencies": {
"ocaml": "4.12.x",
"esy-astyle": "zbaylin/esy-astyle#59bc21a",
- "@opam/ocaml-lsp-server": "*"
+ "@opam/ocaml-lsp-server": "^1.9.0"
+ },
And then I get to the SDL2 build error you mentioned
The next error is a missing rapidjson repository, fixed in esy-skia master, so updating the package.json entry fixes that:
subprocess.CalledProcessError: Command '['git', 'clone', '--quiet', 'https://skia.googlesource.com/external/github.com/Tencent/rapidjson.git', 'third_party/externals/rapidjson']' returned non-zero exit status 128
"esy-skia": "revery-ui/esy-skia#29349b9279ed24a73ec41acd7082caea9bd8c04e",
Which then goes on a bit further, but fails to build here:
../../src/core/SkCubicClipper.cpp:83:9: error: variable 'iters' set but not used [-Werror,-Wunused-but-set-variable]
int iters = 0;
^
1 error generated.
Looks like there are too many things that need to be updated to get revery to build on Fedora37, but I hope that the above helps someone pick up where I left off.
Thanks for your works on this. I can merge PR to revery-ui so I will try to review esy-sdl2 PR this week.
For the error you showed you only need to remove the line at the specified location.
The following change to package.json gets me a bit closer to being able to build it (the versions in package.json appeared to be too old to work with 4.12.1, OTOH with ocaml-lsp-server we need to be careful to avoid pulling in the 5.0 version which 'opam' knows how to avoid, but 'esy' doesn't and I had to work that around by adding a ^1.9.0 in the devDependencies):
diff --git a/package.json b/package.json index cae6b349..63eefd69 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "dependencies": { "@opam/bos": "0.2.0", "@opam/ctypes": "0.15.1", - "@opam/dune": "^2.5.0", + "@opam/dune": ">=2.5.0 <4", "@opam/dune-configurator": "*", "@opam/reason": "^3.6.2", "@opam/lru": "bryphe/lru:lru.opam#2708c70", @@ -45,7 +45,7 @@ "@opam/lwt_ppx": "^1.1.0", "@opam/markup": "0.8.2", "@opam/ppx_deriving": "*", - "@opam/ppx_optcomp": "v0.14.0", + "@opam/ppx_optcomp": ">=v0.14.0 <=v0.16.0", "@opam/omd": "ocaml/omd:omd.opam#1535e3c", "@opam/uucp": "*", "@opam/uutf": "*", @@ -70,6 +70,9 @@ "devDependencies": { "ocaml": "4.12.x", "esy-astyle": "zbaylin/esy-astyle#59bc21a", - "@opam/ocaml-lsp-server": "*" + "@opam/ocaml-lsp-server": "^1.9.0" + },And then I get to the SDL2 build error you mentioned
The bound on dune should be correct before your modification 🤔 If you send a PR to revery that add upper bound you found I can merge this quickly (one file to review)
Also the issue you got with resolutions is on our end we wasn't strict enough on version.
If you show next error I can help you solving the issue.
I pushed what I have here: https://github.com/edwintorok/esy-skia/commits/master but as soon as I fix one error there are others, some of which have upstream commits to backport (and some do not because the code got deleted/changed substantially upstream):
../../src/core/SkLineClipper.cpp:169:43: error: argument 'pts' of type 'const SkPoint[]' with mismatched bound [-Werror,-Warray-parameter]
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
^
../../src/core/SkLineClipper.h:31:39: note: previously declared as 'const SkPoint[2]' here
static int ClipLine(const SkPoint pts[2], const SkRect& clip,
^
../../src/core/SkLineClipper.cpp:169:78: error: argument 'lines' of type 'SkPoint[]' with mismatched bound [-Werror,-Warray-parameter]
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
^
../../src/core/SkLineClipper.h:32:33: note: previously declared as 'SkPoint[4]' here
SkPoint lines[kMaxPoints], bool canCullToTheRight);
^
2 errors generated.
[486/1230] compile ../../src/core/SkMaskBlurFilter.cpp
I don't think it is worth continuing down this route: upstream must've fixed these build errors in newer versions, so updating to the latest upstream might be best (although that might imply updating some OCaml bindings for skia too?), however there are a lot of conflicts (are there some local changes to skia that were not upstream?)