rust-av / examples

Examples of rust-av ecosystem usage.
MIT License
16 stars 2 forks source link

can't build on windows #28

Closed asuper0 closed 2 years ago

asuper0 commented 2 years ago

My Environment: Windows 10 1809 Visual studio 2022 vcpkg commit 6a29f32 libvpx & opus installed with vcpkg: libvpx:x64-windows 1.11.0#1 opus:x64-windows 1.3.1#6

I have tried some ffmpeg binding crates with vcpkg and succeed, so the vcpkg settings would be correct. when I run "cargo build", it shows

... Compiling opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#a59e7a10) Compiling vpx-sys v0.1.1 (https://github.com/rust-av/vpx-rs#84694096) error: failed to run custom build command for opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#a59e7a10)

Caused by: process didn't exit successfully: D:\Code\rust\rust-av\examples\target\debug\build\opus-sys-c6e88b1fe60364f8\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=OPUS_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPUS_STATIC cargo:rerun-if-env-changed=OPUS_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc 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: Error(PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "opus" "opus >= 1.3" The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library, then check documentation of the opus-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config.), State { next_error: None })', C:\Users\Administrator.cargo\git\checkouts\opus-rs-377ca7da91dbf68d\a59e7a1\opus-sys\build.rs:19:34 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: failed to run custom build command for vpx-sys v0.1.1 (https://github.com/rust-av/vpx-rs#84694096)

Caused by: process didn't exit successfully: D:\Code\rust\rust-av\examples\target\debug\build\vpx-sys-603f0f9baa1bcc53\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=VPX_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc 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: PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "vpx" "vpx >= 1.5.0" The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library, then check documentation of the vpx-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config.)', C:\Users\Administrator.cargo\git\checkouts\vpx-rs-ab48b307657c386f\8469409\vpx-sys\build.rs:19:51 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Luni-4 commented 2 years ago

Thank you for your issue! It seems that the problems are located in vpx-rs and opus-rs which are not able to retrieve the dynamic libraries on Windows. Could you try to build the two crates independently and see if they work on Windows?

asuper0 commented 2 years ago

PS D:\Code\rust\rust-av\opus-rs> cargo build Compiling opus-sys v0.1.0 (D:\Code\rust\rust-av\opus-rs\opus-sys) error: failed to run custom build command for opus-sys v0.1.0 (D:\Code\rust\rust-av\opus-rs\opus-sys)

Caused by: process didn't exit successfully: D:\Code\rust\rust-av\opus-rs\target\debug\build\opus-sys-64435c0735a3c6bd\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=OPUS_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPUS_STATIC cargo:rerun-if-env-changed=OPUS_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc 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: Error(PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "opus" "opus >= 1.3" The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library, then check documentation of the opus-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config.), State { next_error: None })', opus-sys\build.rs:19:34 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace PS D:\Code\rust\rust-av\opus-rs> cd ..\vpx-rs\ PS D:\Code\rust\rust-av\vpx-rs> cargo build Updating ustc index Compiling proc-macro2 v1.0.43 Compiling autocfg v1.1.0 Compiling quote v1.0.21 Compiling unicode-ident v1.0.3 ... Compiling system-deps v3.2.0 Compiling av-data v0.3.0 Compiling av-codec v0.2.2 Compiling vpx-sys v0.1.1 (D:\Code\rust\rust-av\vpx-rs\vpx-sys) error: failed to run custom build command for vpx-sys v0.1.1 (D:\Code\rust\rust-av\vpx-rs\vpx-sys)

Caused by: process didn't exit successfully: D:\Code\rust\rust-av\vpx-rs\target\debug\build\vpx-sys-a86c4a139054e579\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=VPX_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc 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: PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "vpx" "vpx >= 1.5.0" The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library, then check documentation of the vpx-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config.)', vpx-sys\build.rs:19:51 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace PS D:\Code\rust\rust-av\vpx-rs>

Thanks for your reply! As you see, its the same.

asuper0 commented 2 years ago

BTW, I'm trying to build static version of libvpx & opus by vcpkg. It will take some time.

Luni-4 commented 2 years ago

Thank you for your effort!

As fast solution, we can try to replace metadeps with system_deps like we already do for aom. We just need to implement these changes

Otherwise we can add a build feature which builds the libraries from scratch and then links them, but this is one is much difficult to have

asuper0 commented 2 years ago

I tried to use the system_deps but failed. I also found vpx_rs is using the system_deps as well as aom_rs, so I tried them both, and failed again.

I use vcpkg_cli to check the aom lib :

PS D:\Code\rust\rust-av\aom-rs> vcpkg_cli.exe probe aom Found library aom Include paths: D:\Libs\vcpkg\installed\x64-windows\include Library paths: D:\Libs\vcpkg\installed\x64-windows\lib Runtime Library paths: D:\Libs\vcpkg\installed\x64-windows\bin Cargo metadata: cargo:rustc-link-search=native=D:\Libs\vcpkg\installed\x64-windows\lib cargo:rustc-link-search=native=D:\Libs\vcpkg\installed\x64-windows\bin cargo:rustc-link-lib=aom cargo:rustc-link-lib=aom_static Found DLLs: D:\Libs\vcpkg\installed\x64-windows\bin\aom.dll Found libs: D:\Libs\vcpkg\installed\x64-windows\lib\aom.lib D:\Libs\vcpkg\installed\x64-windows\lib\aom_static.lib Libraries linking names: aom aom_static


here is the BUILD console output :

PS D:\Code\rust\rust-av\aom-rs> cargo build -vv Fresh autocfg v1.1.0 Fresh unicode-ident v1.0.3 Fresh glob v0.3.0 Fresh cfg-if v1.0.0 Fresh minimal-lexical v0.2.1 Fresh regex-syntax v0.6.27 Fresh unicode-width v0.1.9 Fresh strsim v0.8.0 Fresh bitflags v1.3.2 Fresh humantime v2.1.0 Fresh either v1.7.0 Fresh vec_map v0.8.2 Fresh smallvec v1.9.0 Fresh lazy_static v1.4.0 Fresh shlex v1.1.0 Fresh peeking_take_while v0.1.2 Fresh version-compare v0.1.0 Fresh pkg-config v0.3.25 Fresh heck v0.4.0 Fresh lazycell v1.3.0 Fresh rustc-hash v1.1.0 Fresh byte-slice-cast v1.2.1 Fresh bytes v1.2.1 Fresh textwrap v0.11.0 Fresh cfg-expr v0.10.3 Fresh winapi v0.3.9 Fresh proc-macro2 v1.0.43 Fresh memchr v2.5.0 Fresh winapi-util v0.1.5 Fresh atty v0.2.14 Fresh libc v0.2.127 Fresh num-traits v0.2.15 Fresh libloading v0.7.3 Fresh serde v1.0.142 Fresh log v0.4.17 Fresh quote v1.0.21 Fresh aho-corasick v0.7.18 Fresh termcolor v1.1.3 Fresh nom v7.1.1 Fresh clang-sys v1.3.3 Fresh which v4.2.5 Fresh num-integer v0.1.45 Fresh clap v2.34.0 Fresh toml v0.5.9 Fresh regex v1.6.0 Fresh syn v1.0.99 Fresh cexpr v0.6.0 Fresh num-bigint v0.3.3 Fresh system-deps v6.0.2 Fresh env_logger v0.9.0 Fresh thiserror-impl v1.0.32 Fresh num-rational v0.3.2 Fresh num-derive v0.3.3 Fresh bindgen v0.59.2 Fresh thiserror v1.0.32 Fresh av-data v0.3.0 Compiling aom-sys v0.3.1 (D:\Code\rust\rust-av\aom-rs\aom-sys) Fresh av-codec v0.2.2 Running D:\Code\rust\rust-av\aom-rs\target\debug\build\aom-sys-72a82d61c7fa5bf4\build-script-build [aom-sys 0.3.1] thread 'main' panicked at 'called Result::unwrap() on an Err value: PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "aom" "aom >= 3.0.0" [aom-sys 0.3.1] The pkg-config command could not be found. [aom-sys 0.3.1] [aom-sys 0.3.1] Most likely, you need to install a pkg-config package for your OS. [aom-sys 0.3.1] [aom-sys 0.3.1] If you've already installed it, ensure the pkg-config command is one of the [aom-sys 0.3.1] directories in the PATH environment variable. [aom-sys 0.3.1] [aom-sys 0.3.1] If you did not expect this build to link to a pre-installed system library, [aom-sys 0.3.1] then check documentation of the aom-sys crate for an option to [aom-sys 0.3.1] build the library from source, or disable features or dependencies [aom-sys 0.3.1] that require pkg-config.)', aom-sys\build.rs:16:51 [aom-sys 0.3.1] note: run with RUST_BACKTRACE=1 environment variable to display a backtrace error: failed to run custom build command for aom-sys v0.3.1 (D:\Code\rust\rust-av\aom-rs\aom-sys)

