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

Issue compiling Bevy project on linux gnu cargo target #1361

Closed
Hellzbellz123 opened this issue Mar 5, 2023 · 3 comments
Closed

Issue compiling Bevy project on linux gnu cargo target #1361

Hellzbellz123 opened this issue Mar 5, 2023 · 3 comments
Labels
C-bug Category: This is a bug.

Comments

@Hellzbellz123
Copy link

pretty sure this is related too using simd-nightly feature of rapier2d, disabling that cargo feature got it too compile, however i noticed one strange issue between cranelift and rustc.
the following line wouldnt compile with cranelift but would compile with the normal rustc codegen
*wtransform.rotation = *(Quat::from_euler(EulerRot::ZYX, aimangle, 0.0, 0.0));

this is the output from trying to using rapier2d/simd-nightly

warning: unnecessary parentheses around assigned value
   --> src/actors/combat/mod.rs:120:36
    |
120 |             *wtransform.rotation = *(Quat::from_euler(EulerRot::ZYX, aimangle, 0.0, 0.0));
    |                                    ^                                                   ^
    |
    = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
    |
120 -             *wtransform.rotation = *(Quat::from_euler(EulerRot::ZYX, aimangle, 0.0, 0.0));
120 +             *wtransform.rotation = Quat::from_euler(EulerRot::ZYX, aimangle, 0.0, 0.0);
    |

error[E0614]: type `bevy::prelude::Quat` cannot be dereferenced
   --> src/actors/combat/mod.rs:120:13
    |
120 |             *wtransform.rotation = *(Quat::from_euler(EulerRot::ZYX, aimangle, 0.0, 0.0));
    |             ^^^^^^^^^^^^^^^^^^^^^
    |
help: parentheses are required to parse this as an expression
    |
115 ~             (if aimangle.to_degrees() > 180.0 || aimangle.to_degrees() < -0.0 {
116 |                 wtransform.scale.x = -1.0
117 |             } else {
118 |                 wtransform.scale.x = 1.0
119 ~             })
    |

For more information about this error, try `rustc --explain E0614`.
warning: `vanillacoffee-wip` (bin "vanillacoffee-wip") generated 1 warning

❯ ~/cargo-clif/cargo-clif build -Zunstable-options --keep-going
   Compiling simba v0.8.0
   Compiling nalgebra v0.32.1
error: VerifierErrors([VerifierError { location: inst5, context: Some("v5 = extractlane.i128 v3, 0"), message: "has an invalid controlling type i128" }, VerifierError { location: inst6, context: Some("v6 = extractlane.i128 v4, 0"), message: "has an invalid controlling type i128" }, VerifierError { location: inst8, context: Some("v9 = insertlane.i128 v8, v7, 0"), message: "has an invalid controlling type i128" }])

error: cranelift verify error:
       function u0:83(i64 sret, i64, i64) system_v {
                                       block0(v0: i64, v1: i64, v2: i64):
                                           v12 = iconst.i64 0
                                           v13 = uextend.i128 v12  ; v12 = 0
                                           v8 -> v13
                                           v11 -> v13
                                           nop 
                                           jump block1
       
                                       block1:
                                           nop 
       @0001                               v3 = load.i128 notrap v1
       @0002                               v4 = load.i128 notrap v2
                                           v5 = extractlane v3, 0
       ;                                   ^~~~~~~~~~~~~~~~~~~~~~
       ; error: inst5 (v5 = extractlane.i128 v3, 0): has an invalid controlling type i128
       
                                           v6 = extractlane v4, 0
       ;                                   ^~~~~~~~~~~~~~~~~~~~~~
       ; error: inst6 (v6 = extractlane.i128 v4, 0): has an invalid controlling type i128
       
                                           v7 = bor v5, v6
                                           v9 = insertlane.i128 v8, v7, 0
                                           v10 -> v9
       ;                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       ; error: inst8 (v9 = insertlane.i128 v8, v7, 0): has an invalid controlling type i128
       
                                           jump block2
       
                                       block2:
                                           nop 
       @0004                               store.i128 notrap v10, v0
       @0006                               return
       }
       
       ; 3 verifier errors detected (see above). Compilation aborted.

