tonarino / shadergarden

Create evolving artistic images with hot-code-reloaded Lisp and GLSL.
https://blog.tonari.no/shadergarden
MIT License
106 stars 5 forks source link

Build failed on Windows 10 #9

Closed carstenheisterkamp closed 3 years ago

carstenheisterkamp commented 3 years ago

Build fails on Windows 10 during installation

Steps to reproduce

cargo install shadergarden

Result

 Updating crates.io index
  Downloaded shadergarden v0.2.0
  [...]
  Compiling ffmpeg-sys-next v4.4.0

error: failed to run custom build command for `ffmpeg-sys-next v4.4.0`

Caused by:
  process didn't exit successfully: `C:\Users\ch\AppData\Local\Temp\cargo-installwMnxXw\release\build\ffmpeg-sys-next-b34b3bdb9c46bf88\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBAVUTIL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Command { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"libavutil\"", cause: Os { code: 2, kind: NotFound, message: "Das System kann die angegebene Datei nicht finden." } }', C:\Users\ch\.cargo\registry\src\github.com-1ecc6299db9ec823\ffmpeg-sys-next-4.4.0\build.rs:701:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `shadergarden v0.2.0`, intermediate artifacts can be found at `C:\Users\ch\AppData\Local\Temp\cargo-installwMnxXw`

Caused by:
  build failed
strohel commented 3 years ago

This seems to be a build failure of https://github.com/zmwangx/rust-ffmpeg-sys Looking at the build.rs it seems to try to fetch ffmpeg if it is not installed - if the build feature on ffmpeg-sys-next is enabled. I suggest trying to toggle that feature flag to see if that helps. Alternatively you may try installing ffmpeg priori to building shadergarden.

strohel commented 3 years ago

Sorry, I didn't mean to close this issue.

slightknack commented 3 years ago

Thanks for bringing this to my attention, @carstenheisterkamp! Does building ffmpeg-sys-next alone work on your machine?

carstenheisterkamp commented 3 years ago

@slightknack it does not work neither with a similar error. The Message in German means, that it can not find a file.

slightknack commented 3 years ago

Do you have ffmpeg / libavutil installed?

carstenheisterkamp commented 3 years ago

@slightknack I have ffmpeg installed in c:\ffmpeg\bin and the environment variable set. @strohel how can I toggle the feature flag? I am quite new to Rust.

slightknack commented 3 years ago

Hmm, interesting. I'm not that well-versed in Windows; what it looks like is that the compiler is having a hard time finding libavutil. Do you have pkg-config for locating libraries to compile software against installed?

On Tue, Sep 21, 2021 at 12:33 PM Carsten Heisterkamp < @.***> wrote:

@slightknack https://github.com/slightknack I have ffmpeg installed in c:\ffmpeg\bin and the environment variable set.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tonarino/shadergarden/issues/9#issuecomment-923851369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANCIUGX7K2GEUYFMLCE2EHTUDBNQTANCNFSM5EMORU4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

carstenheisterkamp commented 3 years ago

No unfortunately not. The standard Windows installation of ffmpeg is just unzipping 3 executables and the docs. But I found a similar post on reddit which recommends to use the shared version. It contains a libavutil.dll.a but did not solve the issue.

slightknack commented 3 years ago

Even if you have libavutil.dll.a installed, cargo may not be able to find it because it uses pkg-config to locate shared library versions. I found this guide to installing pkg-config on Windows, let me know if it helps.

ffmpeg is only used for input, so I've pushed a new version that has ffmpeg as an optional dependency (#10). Try checking out the no-ffmpeg branch and building from source with the newly-added ffmpeg feature flag disabled. Hope this helps!

On Thu, Sep 23, 2021 at 10:01 AM Carsten Heisterkamp < @.***> wrote:

No unfortunately not. The standard Windows installation of ffmpeg is just unzipping 3 executables and the docs. But I found a similar post on reddit https://www.reddit.com/r/ffmpeg/comments/jr1poj/missing_libavutil_package/ which recommends to use the shared version. It contains a libavutil.dll.a but did not solve the issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tonarino/shadergarden/issues/9#issuecomment-925587072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANCIUGXMXZJ5SAYQFBUXTDDUDLNF5ANCNFSM5EMORU4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

slightknack commented 3 years ago

10 has been merged, let me know if building without the feature enabled works for you!

carstenheisterkamp commented 3 years ago