Caused by: process didn't exit successfully: D:\Code\rust\rust-av\aom-rs\target\debug\build\aom-sys-72a82d61c7fa5bf4\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=AOM_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc 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-msvc cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc 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: PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "aom" "aom >= 3.0.0" The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library, then check documentation of the aom-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config.)', aom-sys\build.rs:16:51 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

asuper0 commented 2 years ago

I noticed that the system-deps github page says "For now only pkg-config dependencies are supported, but we are planning to https://github.com/gdesmott/system-deps/issues/3 at some point." . So that would be the problem. I'm not familiar with pkg-config. It seems that pkg-config in windows should use mingW, which is not compatible with msvc. So I'd prefer use vcpkg rather than pkg-config.

I found that rusty_ffmpeg and rust-ffmpeg-sys use another build system which support vcpkg. Could you please take a look at that?

Luni-4 commented 2 years ago

Yeah, you're right, I haven't noticed that part, I thought system-deps was a cross-platform crate.

rust-ffmpeg-sys uses the vcpkg crate to find dependencies. Here adds the library to Cargo.toml and here and here implements that. We can add that code to our three -sys crates to find vcpkg dependencies.

Unfortunately, I will be out of town for one week, so I won't be able to work on that, but you can try to verify whether it works locally for you. If something happens, feel free to open a PR in each of the three repos, I will be happy to review them when I come back.

