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 toolchain prevents static linking #10

Open
GrygrFlzr opened this issue Jan 8, 2021 · 0 comments
Open

Windows GNU toolchain prevents static linking #10

GrygrFlzr opened this issue Jan 8, 2021 · 0 comments

Comments

@GrygrFlzr
Copy link
Contributor

GrygrFlzr commented Jan 8, 2021

Currently, stdc++ must be linked dynamically for GNU toolchains to build from source:

if target.ends_with("-pc-windows-gnu") {
    println!("cargo:rustc-link-lib=dylib=stdc++");
}

This is solvable by rust-lang/rust#37403 via the use of this unstable feature:

  • Add #![feature(static_nobundle)] to both lib.rs and build.rs of glsl-to-spirv-builder
  • Modify the link to use static-nobundle:
if target.ends_with("-pc-windows-gnu") {
    println!("cargo:rustc-link-lib=static-nobundle=stdc++");
}
$ cargo +nightly-gnu test --release --target x86_64-pc-windows-gnu
   Compiling bevy-glsl-to-spirv-builder v0.1.0 (C:\Users\GrygrFlzr\Documents\projects\glsl-to-spirv\glsl-to-spirv-builder)
   Compiling bevy-glsl-to-spirv v0.2.2 (C:\Users\GrygrFlzr\Documents\projects\glsl-to-spirv)
    Finished release [optimized] target(s) in 1.77s
     Running target\x86_64-pc-windows-gnu\release\deps\bevy_glsl_to_spirv-aeb5d0f8868f37b0.exe

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running target\x86_64-pc-windows-gnu\release\deps\test-fe3b922dfa91430d.exe

running 1 test
test test1 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

   Doc-tests bevy-glsl-to-spirv

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Of course, this will not build without nightly, so this issue is blocked until the feature is stabilized.

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

1 participant