Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows (GNU ABI) builds show up as white canvas only and require extra DLLs #987

Closed
ChriFo opened this issue Aug 9, 2021 · 4 comments
Closed

Comments

@ChriFo
Copy link

ChriFo commented Aug 9, 2021

When building an example (at least tour and progress_bar) with help of cross for x86_64-pc-windows-gnu and i686-pc-windows-gnu the app looks in Windows 10 running in VMware Fusion like this:

white

When I build the examples for x86_64-apple-darwin they work on my macOS 11.5 as expected.

The produced exe need some extra DLLs (libstdc++-6.dll + libgcc_s_seh-1.dll for x86_64 or libgcc_s_dw2-1.dll for i686).
I think this comes from a dependency but which one do I have to build by my self to have a fully static build?

Thank you for any help or advice.

@ChriFo
Copy link
Author

ChriFo commented Aug 10, 2021

I used the master branch. But according to this discussion using the current latest release (0.3.0) the progress_bar example worked as expected.

But I still need to add the extra DLLs.

@ChriFo
Copy link
Author

ChriFo commented Aug 17, 2021

With that build.rs

use std::env::var;

fn main() {
    let target = var("TARGET").unwrap();

    println!("cargo:rerun-if-changed=build.rs");
    if target.contains("windows") {
        println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES");
        println!("cargo:rerun-if-env-changed=WINAPI_STATIC_NOBUNDLE");

        println!("cargo:rustc-link-lib=static=gcc");
        println!("cargo:rustc-link-lib=static=stdc++");
    }
}

I was able to produce an exe which runs without any extra DLL.

🎉

@ChriFo ChriFo closed this as completed Aug 17, 2021
@0x192
Copy link
Contributor

0x192 commented Aug 24, 2021

@ChriFo

I am in the same situation. All iced exemples windows builds ask for extra DLLs and unfortunately I can't statically link stdc++ and gcc :

= note: /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libstdc++.a(compatibility-condvar.o):/build/mingw-w64-gcc/src/build-x86_64-w64-mingw32/x86_64-w64-mingw32/libstdc++-v3/include/x86_64-w64-mingw32/bits/gthr-default.h:733: undefined reference to `__imp_pthread_mutex_init'
          /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libstdc++.a(compatibility-condvar.o):/build/mingw-w64-gcc/src/build-x86_64-w64-mingw32/x86_64-w64-mingw32/libstdc++-v3/include/x86_64-w64-mingw32/bits/gthr-default.h:740: undefined reference to `__imp_pthread_mutex_destroy'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

Did you do anything special? Using cross didn't help either...

@hecrj
Do you know which dependency/(ies) could need stdc++?

P.S. Thanks a lot for all your work on Iced! ❤️

@ChriFo
Copy link
Author

ChriFo commented Aug 24, 2021

No, nothing special but using the cross image for i686-pc-windows-gnu with the exact build.rs shown above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants