Building JaneStreet CoreBench

I feel like I am unable to build Jane Street repositories for some reason.

I just came across this again. Steps taken this time are:

>gh repo clone janestreet/core_bench
>opam switch create . ocaml-base-compiler.4.12.0 --no-install
> make

After that its:

dune external-lib-deps --missing @@default
Error: The following libraries are missing in the default context:
- core.command_unix
- core.filename_unix
- core.time_stamp_counter
- core.time_unix
- core_kernel.core
- core_kernel.version_util
- ppx_jane
- re
- textutils.ascii_table
Hint: try:
  opam install core core_kernel ppx_jane re textutils
>opam install core core_kernel ppx_jane re textutils
>make
dune build
File "src/bench.ml", line 66, characters 17-23:
66 |           ignore (f ())
                      ^^^^^^
Error: Jane Street style: Ignored expression must come with a type annotation
File "src/benchmark.ml", line 63, characters 15-21:
63 |         ignore (f ())
                    ^^^^^^
Error: Jane Street style: Ignored expression must come with a type annotation
File "inline_benchmarks_runner_lib_public/bin/dune", line 3, characters 12-28:
3 |  (libraries core_kernel.core inline_benchmarks_public)
                ^^^^^^^^^^^^^^^^
Error: Library "core_kernel.core" not found.
Hint: try:
  dune external-lib-deps --missing @@default
File "inline_benchmarks_runner_lib_public/src/dune", line 3, characters 30-46:
3 |  (libraries core.command_unix core_kernel.core core_bench re
                                  ^^^^^^^^^^^^^^^^
Error: Library "core_kernel.core" not found.
Hint: try:
  dune external-lib-deps --missing @@default
File "src/dune", line 3, characters 26-40:
3 |   core.time_stamp_counter core.time_unix core_kernel.version_util)
                              ^^^^^^^^^^^^^^
Error: Library "core.time_unix" not found.
Hint: try:
  dune external-lib-deps --missing @@default
make: *** [default] Error 1
…andalarian ~/G/core_bench (master) [2]  dune external-lib-deps --missing @@default

Then it goes in circles like that.

I also tried installing janestreet-bleeding per their suggestion on the the janestreet/base repo but it did not help.

Any guidance would be greatly appreciated.

Just to double check, after adding the janestreet-bleeding repo, did you update and upgrade packages in the switch?

FWIW, I don’t think the bleeding packages will build on 4.12.0, since we’re on 4.11.1 internally.

I was able to build the core_bench repo by running:

opam switch create . ocaml-base-compiler.4.11.1 --no-install
opam repo add janestreet-bleeding https://ocaml.janestreet.com/opam-repository
eval "$(opam env)"
opam install core core_kernel textutils
make

Thank you, @bcc32 for the guidance.

When running opam install core core_kernal textutils you get an ERROR while compiling ocaml_intrinsics.v0.15~preview.124.35+330:

mando@mandalarian ~/G/core_bench (master)> opam install core core_kernel textutils
[NOTE] Package core_kernel is already installed (current version is v0.15~preview.124.35+330).
The following actions will be performed:
  ∗ install ocaml_intrinsics v0.15~preview.124.35+330 [required by core]
  ∗ install core             v0.15~preview.124.35+330
  ∗ install textutils        v0.15~preview.124.35+330
===== ∗ 3 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ocaml_intrinsics.v0.15~preview.124.35+330] downloaded from https://github.com/janestreet/ocaml_intrinsics/archive/0654b7e6c6cd3818dd07c24ed36cc2399122757c.tar.gz
[textutils.v0.15~preview.124.35+330] downloaded from https://github.com/janestreet/textutils/archive/4dd1d3afb990054e7e42365ac44f660810d24055.tar.gz
[core.v0.15~preview.124.35+330] downloaded from https://github.com/janestreet/core/archive/93dcd36f152b124523dd2584b1fcdcd33d134565.tar.gz

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ERROR] The compilation of ocaml_intrinsics failed at "/Users/mando/.opam/opam-init/hooks/sandbox.sh
        build dune build -p ocaml_intrinsics -j 7".

#=== ERROR while compiling ocaml_intrinsics.v0.15~preview.124.35+330 ==========#
# context     2.0.8 | macos/x86_64 | ocaml-base-compiler.4.11.1 | https://ocaml.janestreet.com/opam-repository
# path        ~/Github/core_bench/_opam/.opam-switch/build/ocaml_intrinsics.v0.15~preview.124.35+330
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocaml_intrinsics -j 7
# exit-code   1
# env-file    ~/.opam/log/ocaml_intrinsics-49976-b1a82b.env
# output-file ~/.opam/log/ocaml_intrinsics-49976-b1a82b.out
### output ###
#           cc src/crc_stubs.o (exit 1)
# (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O2 -fno-strict-aliasing -fwrapv -mpopcnt -mlzcnt -mbmi -mprfchw -mprefetchwt1 -g -I /Users/mando/Github/core_bench/_opam/lib/ocaml -o crc_stubs.o -c crc_stubs.c)
# crc_stubs.c:8:11: error: '__builtin_ia32_crc32di' needs target feature sse4.2
#    return __builtin_ia32_crc32di(initial, data);
#           ^
# 1 error generated.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
┌─ The following actions failed
│ λ build ocaml_intrinsics v0.15~preview.124.35+330
└─ 
╶─ No changes have been performed

Then i tried pinning it to see if it would help. It did not.

> opam pin add -y https://github.com/janestreet/ocaml_intrinsics.git
[ocaml_intrinsics] synchronised from git+https://github.com/janestreet/ocaml_intrinsics.git
[ocaml_intrinsics.v0.15~preview.124.35+330] synchronised from git+https://github.com/janestreet/ocaml_intrinsics.git
ocaml_intrinsics is now pinned to git+https://github.com/janestreet/ocaml_intrinsics.git (version v0.15~preview.124.35+330)
The following actions will be performed:
  ∗ install ocaml_intrinsics v0.15~preview.124.35+330*
[ocaml_intrinsics.v0.15~preview.124.35+330] synchronised from git+https://github.com/janestreet/ocaml_intrinsics.git

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ERROR] The compilation of ocaml_intrinsics failed at "/Users/mando/.opam/opam-init/hooks/sandbox.sh
        build dune build -p ocaml_intrinsics -j 7".

#=== ERROR while compiling ocaml_intrinsics.v0.15~preview.124.35+330 ==========#
# context     2.0.8 | macos/x86_64 | ocaml-base-compiler.4.11.1 | pinned(git+https://github.com/janestreet/ocaml_intrinsics.git#0654b7e6)
# path        ~/Github/core_bench/_opam/.opam-switch/build/ocaml_intrinsics.v0.15~preview.124.35+330
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocaml_intrinsics -j 7
# exit-code   1
# env-file    ~/.opam/log/ocaml_intrinsics-50255-a4abd5.env
# output-file ~/.opam/log/ocaml_intrinsics-50255-a4abd5.out
### output ###
#           cc src/crc_stubs.o (exit 1)
# (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O2 -fno-strict-aliasing -fwrapv -mpopcnt -mlzcnt -mbmi -mprfchw -mprefetchwt1 -g -I /Users/mando/Github/core_bench/_opam/lib/ocaml -o crc_stubs.o -c crc_stubs.c)
# crc_stubs.c:8:11: error: '__builtin_ia32_crc32di' needs target feature sse4.2
#    return __builtin_ia32_crc32di(initial, data);
#           ^
# 1 error generated.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
┌─ The following actions failed
│ λ build ocaml_intrinsics v0.15~preview.124.35+330
└─ 
╶─ No changes have been performed
[NOTE] Pinning command successful, but your installed packages may be out of sync.
mando@mandalarian ~/G/core_bench (master) [31]> 

Is this an issue i should create?

I’m not sure in this case. It looks like ocaml_intrinsics is a new library, maybe the conditional compilation incantations aren’t quite correct for determining whether that intrinsic is available. Please do create a GitHub issue (you can create one on the ocaml_intrinsics repo)—I’m guessing this is a macOS-specific bug.