octaltree / playwright-rust

Playwright port to Rust
316 stars 36 forks source link

Can't cross compile to windows #19

Closed onx2 closed 2 years ago

onx2 commented 2 years ago

I'm trying to compile for Windows from Ubuntu 20.x but Playwright seems to be failing during the process.

I ran the following commands to make it possible to cross compile (or at least that's what a stack overflow article said 😅 ):

rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu

cargo build --target x86_64-pc-windows-gnu;

Here is the outputted error:

rror: couldn't read /home/onx2/Documents/my-project/target/x86_64-pc-windows-gnu/debug/build/playwright-33e13a0aa96f0c95/out\driver.zip: No such file or directory (os error 2)
  --> /home/onx2/.cargo/registry/src/github.com-1ecc6299db9ec823/playwright-0.0.18/src/imp/core/driver.rs:21:32
   |
21 |     const ZIP: &'static [u8] = include_bytes!(concat!(env!("OUT_DIR"), sep!(), "driver.zip"));
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read /home/onx2/Documents/my-project/target/x86_64-pc-windows-gnu/debug/build/playwright-33e13a0aa96f0c95/out\platform: No such file or directory (os error 2)
  --> /home/onx2/.cargo/registry/src/github.com-1ecc6299db9ec823/playwright-0.0.18/src/imp/core/driver.rs:22:36
   |
22 |     const PLATFORM: &'static str = include_str!(concat!(env!("OUT_DIR"), sep!(), "platform"));
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `playwright` due to 2 previous errors
octaltree commented 2 years ago

Cross-compilation was implemented, but not released, so it was released as 0.0.19. Try it out

onx2 commented 2 years ago

Thanks for the quick response! Yes, 0.0.19 works perfectly.