asuper0 commented 2 years ago

Thanks for your advise. I'll try to solve it, though I am new to Rust 😅

Luni-4 commented 2 years ago

Welcome to Rust! Oh, no problem. take your time! :smiley:

lu-zero commented 2 years ago

I'd argue that either vcpkg gets reimplemented to remove the telemetry or maybe not everybody would be cool with it.

(also http://pkgconf.org/ exists)

Luni-4 commented 2 years ago

Another solution could be to build on Windows through msys2, so we don't have any telemetry, and the packages can be installed easily. It should be sufficient installing msys2 and the mingw target with rustup toolchain install stable-x86_64-pc-windows-gnu

To install packages:

To build: cargo build --target x86_64-pc-windows-gnu

asuper0 commented 2 years ago

I just created two PR for vpx and opus. The code may not so rusty but works.

for aom, I meet a type convert error https://github.com/rust-av/aom-rs/blob/master/src/encoder.rs#L100-L102 . The aom-sys require aom 3.0.0 but my aom in vcpkg is 3.2.0, and they differ in the type of aom_image.cp, aom_image.tc, aom_image.mc. While my ffmpeg depends on aom, rebuilt them will take a long time. So, I would not try to fix aom-rs.

asuper0 commented 2 years ago

Another solution could be to build on Windows through msys2, so we don't have any telemetry, and the packages can be installed easily. It should be sufficient installing msys2 and the mingw target with rustup toolchain install stable-x86_64-pc-windows-gnu

To install packages:

To build: cargo build --target x86_64-pc-windows-gnu

I need to say its important to me to make these package support for vcpkg, because all my dev env are built on it. I also trid the msys2 solution, but don't know where to continue after installing the toolchina whit rustup toolchain install stable-x86_64-pc-windows-gnu

Luni-4 commented 2 years ago

I just created two PR for vpx and opus. The code may not so rusty but works.

for aom, I meet a type convert error https://github.com/rust-av/aom-rs/blob/master/src/encoder.rs#L100-L102 . The aom-sys require aom 3.0.0 but my aom in vcpkg is 3.2.0, and they differ in the type of aom_image.cp, aom_image.tc, aom_image.mc. While my ffmpeg depends on aom, rebuilt them will take a long time. So, I would not try to fix aom-rs.

Thanks for your PRs @asuper0! I'm going to review them as soon as possible!

For what concerns aom, please open an issue on aom repository about the errors you have found. I suppose the first one is a clippy error, while the second one is related to a missing update. Feel free to open PRs if you want, I would like to add dav1d and aom decoders in these examples as well.

Another solution could be to build on Windows through msys2, so we don't have any telemetry, and the packages can be installed easily. It should be sufficient installing msys2 and the mingw target with rustup toolchain install stable-x86_64-pc-windows-gnu To install packages:

To build: cargo build --target x86_64-pc-windows-gnu

I need to say its important to me to make these package support for vcpkg, because all my dev env are built on it. I also trid the msys2 solution, but don't know where to continue after installing the toolchina whit rustup toolchain install stable-x86_64-pc-windows-gnu

I propose to hide vcpkg behind a Rust feature, in this way it's not an official solution, so @lu-zero statement is respected, but at the same time you can use your dev env. You can add this feature, we can call it vcpkg, to your PRs and try if it works on Windows with cargo build --feature vcpkg.

Have you installed msys2? If you have, try to install opus package with this command pacman -S mingw-w64-x86_64-opus and then try to build opus-rs with cargo build --target x86_64-pc-windows-gnu. vpx-rs is analogous but with the package pacman -S mingw-w64-x86_64-libvpx Let me know if it works!

asuper0 commented 2 years ago

@lu-zero #https://github.com/rust-av/opus-rs/pull/27 You're right. I apologize for my hesitation when you suggest to use the pkg-config. I built the example without changing any code by simply installing a pkg-config tool and setting the PKG_CONFIG_PATH to vcpkg\installed\x64-windows\lib\pkgconfig. Everything works perfectly except the VERSION string in opus.pc is "0", and I modified it myself.

To @Luni-4 , thanks for the help. While the system_deps with pkg-config works well, my PR may be closed, it depends on you. Maybe a build tutorial for windows is good for rust-av or other projects.

lu-zero commented 2 years ago

@lu-zero #rust-av/opus-rs#27 You're right. I apologize for my hesitation when you suggest to use the pkg-config. I built the example without changing any code by simply installing a pkg-config tool and setting the PKG_CONFIG_PATH to vcpkg\installed\x64-windows\lib\pkgconfig. Everything works perfectly except the VERSION string in opus.pc is "0", and I modified it myself.

Probably the vcpkg people should be made aware of the problem, they seem fairly responsive from what I saw in the system-deps discussion.

To @Luni-4 , thanks for the help. While the system_deps with pkg-config works well, my PR may be closed, it depends on you. Maybe a build tutorial for windows is good for rust-av or other projects.

A good tutorial for windows would be great, we have less experience with the platform so your help would be precious :)