fn packed_simd_2::v128::<impl std::ops::BitOr for packed_simd_2::Simd<[packed_simd_2::m128; 1]>>::bitor(_1: packed_simd_2::Simd<[packed_simd_2::m128; 1]>, _2: packed_simd_2::Simd<[packed_simd_2::m128; 1]>) -> packed_simd_2::Simd<[packed_simd_2::m128; 1]> {
    debug self => _1;                    // in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:35:22: 35:26
    debug other => _2;                   // in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:35:28: 35:33
    let mut _0: packed_simd_2::Simd<[packed_simd_2::m128; 1]>; // return place in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:35:44: 35:48
    let mut _3: packed_simd_2::codegen::v128::m128x1; // in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:31: 37:55
    let mut _4: packed_simd_2::codegen::v128::m128x1; // in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:39: 37:45
    let mut _5: packed_simd_2::codegen::v128::m128x1; // in scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:47: 37:54
    scope 1 {
    }

    bb0: {
        StorageLive(_3);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:31: 37:55
        StorageLive(_4);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:39: 37:45
        _4 = (_1.0: packed_simd_2::codegen::v128::m128x1); // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:39: 37:45
        StorageLive(_5);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:47: 37:54
        _5 = (_2.0: packed_simd_2::codegen::v128::m128x1); // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:47: 37:54
        _3 = packed_simd_2::codegen::llvm::simd_or::<packed_simd_2::codegen::v128::m128x1>(move _4, move _5) -> bb1; // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:31: 37:55
                                         // mir::Constant
                                         // + span: /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:31: 37:38
                                         // + literal: Const { ty: unsafe extern "platform-intrinsic" fn(packed_simd_2::codegen::v128::m128x1, packed_simd_2::codegen::v128::m128x1) -> packed_simd_2::codegen::v128::m128x1 {packed_simd_2::codegen::llvm::simd_or::<packed_simd_2::codegen::v128::m128x1>}, val: Value(<ZST>) }
    }

    bb1: {
        StorageDead(_5);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:54: 37:55
        StorageDead(_4);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:54: 37:55
        _0 = packed_simd_2::Simd::<[packed_simd_2::m128; 1]>(move _3); // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:26: 37:56
        StorageDead(_3);                 // scope 1 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:37:55: 37:56
        return;                          // scope 0 at /home/hellzbellz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/api/ops/vector_mask_bitwise.rs:38:14: 38:14
    }
}

error: could not compile `simba` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
   Compiling parry2d v0.13.1
^C  Building [=======================> ] 490/495: parry2d    
@bjorn3 bjorn3 added the C-bug Category: This is a bug. label Mar 5, 2023
@Hellzbellz123
Copy link
Author

Hellzbellz123 commented Mar 5, 2023

i managed too have fat fingers
my apologies,
i managed to get the project to compile in release after disabling lto, not sure why the de-reference wasnt working with cranelift but removing the * fixed that compiler error, it works both ways in rustc so it shouldnt be too big of a deal

as for the simd-nightly errors, the simd-nightly feature of rapier is equivelant too this:
simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]

simd-stable compiles fine so i think this issue was probably my fault?

@bjorn3
Copy link
Member

bjorn3 commented Mar 7, 2023

I can reproduce this by compiling simba with the packed_simd feature.

@bjorn3
Copy link
Member

bjorn3 commented Mar 7, 2023

Looks like simba depends on the packed_simd_2 crate from crates.io which has been subsumed by std::simd. packed_simd_2 uses a version of the interface with rustc that cg_clif doesn't support. There is an open issue to migrate to std::simd: dimforge/simba#33 I'm going to close this as the right course of action is for simba to move to std::simd. For now using simd-stable with rapier is the best option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants