windmill-labs / windmill

Open-source developer platform to power your entire infra and turn scripts into webhooks, workflows and UIs. Fastest workflow engine (13x vs Airflow). Open-source alternative to Retool and Temporal.
https://windmill.dev
Other
9.85k stars 462 forks source link

bug: Error while compiling Windmill worker on Windows platform #1836

Open pcgeek86 opened 1 year ago

pcgeek86 commented 1 year ago

Describe the bug

When I try to compile the Windmill worker on the Windows 11 platform, I am receiving an error.

   Compiling gosyn v0.2.3
   Compiling deno_media_type v0.1.0
error: error communicating with database: No such host is known. (os error 11001)
   --> windmill-common\src\jobs.rs:197:8
    |
197 |       Ok(sqlx::query_scalar!(
    |  ________^
198 | |         "select tag from script where hash = $1 AND workspace_id = $2",
199 | |         script_hash.0,
200 | |         w_id
201 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_scalar` (in Nightly builds, run with -Z macro-backtrace for more info)

   Compiling chrono-tz v0.8.3
   Compiling urlpattern v0.2.0
   Compiling progenitor-client v0.3.0 (https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016a)
   Compiling swc_ecma_codegen v0.139.17
   Compiling const_format_proc_macros v0.2.31
error: error communicating with database: No such host is known. (os error 11001)
  --> windmill-common\src\utils.rs:58:8
   |
58 |     Ok(sqlx::query_scalar!("SELECT now()")
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_scalar` (in Nightly builds, run with -Z macro-backtrace for more info)

   Compiling cron v0.12.0
error: error communicating with database: No such host is known. (os error 11001)
   --> windmill-common\src/lib.rs:163:15
    |
163 |       let r_o = sqlx::query!(
    |  _______________^
164 | |         "select hash, tag from script where path = $1 AND workspace_id = $2 AND
165 | |     created_at = (SELECT max(created_at) FROM script WHERE path = $1 AND workspace_id = $2 AND
166 | |     deleted = false AND archived = false AND lock IS not NULL AND lock_error_logs IS NULL)",
167 | |         script_path,
168 | |         w_id
169 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

   Compiling ulid v1.0.0
   Compiling git-version-macro v0.3.5
   Compiling async-recursion v1.0.4
   Compiling dyn-clone v1.0.11
   Compiling deno_fetch v0.133.0
   Compiling git-version v0.3.5
   Compiling const_format v0.2.31
   Compiling deno_url v0.109.0
error: error communicating with database: No such host is known. (os error 11001)
   --> windmill-common\src/lib.rs:183:15
    |
183 |       let r_o = sqlx::query!(
    |  _______________^
184 | |         "select hash, tag from script where path = $1 AND workspace_id = $2 AND
185 | |     created_at = (SELECT max(created_at) FROM script WHERE path = $1 AND workspace_id = $2 AND
186 | |     deleted = false AND archived = false)",
187 | |         script_path,
188 | |         w_id
189 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `tokio::signal::unix`
  --> windmill-common\src/lib.rs:55:24
   |
55 |     use tokio::signal::unix::SignalKind;
   |                        ^^^^ could not find `unix` in `signal`

error[E0432]: unresolved import `hyper`
  --> windmill-common\src\error.rs:17:5
   |
17 | use hyper::StatusCode;
   |     ^^^^^ use of undeclared crate or module `hyper`

error[E0432]: unresolved import `hyper`
  --> windmill-common\src/lib.rs:85:9
   |
85 |     use hyper::StatusCode;
   |         ^^^^^ use of undeclared crate or module `hyper`

error[E0433]: failed to resolve: could not find `unix` in `signal`
  --> windmill-common\src/lib.rs:58:24
   |
58 |         tokio::signal::unix::signal(SignalKind::terminate())?
   |                        ^^^^ could not find `unix` in `signal`

error[E0433]: failed to resolve: use of undeclared crate or module `hyper`
  --> windmill-common\src/lib.rs:81:17
   |
81 | ) -> Result<(), hyper::Error> {
   |                 ^^^^^ use of undeclared crate or module `hyper`

   Compiling postgres-native-tls v0.5.0
   Compiling windmill-parser-go v1.127.1 (C:\git\windmill\backend\parsers\windmill-parser-go)
   Compiling swc_ecma_transforms_base v0.127.18
   Compiling dprint-swc-ext v0.10.0
Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `windmill-common` (lib) due to 9 previous errors
warning: build failed, waiting for other jobs to finish...

Originally posted here: https://discord.com/channels/930051556043276338/1067814967228776448/threads/1128085091772538930

To reproduce

  1. Created Windows 11 VM on Hyper-V
  2. Installed Scoop package manager
  3. Install rustup and git with scoop install rustup git
  4. Install Microsoft C++ Build Tools
  5. PowerShell: mkdir \git; cd \git
  6. git clone https://github.com/windmill-labs/windmill/
  7. cd .\windmill\backend\windmill-worker\
  8. cargo build

Expected behavior

Windmill worker compiles successfully

Screenshots

image image

Browser information

n/a

Application version

main branch

Additional Context

n/a

rubenfiszel commented 1 year ago

A lot of those errors are just because you would need to remove the .env so that the compilation doesn't try to use a live database.

The unix ones are legitimate issues, I would need to use macro to handle windows signals. The hyper one i'm surprised, I would expect hyper to cross-compile to windows.

shad00m commented 10 months ago
error[E0432]: unresolved import `tokio::signal::unix`
  --> windmill-common\src/lib.rs:75:24
   |
75 |     use tokio::signal::unix::SignalKind;
   |                        ^^^^ could not find `unix` in `signal`

error[E0432]: unresolved import `hyper`
  --> windmill-common\src\error.rs:17:5
   |
17 | use hyper::StatusCode;
   |     ^^^^^ use of undeclared crate or module `hyper`

error[E0432]: unresolved import `hyper`
  --> windmill-common\src\utils.rs:14:5
   |
14 | use hyper::{HeaderMap, StatusCode};
   |     ^^^^^ use of undeclared crate or module `hyper`

error[E0432]: unresolved import `hyper`
   --> windmill-common\src/lib.rs:112:9
    |
112 |     use hyper::StatusCode;
    |         ^^^^^ use of undeclared crate or module `hyper`

error[E0433]: failed to resolve: could not find `unix` in `signal`
  --> windmill-common\src/lib.rs:78:24
   |
78 |         tokio::signal::unix::signal(SignalKind::terminate())?
   |                        ^^^^ could not find `unix` in `signal`

error[E0282]: type annotations needed
  --> windmill-common\src\utils.rs:96:5
   |
96 |     Ok((status, response.headers().clone(), response))
   |     ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
   |
help: consider specifying the generic arguments
   |
96 |     Ok::<(StatusCode, HeaderMap, reqwest::Response), E>((status, response.headers().clone(), response))
   |       +++++++++++++++++++++++++++++++++++++++++++++++++

Some errors have detailed explanations: E0282, E0432, E0433.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `windmill-common` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...

Any update on this? I was surprised, a lot of basic cmdlets are not available in Powershell on Linux.

rubenfiszel commented 10 months ago

The unix signal is easy to gate behind a feature flag but not sure why hyper doesn't compile out of the box. We do not have enough customers requiring windmill binaries under Windows and we have quite a bit of priority items so this will have to be contributed by the community for now. As a note, windmill does work with windows using WSL and docker.

shad00m commented 10 months ago

As a note, windmill does work with windows using WSL and docker.

Thank you for the tip with the WSL. The Powershell in WSL is perfect but how do I get the Worker Containers to use the Powershell from the Host? I tried adding the WSL Powershell folder as a volume but the container couldnt execute it.