Skip to content

Flags.write_lines raises Code_error #1166

@mmottl

Description

@mmottl

Consider the following dune and discover.ml files:

(executable
  (name discover)
  (modules discover)
  (libraries dune.configurator))
let () =
  let module C = Configurator.V1 in
  C.main ~name:"foo" (fun _c ->
    C.Flags.write_lines "foo" ["asdf"])

Executing the application with dune exec ./discover.exe gives:

run: /Users/mmottl/.opam/4.07.0/bin/ocamlc.opt -config
-> process exited with code 0
-> stdout:
 | version: 4.07.0
 | standard_library_default: /Users/mmottl/.opam/4.07.0/lib/ocaml
 | standard_library: /Users/mmottl/.opam/4.07.0/lib/ocaml
 | standard_runtime: /Users/mmottl/.opam/4.07.0/bin/ocamlrun
 | ccomp_type: cc
 | c_compiler: cc
 | ocamlc_cflags: -O2 -fno-strict-aliasing -fwrapv
 | ocamlc_cppflags: -D_FILE_OFFSET_BITS=64 -D_REENTRANT
 | ocamlopt_cflags: -O2 -fno-strict-aliasing -fwrapv
 | ocamlopt_cppflags: -D_FILE_OFFSET_BITS=64 -D_REENTRANT
 | bytecomp_c_compiler: cc -O2 -fno-strict-aliasing -fwrapv  -D_FILE_OFFSET_BITS=64 -D_REENTRANT
 | native_c_compiler: cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT
 | bytecomp_c_libraries: -lpthread
 | native_c_libraries:
 | native_pack_linker: ld -r -o
 | ranlib: ranlib
 | cc_profile: -pg
 | architecture: amd64
 | model: default
 | int_size: 63
 | word_size: 64
 | system: macosx
 | asm: clang -arch x86_64 -Wno-trigraphs -c
 | 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: x86_64-apple-darwin17.7.0
 | target: x86_64-apple-darwin17.7.0
 | profiling: true
 | flambda: false
 | spacetime: false
 | safe_string: false
 | default_safe_string: true
 | flat_float_array: true
 | afl_instrument: false
 | windows_unicode: false
 | exec_magic_number: Caml1999X023
 | cmi_magic_number: Caml1999I023
 | cmo_magic_number: Caml1999O023
 | cma_magic_number: Caml1999A023
 | cmx_magic_number: Caml1999Y023
 | cmxa_magic_number: Caml1999Z023
 | ast_impl_magic_number: Caml1999M023
 | ast_intf_magic_number: Caml1999N023
 | cmxs_magic_number: Caml1999D023
 | cmt_magic_number: Caml1999T023
-> stderr:
Fatal error: exception Stdune__Exn.Code_error(_)

The error message associated with Code_error is: build_dir: cannot use build dir before it's set.

Is this a bug or do I need to do anything differently?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions