Config_main(3)

πŸ’– Config_main(3) β€” System configuration πŸ’–

okay bestie, this is the Config_main(3) page β€” the system-configuration module that’s basically the compiler’s little ID card, and this is part 1 of the saga. No goodbye at the end, because more parts are coming. πŸ’…

🌸 NAME 🌸

Config_main β€” System configuration

🧩 Module 🧩

Module Config_main

πŸ“š Documentation πŸ“š

Module Config_main : sig end

System configuration

⚠️ Warning: this module is unstable and part of Compiler_libs.

Here come all the vals in order, bestie β€” no skipping, no β€œoops I forgot one.” 🫢

  • val version : string β€” the current version number of the system. ✨
  • val release_number : int β€” the release number for the compiler. Since 5.5
  • val is_official_release : bool β€” True if the compiler is an unmodified official OCaml release. Since 5.5
  • val bindir : string β€” the directory containing the binary programs. If the compiler was configured with --with-relative-libdir then this will be the directory containing the currently executing runtime.
  • val standard_library_relative : string option β€” the explicit relative path from the compiler binaries to the standard libraries directory if the compiler was configured with --with-relative-libdir, or None otherwise. Since 5.5
  • val target_bindir : string β€” the directory containing the runtime binaries on the target system. Since 5.5
  • val standard_library_default : string β€” the effective value for the default directory containing the standard libraries. This is always an absolute path, computed using Config_main.standard_library_relative if necessary. Since 5.5
  • val standard_library : string β€” the effective directory containing the standard libraries, taking CAMLLIB and OCAMLLIB into account.
  • val ccomp_type : string β€” the β€œkind” of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM). πŸ› οΈ
  • val c_compiler : string β€” the compiler to use for compiling C files.
  • val c_compiler_vendor : string β€” the vendor and version of the C compiler. Consists of hyphenated values where the first part indicates the C compiler’s vendor and remaining parts indicate the version of the C compiler, as reported by that C compiler’s preprocessor.

Possible values are:

  • -msvc β€” Windows, using Microsoft Visual Studio. _MSC_VER follows and optionally clang- if clang-cl, rather than Visual Studio itself, is in use.
  • -icc β€” Intel C Compiler.
  • -mingw β€” Windows, using the mingw-w64 project. The major and minor version of mingw-w64 itself follow and then either gcc- or clang- indicating which C compiler is in use.
  • -clang β€” Clang LLVM C Compiler.
  • -gcc β€” GNU Compiler Collection C Compiler.
  • -xlc β€” IBM XL C Compiler.
  • -sunc β€” Oracle Solaris Studio.
  • -unknown β€” unknown compiler vendor. No additional version info.