Thanks @slighnack but it still doesnt work and it seems to ignore the "optional" since it still tries to compile the ffmpeg features. When I remove them from the Manifest and ruhn it with cargo it throws new errors like `[{float}; 2] is not an iteratorin src\util\mod.rs:58:22`. May be its my machine and I will double check it on another Windows machine.

slightknack commented 3 years ago

Interesting... compiling with --no-default-features should not try to compile the ffmpeg features. I would try the following:

  1. Running rustup update to ensure you're on the latest version of the Rust toolchain
  2. Removing shadergarden and running git clone https://github.com/tonarino/shadergarden again, to get a fresh version
  3. cd'ing into the new shadergarden and running cargo build --no-default-features
  4. If that works, run an example with cargo run --no-default-features -- run demos/life
  5. If that works, install from source using cargo install --path . --force --no-default-features
  6. If installing works, try restarting your shell and running shadergarden --help to verify it's installed
  7. If the installation was successful, try running shadergraph run demos/life

Let me know how that goes, and on which step things stop working, if any. This should work (I've verified this process works on my machine), but then again, I don't have a windows machine on which to reproduce the issue.

carstenheisterkamp commented 3 years ago

Many thanks for the explanation, since I am new to the rust wold I wasnt aware that I need to use the no default flag and assumed that it was handled by the manifest.

Now I get the following error:

[...]

Compiling include_dir v0.6.1
 Compiling structopt v0.3.22
 Compiling shadergarden v0.2.0
 warning: unused import: `path::PathBuf`
 --> src\util\mod.rs:2:5
  |
2 |     path::PathBuf,
  |     ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: `[{float}; 2]` is not an iterator
  --> src\util\mod.rs:57:18
   |
57 |         for a in [0.0, 1.0] {
   |                  ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
   |
   = help: the trait `Iterator` is not implemented for `[{float}; 2]`
   = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
   = note: required because of the requirements on the impl of `IntoIterator` for `[{float}; 2]`
   = note: required by `std::iter::IntoIterator::into_iter`

error[E0277]: `[{float}; 2]` is not an iterator
  --> src\util\mod.rs:58:22
   |
58 |             for b in [0.0, 1.0] {
   |                      ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
   |
   = help: the trait `Iterator` is not implemented for `[{float}; 2]`
   = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
   = note: required because of the requirements on the impl of `IntoIterator` for `[{float}; 2]`
   = note: required by `std::iter::IntoIterator::into_iter`

[...]

slightknack commented 3 years ago

That's weird, I don't get the same error. You can patch this by adding & in front of the arrays for now (i.e. borrowing). Would you mind letting me know what rust/cargo version you're on by running cargo --version and rustc --version? I'm on:

cargo 1.55.0 (32da73ab1 2021-08-23)
rustc 1.55.0 (c8dfcfe04 2021-09-06)

I know how frustrating it can be when working with a new toolchain and things aren't working as it should, so thanks for your patience in working through this issue with me. Hope we can get everything up and running soon!

carstenheisterkamp commented 3 years ago

No problem, thank you for looking into this, I am on

cargo 1.55.0 (32da73ab1 2021-08-23)
rustc 1.55.0 (c8dfcfe04 2021-09-06)

too.

slightknack commented 3 years ago

The iterator error is really interesting, especially given that we're on the same version of cargo/rustc. Regardless, in c234322 I published a patch that I'm pretty sure fixes the error. Let me know if this new version works for you — if it does, I'll publish a new minor release that includes the patches we've added since this issue was opened. Thanks!

carstenheisterkamp commented 3 years ago

Following your above described steps it was compiled successfully and I was able to run the example with cargo run --no-default-features -- run demos/life, but the application froze after a few sceonds. The shader itself continued, but I was not able to move the shader window and the busy cursor appeared. No error message, or similar in the console.

cargo install --path . --force --no-default-features was compiled successfully too.

shadergarden --help
Shader Garden 0.2.0
Create evolving gardens of shaders with Lisp and GLSL.
[...]

Point 7: shadergraph run demos/life did not work but shadergarden run demos/life. The window containing the shader froze again as described above. Same with all examples. It can be filed as a new issue and this one can be closed.

slightknack commented 3 years ago

Glad to hear you got it compiling!

Please file that as a new issue if you have an idea as to why it's happening / have steps to reproduce it. GPU shaders can be resource-intensive, so it could just be that it's too much for the machine to handle. Again, I don't have a Windows machine, so if it's a Windows-specific issue, I'm not sure how much I'll be able to help.