shiplift icon indicating copy to clipboard operation
shiplift copied to clipboard

Won't compile on Windows on master branch

Open arthmis opened this issue 5 years ago • 5 comments

  • Crate version: I'm using 17651193edad67f10f9e139d5b86b2d31665c0a6 of the master branch to get support for latest version of futures.
  • OS: I'm on Windows 10
  • Output of running docker version on the command line:
Client: Docker Engine - Community
 Cloud integration: 1.0.2
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:00:27 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:07:04 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

The error I'm getting is:

thread 'main' panicked at 'Unix socket support is disabled', C:\Users\Buttah\.cargo\git\checkouts\shiplift-48fc668b583d42d4\1765119\src\lib.rs:975:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace     
error: process didn't exit successfully: `target\debug\amazon-price-scraper.exe` (exit code: 101)

My Cargo.toml is:

[package]
name = "some-name"
version = "0.1.0"
authors = []
edition = "2018"

[dependencies]
scraper = "0.12.0"
prettytable-rs = "0.8.0"
textwrap = "0.12.1"
url = "2.2.0"
anyhow = "1"
async-std = {version = "1", features = ["attributes", "tokio03", "tokio02"]}
futures = "0.3.8"
cdrs-tokio = "1"
chrono = "0.4"
reqwest = { version = "0.10.9", features = ["brotli", "gzip", "native-tls", "cookies"] }
shiplift = { git = "https://github.com/softprops/shiplift.git", default-features = false, features = ["tls"] }

I think Windows support is being worked on. So I wonder if help is needed getting Windows to compile and what the issues are currently. Also how can I get around this issue?

arthmis avatar Dec 04 '20 04:12 arthmis

You cannot use Docker::new() with unix socket support disabled! You need to use Docker::host().

matthiasbeyer avatar Mar 06 '21 07:03 matthiasbeyer

I think we should look into alternative ways to initialize Dockers since Docker::new() failing without unix sockets is certainly unintuitive. https://github.com/softprops/shiplift/pull/256 looked into this a bit and I think would be a good start at least, but I think that we should probably make it so Docker::new() is smarter (or doesn't exist without unix sockets).

elihunter173 avatar Mar 07 '21 02:03 elihunter173

I think we should look into alternative ways to initialize Dockers since Docker::new() failing without unix sockets is certainly unintuitive. https://github.com/softprops/shiplift/pull/256 looked into this a bit and I think would be a good start at least, but I think that we should probably make it so Docker::new() is smarter (or doesn't exist without unix sockets).

Agreed. Even better, instead of feature flags, those dependencies should IMO simply be chosen based on the target platform. There is little reason for pushing this responsibility to every user when it could just be solved once within shiplift.

thomaseizinger avatar Mar 07 '21 06:03 thomaseizinger

dependencies should IMO simply be chosen based on the target platform.

I'm not sure I like that, because it makes things harder if someone works for code on platform A while developing on platform B, right?

I agree that Docker::new is unintuitive and we should make the API more explicit.

matthiasbeyer avatar Mar 07 '21 07:03 matthiasbeyer

I'm not sure I like that, because it makes things harder if someone works for code on platform A while developing on platform B, right?

I've been in exactly this situation with shiplift. I was developing on Linux but the app had to work on Linux, MacOS and Windows. In the end, I had to request a windows machine for testing and set up a development environment there because there was no way otherwise to figure out, what exactly I needed to enable and patch for shiplift to work on Windows.

If anything, situations like that get easier because you don't have to care about the differences between platform A and B. You just code against a single API and the library will figure out the right thing to do based on the plethora of target related conditional compilation options.

FWIW getrandom takes exactly this approach.

thomaseizinger avatar Mar 07 '21 22:03 thomaseizinger