Skip to content

Dune 3.4+ broken in esy on Windows #6098

@phated

Description

@phated

Expected Behavior

Dune 3.4+ should build inside esy on Windows.

Actual Behavior

Dune fails to build with this log:

# esy-build-package: building: @opam/dune@opam:3.4.1
# esy-build-package: pwd: C:\Users\grain\.esy\3\b\opam__s__dune-opam__c__3.4.1-4a143223
# esy-build-package: running: "ocaml" "bootstrap.ml" "-j" "4"
ocamlc -output-complete-exe -w -24 -g -o .duneboot.exe -I boot unix.cma boot/libs.ml boot/duneboot.ml
.\.duneboot.exe -j 4
cd _boot && C:\Users\grain\.esy\3_\i\ocaml-4.14.0-cd77a8d9\bin\ocamlopt.opt.exe -o ..\dune.exe -g -I +threads unix.cmxa threads.cmxa -no-alias-deps -w -49-6 readdir.c wait3_stubs.c xdg_stubs.c spawn_stubs.c dune_stats_stubs.c fsevents_stubs.c inotify_stubs.c pthread_chdir_stubs.c -args mods_list -cclib -lshell32 -cclib -lole32 -cclib -luuid -alert -unstable
otherlibs/xdg\xdg_stubs.c: In function 'dune_xdg__get_known_folder_path':
otherlibs/xdg\xdg_stubs.c:35:9: warning: implicit declaration of function 'SHGetKnownFolderPath'; did you mean 'SHGetFolderPath'? [-Wimplicit-function-declaration]
otherlibs/xdg\xdg_stubs.c:41:38: error: 'WC_ERR_INVALID_CHARS' undeclared (first use in this function); did you mean 'MB_ERR_INVALID_CHARS'?
otherlibs/xdg\xdg_stubs.c:41:38: note: each undeclared identifier is reported only once for each function it appears in
error: command failed: "ocaml" "bootstrap.ml" "-j" "4"

The issues seem to be SHGetKnownFolderPath and WC_ERR_INVALID_CHARS in the xdg stubs.

Reproduction

  1. On Windows, create an esy.json with the following:
{
    "dependencies": {
        "ocaml": "4.14.0",
        "@opam/dune": "3.4.1"
    },
    "esy": {
        "build": [
            "dune build -p #{self.name}"
        ]
    }
}
  1. Try to build the project by running esy
  2. You'll see the same error as posted above

Specifications

  • Version of dune (output of dune --version): 3.4.1
  • Version of ocaml (output of ocamlc --version) 4.14.0
  • Operating system (distribution and version): Windows (Server 2019)

Additional information

  • Link to gist with verbose output (run dune with the --verbose flag):

Metadata

Metadata

Assignees

No one assigned

    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