Luni-4 commented 2 years ago

@lu-zero #rust-av/opus-rs#27 You're right. I apologize for my hesitation when you suggest to use the pkg-config. I built the example without changing any code by simply installing a pkg-config tool and setting the PKG_CONFIG_PATH to vcpkg\installed\x64-windows\lib\pkgconfig. Everything works perfectly except the VERSION string in opus.pc is "0", and I modified it myself.

To @Luni-4 , thanks for the help. While the system_deps with pkg-config works well, my PR may be closed, it depends on you. Maybe a build tutorial for windows is good for rust-av or other projects.

Great that you solved your problem @asuper0! Can you please add here the series of steps you have used to compute the examples with vcpkg? I want to add that to the CIs of the three repositories, in this way CI works as documentation too for other people. Thank you!

asuper0 commented 2 years ago
  1. Download pkg-config-lite . I find this on stackoverflow ;
  2. Extract it, add the bin folder to your $PATH ;
  3. Add your_vcpkg_root\installed\x64-windows\lib\pkgconfig to $PKG_CONFIG_PATH . (noticed, x64-windows is depens on your config) ;
  4. Restart or relogin to make the environment variables work .
  5. In the project dir, run cargo build.
Luni-4 commented 2 years ago

It seems it is possible to install pkg-config-lite through chocolatey. Perhaps we can skip steps 1 and 2. May you please also tell me how to install packages through vcpkg?