Since 5.5

  • val c_output_obj : string β€” name of the option of the C compiler for specifying the output file.
  • val c_has_debug_prefix_map : bool β€” whether the C compiler supports -fdebug-prefix-map.
  • val as_has_debug_prefix_map : bool β€” whether the assembler supports --debug-prefix-map.
  • val as_is_cc : bool β€” whether the assembler is actually an assembler, or whether we are really assembling files via the C compiler. Since 5.5
  • val bytecode_cflags : string β€” the flags ocamlc should pass to the C compiler.
  • val bytecode_cppflags : string β€” the flags ocamlc should pass to the C preprocessor.
  • val native_cflags : string β€” the flags ocamlopt should pass to the C compiler.
  • val native_cppflags : string β€” the flags ocamlopt should pass to the C preprocessor.
  • val bytecomp_c_libraries : string β€” the C libraries to link with custom runtimes.
  • val native_c_libraries : string β€” the C libraries to link with native-code programs.
  • val compression_c_libraries : string β€” the C libraries needed with -lcomprmarsh (should appear before Config_main.native_c_libraries in a call to the C compiler). Since 5.4
  • val native_ldflags : string β€” the page doesn’t give a description here, bestie; it’s just the type and the vibe. πŸ™ˆ
  • val with_nonexecstack_note : bool β€” whether an explicit ".note.GNU-stack" section is to be added to indicate the stack should not be executable. Since 5.4
  • val native_pack_linker : string β€” the linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).
  • val mkdll : string β€” the linker command line to build dynamic libraries.
  • val mkexe : string β€” the linker command line to build executables.
  • val mkmaindll : string β€” the linker command line to build main programs as dlls.
  • val default_rpath : string β€” option to add a directory to be searched for libraries at runtime (used by ocamlmklib).
  • val mksharedlibrpath : string β€” option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib).
  • val ar : string β€” name of the ar command, or "" if not needed (MSVC).
  • val interface_suffix : string ref β€” suffix for interface file names.
  • val exec_magic_number : string β€” magic number for bytecode executable files.
  • val cmi_magic_number : string β€” magic number for compiled interface files.
  • val cmo_magic_number : string β€” magic number for object bytecode files.
  • val cma_magic_number : string β€” magic number for archive files.
  • val cmx_magic_number : string β€” magic number for compilation unit descriptions.
  • val cmxa_magic_number : string β€” magic number for libraries of compilation unit descriptions.
  • val ast_intf_magic_number : string β€” magic number for file holding an interface syntax tree.
  • val ast_impl_magic_number : string β€” magic number for file holding an implementation syntax tree.
  • val cmxs_magic_number : string β€” magic number for dynamically-loadable plugins.
  • val cmt_magic_number : string β€” magic number for compiled interface files.
  • val linear_magic_number : string β€” magic number for Linear internal representation files.
  • val max_tag : int β€” biggest tag that can be stored in the header of a regular block.
  • val lazy_tag : int β€” normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.
  • val max_young_wosize : int β€” maximal size of arrays that are directly allocated in the minor heap.
  • val stack_threshold : int β€” size in words of safe area at bottom of VM stack, see runtime/caml/config.h.
  • val stack_safety_margin : int β€” size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.
  • val native_compiler : bool β€” whether the native compiler is available or not. Since 5.1
  • val architecture : string β€” name of processor type for the native-code compiler.
  • val model : string β€” name of processor submodel for the native-code compiler.
  • val system : string β€” name of operating system for the native-code compiler.
  • val target_os_type : string β€” operating system targeted by the native-code compiler. One of:
    • "Unix" β€” for all Unix versions, including Linux and macOS,
    • "Win32" β€” for MS-Windows, OCaml compiled with MSVC++ or MinGW-w64,
    • "Cygwin" β€” for MS-Windows, OCaml compiled with Cygwin.

Since 5.4

  • val target_unix : bool β€” True if target_os_type = "Unix". Since 5.5
  • val target_win32 : bool β€” True if target_os_type = "Win32". Since 5.5
  • val target_cygwin : bool β€” True if target_os_type = "Cygwin". Since 5.5
  • val asm : string β€” the assembler (and flags) to use for assembling ocamlopt-generated code.
  • val asm_cfi_supported : bool β€” whether assembler understands CFI directives.
  • val asm_size_type_directives : bool β€” whether the .size and .type assembler directives can be used. Since 5.4
  • val asm_dwarf_version : int option β€” the DWARF Version emitted by the Config_main.asm command. At present this is only implemented for the clang internal assembler, all other assemblers have None. Since 5.5
  • val with_frame_pointers : bool β€” whether assembler should maintain frame pointers.
  • val ext_obj : string β€” extension for object files, e.g. .o under Unix.
  • val ext_asm : string β€” extension for assembler files, e.g. .s under Unix.
  • val ext_lib : string β€” extension for library files, e.g. .a under Unix.
  • val ext_dll : string β€” extension for dynamically-loaded libraries, e.g. .so under Unix.
  • val ext_exe : string β€” extension for executable programs, e.g. .exe under Windows. Since 4.12
  • val default_executable_name : string β€” name of executable produced by linking if none is given with -o, e.g. a.out under Unix.
  • val systhread_supported : bool β€” whether the system thread library is implemented.
  • val flexdll_dirs : string list β€” directories needed for the FlexDLL objects.
  • val host : string β€” whether the compiler is a cross-compiler. (Yep, that’s the description on the page β€” same energy as target.)
  • val target : string β€” whether the compiler is a cross-compiler.
  • val flambda : bool β€” whether the compiler was configured for flambda.
  • val with_flambda_invariants : bool β€” whether the invariants checks for flambda are enabled.
  • val with_cmm_invariants : bool β€” whether the invariants checks for Cmm are enabled.
  • val with_codegen_invariants : bool β€” whether the invariant checks for native code generation are enabled.
  • val reserved_header_bits : int β€” how many bits of a block’s header are reserved.
  • val flat_float_array : bool β€” whether the compiler and runtime automagically flatten float arrays.
  • val align_double : bool β€” whether the compiler and runtime need to align double values. If false, a floatarray value can be cast to a C array of doubles.
  • val align_int64 : bool β€” whether the compiler and runtime need to align int64 values.
  • val function_sections : bool β€” whether the compiler was configured to generate each function in a separate section.
  • val windows_unicode : bool β€” whether Windows Unicode runtime is enabled.
  • val naked_pointers : bool β€” whether the runtime supports naked pointers. Since 4.14
  • val supports_shared_libraries : bool β€” whether shared libraries are supported. Since 4.08
  • val native_dynlink : bool β€” whether native shared libraries are supported. Since 5.1
  • val afl_instrument : bool β€” whether afl-fuzz instrumentation is generated by default.
  • val ar_supports_response_files : bool β€” whether ar supports @FILE arguments.
  • val tsan : bool β€” whether ThreadSanitizer instrumentation is enabled.

And now the launch_method type era, bestie β€” it’s giving launch-mechanism main character energy. ✨

       type launch_method =
        | Executable  (* Use the executable launcher stub
        *)
        | Shebang of string option
         (* Use a shebang-style launcher. Whenever possible, the interpreter
       will be the runtime itself, but if the path to the runtime is not valid
       for a shebang line, then a shell script is generated. When this is
       necessary, the parameter in Shebang (Some sh) is the full path to sh ;
       if the parameter is None , then the linker searches PATH for sh .
        *)

Launch mechanisms for bytecode executables. Since 5.5

  • val launch_method : launch_method

πŸš€ Default launch mechanism for bytecode executables

Okay so this one is Since 5.5 and it's all about how bytecode executables find their interpreter πŸ‘€

type search_method =
 | Disable  (* Interpreter searching disabled - check fixed absolute location only
 *)
 | Fallback  (* Check fixed absolute location first, but fall back to a search if that fails
 *)
 | Enable  (* Always search for the interpreter
 *)

Mechanisms used by tendered bytecode executables to locate the interpreter πŸ’…

Here's the vibe check on each variant:

  • Disable β€” interpreter searching is off, bestie. It'll only check the fixed absolute location, that's it, no hunting around πŸ”’
  • Fallback β€” it peeks at the fixed absolute location first, but if that fails it falls back to a search 🫢
  • Enable β€” always search for the interpreter, no notes, main character energy ✨

  • val search_method : search_method β€” the default search mechanism for bytecode executables πŸŽ€ Since 5.5
  • val shebangscripts : bool β€” whether the target supports shebang scripts 🌸 Since 5.5
  • val suffixing : bool β€” whether the runtime executable and shared library filenames and C stub library filenames are being mangled with Runtime IDs and the Config_main.target πŸ”₯ Since 5.5
  • val bytecode_runtime_id : string β€” the Runtime ID for this build of the bytecode runtime system πŸ‘‘ Since 5.5
  • val native_runtime_id : string β€” the Runtime ID for this build of the native runtime system πŸ’œ Since 5.5
  • val print_config : out_channel -> unit β€” access to configuration values, literally hands you the whole config 😭
  • val config_var : string -> string option β€” the configuration value of a variable, if it exists πŸ‘€ (and if it doesn't, well… option said what it said πŸ’€)

ngl that's the whole thing bestie β€” every val, every variant, every Since 5.5, all accounted for 🧚

And that's a wrap on Config_main(3)! This lil doc was brought to you by OCamldoc, version/date stamped 2026-06-22 β€” go forth and configure, you gorgeous icon πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from