Skip to content

Dune 3.11 introduces regression on macOS with regarding to executable promotion #9272

@haochenx

Description

@haochenx

Expected Behavior

Promoted executable runs fine.

Actual Behavior

Promoted executable getting killed by OS with signal 9.
Directly executing executable in _build folder or executing a manually copied version of the executable behave as expected.

Reproduction

See the minimal reproducing project at https://github.com/kxcinc/sample.bc47-dune-reproduce

Specifications

  • Version of dune (output of dune --version): 3.11.0 (also reproduced on 3.11.1)
  • Version of ocaml (output of ocamlc --version): 5.1.0 (also reproduced on 4.14.0 ~ 5.0.0)
  • Operating system (distribution and version): macOS 14.1.1 (Apple Silicon M1 Pro & M2)

Additional information

output of `dune build --verbose`:
Shared cache: disabled
Workspace root: /Users/hx/git/sample.bc47-dune-reproduce
Auto-detected concurrency: 8
Dune context:
 { name = "default"
 ; kind = "default"
 ; profile = Dev
 ; merlin = true
 ; for_host = None
 ; fdo_target_exe = None
 ; build_dir = In_build_dir "default"
 ; ocaml_bin = External "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin"
 ; ocaml =
     Ok External "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocaml"
 ; ocamlc =
     External "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlc.opt"
 ; ocamlopt =
     Ok
       External
         "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlopt.opt"
 ; ocamldep =
     Ok
       External
         "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamldep.opt"
 ; ocamlmklib =
     Ok
       External
         "/Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlmklib"
 ; installed_env =
     map
       { "INSIDE_DUNE" :
           "/Users/hx/git/sample.bc47-dune-reproduce/_build/default"
       ; "OCAML_COLOR" : "always"
       ; "OPAMCOLOR" : "always"
       }
 ; findlib_paths =
     [ External "/Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/ocaml"
     ; External "/Users/hx/git/sample.bc47-dune-reproduce/_opam/lib"
     ]
 ; ocaml_config =
     { version = "5.1.0"
     ; standard_library_default =
         "/Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/ocaml"
     ; standard_library =
         "/Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/ocaml"
     ; standard_runtime = "the_standard_runtime_variable_was_deleted"
     ; ccomp_type = "cc"
     ; c_compiler = "cc"
     ; ocamlc_cflags =
         [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread" ]
     ; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
     ; ocamlopt_cflags =
         [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread" ]
     ; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
     ; bytecomp_c_compiler =
         [ "cc"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-pthread"
         ; "-D_FILE_OFFSET_BITS=64"
         ]
     ; bytecomp_c_libraries =
         [ "-L/opt/homebrew/Cellar/zstd/1.5.5/lib"; "-lzstd"; "-lpthread" ]
     ; native_c_compiler =
         [ "cc"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-pthread"
         ; "-D_FILE_OFFSET_BITS=64"
         ]
     ; native_c_libraries =
         [ "-L/opt/homebrew/Cellar/zstd/1.5.5/lib"; "-lzstd"; "-lpthread" ]
     ; native_pack_linker = [ "ld"; "-r"; "-o" ]
     ; cc_profile = []
     ; architecture = "arm64"
     ; model = "default"
     ; int_size = 63
     ; word_size = 64
     ; system = "macosx"
     ; asm = [ "cc"; "-c"; "-Wno-trigraphs" ]
     ; asm_cfi_supported = true
     ; with_frame_pointers = false
     ; ext_exe = ""
     ; ext_obj = ".o"
     ; ext_asm = ".s"
     ; ext_lib = ".a"
     ; ext_dll = ".so"
     ; os_type = "Unix"
     ; default_executable_name = "a.out"
     ; systhread_supported = true
     ; host = "aarch64-apple-darwin23.1.0"
     ; target = "aarch64-apple-darwin23.1.0"
     ; profiling = false
     ; flambda = false
     ; spacetime = false
     ; safe_string = true
     ; exec_magic_number = "Caml1999X033"
     ; cmi_magic_number = "Caml1999I033"
     ; cmo_magic_number = "Caml1999O033"
     ; cma_magic_number = "Caml1999A033"
     ; cmx_magic_number = "Caml1999Y033"
     ; cmxa_magic_number = "Caml1999Z033"
     ; ast_impl_magic_number = "Caml1999M033"
     ; ast_intf_magic_number = "Caml1999N033"
     ; cmxs_magic_number = "Caml1999D033"
     ; cmt_magic_number = "Caml1999T033"
     ; natdynlink_supported = true
     ; supports_shared_libraries = true
     ; windows_unicode = false
     }
 ; instrument_with = []
 }
Actual targets:
- alias @@default
Running[1]: (cd _build/default && /Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlopt.opt -I .hello.eobjs/byte -I .hello.eobjs/native -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site -intf-suffix .ml-gen -no-alias-deps -opaque -o .hello.eobjs/native/dune_site__Dune_site_data.cmx -c -impl .hello.eobjs/dune_site__Dune_site_data.ml-gen)
Running[2]: (cd _build/default && /Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -bin-annot -I .hello.eobjs/byte -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camlp-streams -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile/lib -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-private-libs/dune-section -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site/private -no-alias-deps -opaque -o .hello.eobjs/byte/dune__exe__Hello.cmo -c -impl hello.ml)
Running[3]: (cd _build/default && /Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlopt.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -I .hello.eobjs/byte -I .hello.eobjs/native -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camlp-streams -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile/lib -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-private-libs/dune-section -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site -I /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site/private -intf-suffix .ml -no-alias-deps -opaque -o .hello.eobjs/native/dune__exe__Hello.cmx -c -impl hello.ml)
Running[4]: (cd _build/default && /Users/hx/git/sample.bc47-dune-reproduce/_opam/bin/ocamlopt.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -o hello.exe -linkall /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-private-libs/dune-section/dune_section.cmxa /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site/private/dune_site_private.cmxa .hello.eobjs/native/dune_site__Dune_site_data.cmx /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/dune-site/dune_site.cmxa /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camlp-streams/camlp_streams.cmxa /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile/lib/camomileLib.cmxa /Users/hx/git/sample.bc47-dune-reproduce/_opam/lib/camomile/camomile.cmxa .hello.eobjs/native/dune__exe__Hello.cmx)
Promoting "_build/default/hello.exe" to "hello.exe"

Metadata

Metadata

Assignees

Labels

macosIssues that relate to Dune on macOS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions