Install cargo trunk issue with x86_64-pc-windows-gnu target

Hi to all guys,

in this days I stumble on this issue or at least seems an issue.

I was trying to install Tauri and Yew because i was thinking to develop an app that could include a mobile devices.
currently I am on windows 11 env. but i installed GCC 14.1 toolchain and LLMV 19.1.
I set my target on rust with [x86_64-pc-windows-gnu] because i want to have compatibility with linux evironment ( i also have an arch linux pc).

before to proced with installation i download and install openssl bynaries as prerequisite from
https://slproweb.com/products/Win32OpenSSL.html and follow instruction on
https://docs.rs/crate/openssl/0.10.7/source/README.md

after that i set the current enviroment variables in .cargo/config.toml like:
[env]
OPENSSL_LIBS = "libssl:libcrypto"
OPENSSL_DIR = "D:\Programmi\Win64OpenSSL"
OPENSSL_LIB_DIR = "D:\Programmi\Win64OpenSSL\lib\VC\x64\MT"
OPENSSL_INCLUDE_DIR = "D:\Programmi\Win64OpenSSL\include"

the issue is that when I tryed to install the first packages like :

rustup target add wasm32-unknown-unknown 
cargo install trunk

all went ok for wasm32-unknown-unknown but i get an error on cargo install trunk
the error says :
does not contain the required files to either statically or dynamically link OpenSSL

trying to go deeply i opened build/main.rs in openssl-sys-0.9.104 folder and i noted these lines :

    let libs_env = env("OPENSSL_LIBS");
    let libs = match libs_env.as_ref().and_then(|s| s.to_str()) {
        Some(v) => {
            if v.is_empty() {
                vec![]
            } else {
                v.split(':').collect()
            }
        }
        None => match version {
            Version::Openssl10x if target.contains("windows") => vec!["ssleay32", "libeay32"],
            Version::Openssl3xx | Version::Openssl11x if target.contains("windows-msvc") => {
                vec!["libssl", "libcrypto"]
            }
            _ => vec!["ssl", "crypto"],
        },
    };

so this explain why the compiler was searching for a ssl.lib and not for libssl.lib ...
what's wrong ... does this package not undrestand my target "x86_64-pc-windows-gnu" ... and if yes how can compile with my target and procede to install "trunk package" ??

thanks to all

Have you considered installing a prebuilt binary? Releases · trunk-rs/trunk · GitHub

For building trunk, you can switch its TLS implementation to rustls to avoid the OpenSSL dependency:

cargo install --locked --no-default-features --features update_check,rustls trunk

Hi parasyte , thank you for your suggestion. I didn't know abot it.

.. so if I well undestand if i launch this command i am able to install trunk bypassing the problem of using openssl over rustls ?.
can you confirm this ?

Try it. If it works, you're done (it won't bother looking for OpenSSL at all).

Hi , parasyte ,
it work ..I installed trunk... finally!!

I don't know how to thank you. I struggleling my head all day searching what's wrong about the installation of trunk.

so now , I hope it could be usefull for something else.

For some history (I discovered all this while looking for a solution for you) trunk used to use rustls by default, but they changed the default to openssl in August because rustls had a lot of build problems on Windows. But those build problems were resolved in September. And yet the openssl default remains!

So now, sadly, it's harder to install trunk with its default features. It's worth filing a bug for them on their issue tracker so they can revert the default to rustls.