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

ca5dec1 breaks MinGW build #2584

Closed
lucianoiam opened this issue Sep 27, 2021 · 17 comments
Closed

ca5dec1 breaks MinGW build #2584

lucianoiam opened this issue Sep 27, 2021 · 17 comments
Labels
bug Something isn't working

Comments

@lucianoiam
Copy link

Recent commits do not build on MinGW

Compilation fails with missing symbols, see output below

rustc 1.53.0 (53cb7b09b 2021-06-17)
MINGW64_NT-6.1-7601 vm-PC 3.2.0-340.x86_64 2021-04-02 09:40 UTC x86_64 Msys

Steps to reproduce

 RUSTFLAGS="-C target-feature=+crt-static" cargo build       --manifest-path lib/c-api/Cargo.toml --no-default-features       --features wat,universal,dylib,staticlib,wasi,middlewares       --features cranelift

Expected behavior

Example output when building from source of commit 45f56d0 ( immediately previous to ca5dec1 )

    Finished dev [unoptimized + debuginfo] target(s) in 1m 21s

Actual behavior

  = note: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: \\vmware-host\Shared Folders\src_win\wasmer\target\debug\deps\libwasmer_vm-d4cfd2554963633f.rlib(handlers.o): in function `wasmer_register_setjmp':
          Z:\src_win\wasmer\lib\vm/src/trap/handlers.c:50: undefined reference to `__intrinsic_setjmp'
          collect2.exe: error: ld returned 1 exit status

Additional context

Is MinGW an officially supported target? the above report + this one mean there is no MinGW support unless building from older source.

Thanks.

@lucianoiam lucianoiam added the bug Something isn't working label Sep 27, 2021
@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Ok, using a VS intrinsic is probably a bad idea on MinGW. Do you know if I can use setjmp3 with a NULL 3rd parameter or something else on MinGW?

@lucianoiam
Copy link
Author

Unfortunately I cannot help here as I am not really familiar with Windows. What about keeping two separate implementations where appropriate?

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Yeah, I'll do that. I "just" need to setup a MSYS2 config to test this...

@lucianoiam
Copy link
Author

Maybe points 1) and 4) here can save some time. It contains the original links if needed.

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Well, my problem is I cannot have both rustc toolchain for MSVC and MINGW on Windows system.

@lucianoiam
Copy link
Author

AFAIK all MSYS/MinGW stuff is confined into a single c:\msys64 directory. Then according to this a separate rust could be installed to a non-default location, for example somewhere in c:\msys\home< YOU >...

But never tried that nor I'm familiar with Rust/Cargo itself. If it helps I can compile draft versions here.

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

@lucianoiam
Copy link
Author

I confirm it worked! there is a single (unrelated) warning message generated

