awslabs / coldsnap

A command line interface for Amazon EBS snapshots
Apache License 2.0
177 stars 24 forks source link

How can I use this tool on Windows #339

Open ronenfe opened 6 days ago

ronenfe commented 6 days ago

I'm running the AWS CLI in windows command prompt. How can I download and use this tool?

ronenfe commented 6 days ago

Ok, I had to first install VS Build tools C++ and Rust for windows.

ronenfe commented 6 days ago

Installation failed with following errors:

 Compiling coldsnap v0.6.1
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\block_device.rs:11:14
   |
11 | use std::os::unix::io::AsRawFd;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:26:9
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:64:9

error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\download.rs:21:14
   |
21 | use std::os::unix::fs::FileTypeExt;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:26:9
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:64:9

error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\upload.rs:25:14
   |
25 | use std::os::unix::fs::FileTypeExt;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:26:9
note: found an item that was configured out
  --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:64:9

error[E0432]: unresolved import `nix::ioctl_read`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\block_device.rs:20:9
   |
20 |     use nix::ioctl_read;
   |         ^^^^^^^^^^^^^^^ no `ioctl_read` in the root

error[E0425]: cannot find function `blkgetsize64` in module `ioctl`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\block_device.rs:32:34
   |
32 |     let result = unsafe { ioctl::blkgetsize64(file.as_raw_fd(), &mut block_device_size) }
   |                                  ^^^^^^^^^^^^ not found in `ioctl`

error[E0412]: cannot find type `Error` in crate `nix`
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\block_device.rs:60:58
   |
60 |         GetBlockDeviceSize { path: PathBuf, source: nix::Error },
   |                                                          ^^^^^ not found in `nix`
   |
help: consider importing one of these items
   |
47 +     use aws_sdk_ebs::Error;
   |
47 +     use aws_sdk_ec2::Error;
   |
47 +     use core::error::Error;
   |
47 +     use core::fmt::Error;
   |
     and 11 other candidates
help: if you import `Error`, refer to it directly
   |
60 -         GetBlockDeviceSize { path: PathBuf, source: nix::Error },
60 +         GetBlockDeviceSize { path: PathBuf, source: Error },
   |

error[E0599]: no method named `is_block_device` found for struct `FileType` in the current scope
   --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\download.rs:449:34
    |
449 |         if file_meta.file_type().is_block_device() {
    |                                  ^^^^^^^^^^^^^^^ method not found in `FileType`

error[E0599]: no method named `is_block_device` found for struct `FileType` in the current scope
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\upload.rs:85:50
   |
85 |         let file_size = if file_meta.file_type().is_block_device() {
   |                                                  ^^^^^^^^^^^^^^^ method not found in `FileType`

error[E0599]: no method named `as_raw_fd` found for struct `std::fs::File` in the current scope
  --> C:\Users\ronen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\coldsnap-0.6.1\src\block_device.rs:32:52
   |
32 |     let result = unsafe { ioctl::blkgetsize64(file.as_raw_fd(), &mut block_device_size) }
   |                                                    ^^^^^^^^^
   |
help: there is a method `as_raw_handle` with a similar name
   |
32 |     let result = unsafe { ioctl::blkgetsize64(file.as_raw_handle(), &mut block_device_size) }
   |                                                    ~~~~~~~~~~~~~

Some errors have detailed explanations: E0412, E0425, E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `coldsnap` (lib) due to 9 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `coldsnap v0.6.1`, intermediate artifacts can be found at `C:\Users\ronen\AppData\Local\Temp\cargo-installlVxVyd`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
rpkelly commented 6 days ago

Hi, thanks for your interest in using coldsnap. Unfortunately, this tool only supports unix based operating systems (as seen in the error you're hitting trying to compile on Windows). I would assume that the Windows Subsystem for Linux (WSL) would be enough to run this, but I have not tested it