asuper0 commented 2 years ago

vcpkg make .pc files automatically when your run vcpkg install some_package, and all of them are at the same location. Here is mine:

PS D:\Libs\vcpkg\installed\x64-windows\lib\pkgconfig> ls

    目录: D:\Libs\vcpkg\installed\x64-windows\lib\pkgconfig

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         2022/8/4     10:39            320 aom.pc
-a----         2022/8/4     10:43            323 avisynth.pc
-a----         2022/4/7      9:55            221 bzip2.pc
-a----         2022/8/4     10:46            206 dav1d.pc
-a----         2022/4/7     10:22            239 eigen3.pc
-a----         2022/4/7     10:24            280 expat.pc
-a----         2022/8/4     10:47            181 ffnvcodec.pc
-a----         2022/4/7     10:25            370 freetype2.pc
-a----         2022/8/4     14:53            239 fribidi.pc
-a----         2022/4/7     10:30            260 glew.pc
-a----         2022/4/7     10:28            226 glu.pc
-a----         2022/8/4     14:57            264 harfbuzz-subset.pc
-a----         2022/8/4     14:57            253 harfbuzz.pc
-a----         2022/4/7     12:40            324 hdf5.pc
-a----         2022/4/7     12:40            326 hdf5_hl.pc
-a----         2022/4/7     13:41            354 lept.pc
-a----         2022/4/7     16:16            447 libarchive.pc
-a----         2022/8/4     14:57            367 libass.pc
-a----         2022/8/4     16:51            632 libavcodec.pc
-a----         2022/8/4     16:51            723 libavdevice.pc
-a----         2022/8/4     16:51            691 libavfilter.pc
-a----         2022/8/4     16:51            539 libavformat.pc
-a----         2022/8/4     16:51            333 libavresample.pc
-a----         2022/8/4     16:51            325 libavutil.pc
-a----         2022/4/7      9:54            294 libbrotlicommon.pc
-a----         2022/4/7      9:54            322 libbrotlidec.pc
-a----         2022/4/7      9:54            322 libbrotlienc.pc
-a----         2022/4/7     10:03            593 libcares.pc
-a----         2022/4/7     11:12            289 libcrypto.pc
-a----         2022/4/7     10:10           1715 libcurl.pc
-a----         2022/8/4     14:59            224 libilbc.pc
-a----         2022/4/7     12:44            266 libjpeg.pc

...
lu-zero commented 2 years ago

It is annoying that pkgconf.org doesn't offers builds otherwise it would be an even nicer alternative :/

Luni-4 commented 2 years ago

@asuper0 Could you please write down the commands to install opus and vpx? Because it seems I have problems with the packages

asuper0 commented 2 years ago

What kind of problem? With $VCPKG_DEFAULT_TRIPLET set to x64-windows :

vcpkg install opus
vcpkg install libvpx

or without the environment variable :

vcpkg install opus:x64-windows
vcpkg install libvpx:x64-windows

Notice that vpx is named libvpx. Your can use vcpkg search vpx if you are not sure the name.

Luni-4 commented 2 years ago

Closed in #29