$ RUSTFLAGS="-C target-feature=+crt-static" cargo build --manifest-path lib/c-api/Cargo.toml         --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares --features cranelift


   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling autocfg v1.0.1
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.127
   Compiling serde v1.0.127
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling hashbrown v0.11.2
   Compiling libc v0.2.99
   Compiling winapi v0.3.9
   Compiling lazy_static v1.4.0
   Compiling bitflags v1.2.1
   Compiling log v0.4.14
   Compiling cc v1.0.69
   Compiling stable_deref_trait v1.2.0
   Compiling fallible-iterator v0.2.0
   Compiling rustversion v1.0.5
   Compiling strsim v0.10.0
   Compiling memchr v2.4.0
   Compiling ident_case v1.0.1
   Compiling rkyv v0.6.7
   Compiling fnv v1.0.7
   Compiling crc32fast v1.2.1
   Compiling target-lexicon v0.12.2
   Compiling seahash v4.1.0
   Compiling smallvec v1.6.1
   Compiling adler v1.0.2
   Compiling ppv-lite86 v0.2.10
   Compiling rustc-demangle v0.1.20
   Compiling more-asserts v0.2.1
   Compiling crossbeam-utils v0.8.5
   Compiling version_check v0.9.3
   Compiling wasmparser v0.78.2
   Compiling cranelift-entity v0.76.0
   Compiling crossbeam-epoch v0.9.5
   Compiling cranelift-codegen-shared v0.76.0
   Compiling rayon-core v1.9.1
   Compiling scopeguard v1.1.0
   Compiling pin-project-lite v0.2.7
   Compiling leb128 v0.2.4
   Compiling rustc-hash v1.1.0
   Compiling either v1.6.1
   Compiling memmap2 v0.2.3
   Compiling ryu v1.0.5
   Compiling unicode-width v0.1.8
   Compiling serde_json v1.0.66
   Compiling wasmer-compiler-cranelift v2.0.0 (Z:\src_Win\wasmer\lib\compiler-cranelift)
   Compiling itoa v0.4.7
   Compiling strsim v0.8.0
   Compiling unicode-segmentation v1.8.0
   Compiling vec_map v0.8.2
   Compiling cbindgen v0.19.0
   Compiling inventory v0.1.10
   Compiling erased-serde v0.3.16
   Compiling cfg-if v0.1.10
   Compiling byteorder v1.4.3
   Compiling paste v1.0.5
   Compiling indexmap v1.7.0
   Compiling memoffset v0.6.4
   Compiling miniz_oxide v0.4.4
   Compiling rayon v1.5.1
   Compiling getrandom v0.2.3
   Compiling tracing-core v0.1.18
   Compiling backtrace v0.3.61
   Compiling wasmer-vm v2.0.0 (Z:\src_Win\wasmer\lib\vm)
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling cranelift-bforest v0.76.0
   Compiling cranelift-codegen-meta v0.76.0
   Compiling wast v37.0.0
   Compiling textwrap v0.11.0
   Compiling heck v0.3.3
   Compiling rand_core v0.6.3
   Compiling cranelift-codegen v0.76.0
   Compiling wat v1.0.39
   Compiling quote v1.0.9
   Compiling rand_chacha v0.3.1
   Compiling num_cpus v1.13.0
   Compiling which v4.2.2
   Compiling regalloc v0.0.31
   Compiling crossbeam-channel v0.5.1
   Compiling rand v0.8.4
   Compiling region v3.0.0
   Compiling remove_dir_all v0.5.3
   Compiling libloading v0.7.0
   Compiling time v0.1.43
   Compiling atty v0.2.14
   Compiling darling_core v0.13.0
   Compiling thiserror-impl v1.0.26
   Compiling ptr_meta_derive v0.1.4
   Compiling rkyv_derive v0.6.7
   Compiling loupe-derive v0.1.3
   Compiling tracing-attributes v0.1.15
   Compiling ctor v0.1.20
   Compiling inventory-impl v0.1.10
   Compiling ghost v0.1.2
   Compiling typetag-impl v0.1.7
   Compiling crossbeam-deque v0.8.1
   Compiling tempfile v3.2.0
   Compiling clap v2.33.3
   Compiling darling_macro v0.13.0
   Compiling thiserror v1.0.26
   Compiling ptr_meta v0.1.4
   Compiling tracing v0.1.26
   Compiling wasmer-derive v2.0.0 (Z:\src_Win\wasmer\lib\derive)
   Compiling darling v0.13.0
   Compiling serde_bytes v0.11.5
   Compiling generational-arena v0.2.8
   Compiling bincode v1.3.3
   Compiling toml v0.5.8
   Compiling wasmer-vfs v2.0.0 (Z:\src_Win\wasmer\lib\vfs)
   Compiling enumset_derive v0.5.5
   Compiling gimli v0.25.0
   Compiling loupe v0.1.3
   Compiling object v0.26.0
   Compiling typetag v0.1.7
   Compiling enumset v1.0.7
   Compiling addr2line v0.16.0
   Compiling wasmer-types v2.0.0 (Z:\src_Win\wasmer\lib\types)
   Compiling wasmer-c-api v2.0.0 (Z:\src_Win\wasmer\lib\c-api)
   Compiling cranelift-frontend v0.76.0
   Compiling wasmer-wasi-types v2.0.0 (Z:\src_Win\wasmer\lib\wasi-types)
   Compiling wasmer-compiler v2.0.0 (Z:\src_Win\wasmer\lib\compiler)
   Compiling wasmer-engine v2.0.0 (Z:\src_Win\wasmer\lib\engine)
   Compiling wasmer-object v2.0.0 (Z:\src_Win\wasmer\lib\object)
warning: unused import: `cranelift_codegen::ir::LibCall`
 --> lib\compiler-cranelift\src\sink.rs:6:5
  |
6 | use cranelift_codegen::ir::LibCall;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: 1 warning emitted

   Compiling wasmer-engine-universal v2.0.0 (Z:\src_Win\wasmer\lib\engine-universal)
   Compiling wasmer-engine-dylib v2.0.0 (Z:\src_Win\wasmer\lib\engine-dylib)
   Compiling wasmer-engine-staticlib v2.0.0 (Z:\src_Win\wasmer\lib\engine-staticlib)
   Compiling wasmer v2.0.0 (Z:\src_Win\wasmer\lib\api)
   Compiling wasmer-middlewares v2.0.0 (Z:\src_Win\wasmer\lib\middlewares)
   Compiling wasmer-wasi v2.0.0 (Z:\src_Win\wasmer\lib\wasi)
    Finished dev [unoptimized + debuginfo] target(s) in 7m 49s

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Great!
Can you try make test-singlepass-universal also?

@lucianoiam
Copy link
Author

This time it fails:

...

test serialize::test_deserialize::singlepass::universal ... ok
test serialize::test_serialize::singlepass::universal ... ok
test traps::call_signature_mismatch::singlepass::universal ... ignored
test traps::mismatched_arguments::singlepass::universal ... ok
test traps::present_after_module_drop::singlepass::universal ... ok
test traps::rust_panic_import::singlepass::universal ... error: test failed, to rerun pass '--test compilers'

Caused by:
  process didn't exit successfully: `Z:\src_Win\wasmer\target\release\deps\compilers-0d997a49a9f07ddb.exe 'singlepass::universal'` (exit code: 0xc0000028)
make: *** [Makefile:530: test-singlepass-universal] Error 127

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Yeah, so the jmpbuf(buf); is not correct unfortunatly. I need to find a workaround, similar that that __intrinsic_jmpbuf(...)

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Ok, I think I found it now. Can you try again please?

@lucianoiam
Copy link
Author

All tests passed!

make test-singlepass-universal 
...
test result: ok. 183 passed; 0 failed; 132 ignored; 0 measured; 315 filtered out; finished in 5.08s

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 27, 2021

Great!!!
Thanks, I'll merge the branch Asap :)

@lucianoiam
Copy link
Author

Great, thanks!!

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 28, 2021

Branch is merged, ticket can be closed I assume.

@lucianoiam
Copy link
Author

Just retried after merge and all tests passed OK, thanks a lot! closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants