Building OCaml 4.11.1 on Ubuntu 20.10

Hi,

I’m trying to package new versions of OCaml on old versions of Ubuntu, and running into issues on groovy and precise.

The build on groovy has 308 tests that fail with errors like

 ... testing 'threadsigmask.ml' with 1.1.2 (native) => failed (The file /<<PKGBUILDDIR>>/testsuite/_ocamltest/tests/lib-systhreads/threadsigmask/ocamlopt.byte/ocamlopt.byte.output was expected to be empty because there is no reference file /<<PKGBUILDDIR>>/testsuite/tests/lib-systhreads/threadsigmask.compilers.reference but it is not:
========================================
/usr/bin/ld: threadsigmask.o: warning: relocation in read-only section `.text'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
========================================

The build on precise has 1 test that fails:

 ... testing 'main.ml' with 1.1 (native) => failed (Compiling program /<<PKGBUILDDIR>>/testsuite/_ocamltest/tests/instrumented-runtime/main/ocamlopt.byte/main.opt from modules  main.ml: command
/<<PKGBUILDDIR>>/runtime/ocamlrun /<<PKGBUILDDIR>>/ocamlopt  -I /<<PKGBUILDDIR>>/runtime  -nostdlib -I /<<PKGBUILDDIR>>/stdlib  -runtime-variant=i     -o /<<PKGBUILDDIR>>/testsuite/_ocamltest/tests/instrumented-runtime/main/ocamlopt.byte/main.opt   main.ml 
failed with exit code 2)

Interestingly, 4.11.1 builds find on distributions both older and newer than groovy. (I’m backporting the package from hisrute, and it builds find on trusty, xenial, bionic, and focal.)

Any suggestions on what I have to change to get OCaml 4.11.1 to succeed?

Thanks,
Jason

I’ve managed to fix the DT_TEXTREL error as per ocamlopt 4.08.1 triggers ld relocation warnings on i386 with binutils 2.35 · Issue #9800 · ocaml/ocaml · GitHub . Still confused about the precise / Ubuntu 12.04 error.

Using a VM, the error from precise seems to be

$ /home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/runtime/ocamlrun /home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/ocamlopt  -I /home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/runtime  -nostdlib -I /home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/stdlib  -runtime-variant=i     -o /home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/testsuite/_ocamltest/tests/instrumented-runtime/main/ocamlopt.byte/main.opt   main.ml
/home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/runtime/libasmruni.a(eventlog_ni.o): In function `time_counter':
/home/test/coq-debian-build-scripts/ocaml-stuff/debian-sources/ocaml-4.11.1/runtime/eventlog.c:113: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)