WIP: Windows support #925

Draft
mediocregopher wants to merge 8 commits from mediocregopher/garage:windows-v1 into main
First-time contributor

I'll be clear up front that I'm not really expecting to get this merged as it is. But I saw that others are interested in windows support (#536), so I thought I'd contribute my work back. What I did here on the rust side overlaps a bit with #891, but I've gone further and gotten cross-compiling from linux to windows apparently working. I say "apparently" because I haven't fully tested it yet, but it does compile and the binary does work in a VM.

Performing the actual cross-compilation cannot be done via flake.nix or default.nix. The default.nix is broken anyway, and flake.nix wants to build a full release binary, but not all features are currently supported, only the base ones, so this fails. To test this you have to do something like:

  let
  
    pkgsSrc = DIY;

    src = builtins.fetchGit {
      name = "garage-v1.0.1-windows";
      url = "git@git.deuxfleurs.fr:mediocregopher/garage.git";
      rev = "8edf5aab228d93b79e2c6b6a3f2402fffdc4c4ab";
    };

    common = (import "${src}/nix/common.nix") {
        system = builtins.currentSystem;
    };

    compile = (import "${src}/nix/compile.nix") {
      system = builtins.currentSystem;
      target = "x86_64-w64-mingw32";
      pkgsSrc = pkgsSrc;

      cargo2nixOverlay = common.cargo2nixOverlay;

      release = true;
      git_version = "windows-debug";

      features = [
        "garage/bundled-libs"
        "garage/lmdb"
        "garage/sqlite"
        "garage/metrics"
        "garage/k2v"
      ];
    };

  in
    compile.workspace.garage {}

In the next few weeks I'll be working on testing this more thoroughly, but in the meantime any feedback would be great.

I'll be clear up front that I'm not really expecting to get this merged as it is. But I saw that others are interested in windows support (#536), so I thought I'd contribute my work back. What I did here on the rust side overlaps a bit with #891, but I've gone further and gotten cross-compiling from linux to windows apparently working. I say "apparently" because I haven't fully tested it yet, but it does compile and the binary does work in a VM. Performing the actual cross-compilation cannot be done via `flake.nix` or `default.nix`. The `default.nix` is broken anyway, and `flake.nix` wants to build a full release binary, but not all features are currently supported, only the base ones, so this fails. To test this you have to do something like: ```nix let pkgsSrc = DIY; src = builtins.fetchGit { name = "garage-v1.0.1-windows"; url = "git@git.deuxfleurs.fr:mediocregopher/garage.git"; rev = "8edf5aab228d93b79e2c6b6a3f2402fffdc4c4ab"; }; common = (import "${src}/nix/common.nix") { system = builtins.currentSystem; }; compile = (import "${src}/nix/compile.nix") { system = builtins.currentSystem; target = "x86_64-w64-mingw32"; pkgsSrc = pkgsSrc; cargo2nixOverlay = common.cargo2nixOverlay; release = true; git_version = "windows-debug"; features = [ "garage/bundled-libs" "garage/lmdb" "garage/sqlite" "garage/metrics" "garage/k2v" ]; }; in compile.workspace.garage {} ``` In the next few weeks I'll be working on testing this more thoroughly, but in the meantime any feedback would be great.
mediocregopher added 7 commits 2025-01-14 16:43:08 +00:00
mediocregopher added 1 commit 2025-01-15 10:35:38 +00:00
Merge remote-tracking branch 'origin/main' into windows-v1
Some checks are pending
ci/woodpecker/pr/debug Pipeline is pending
b1c664a8ab
Some checks are pending
ci/woodpecker/pr/debug Pipeline is pending
Required
Details
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u windows-v1:mediocregopher-windows-v1
git checkout mediocregopher-windows-v1
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Deuxfleurs/garage#925
No description provided.