kubewarden/rust-policy-template

Running 'cargo test' on Windows 10

Closed this issue · 3 comments

Hi
I am unable to test a project created from this template when using Window 10. I receive the following linking issue

λ cargo test
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.8
   Compiling itoa v0.4.7
   Compiling percent-encoding v2.1.0
   Compiling bytes v1.0.1
   Compiling fnv v1.0.7
   Compiling base64 v0.13.0
   Compiling lazy_static v1.4.0
   Compiling tinyvec v1.2.0
   Compiling unicode-bidi v0.3.5
   Compiling libc v0.2.95
   Compiling winapi v0.3.9
   Compiling ryu v1.0.5
   Compiling anyhow v1.0.40
   Compiling wapc-guest v0.4.0
   Compiling num-traits v0.2.14
   Compiling form_urlencoded v1.0.1
   Compiling http v0.2.4
   Compiling serde v1.0.126
   Compiling unicode-normalization v0.1.18
   Compiling ordered-float v2.5.1
   Compiling num-integer v0.1.44
   Compiling time v0.1.44
   Compiling idna v0.2.3
   Compiling url v2.2.2
   Compiling serde-value v0.7.0
   Compiling chrono v0.4.19
   Compiling serde_json v1.0.64
   Compiling k8s-openapi v0.11.0
   Compiling kubewarden-policy-sdk v0.1.0
   Compiling istio-ingress-mutation v0.1.0 (C:\Dev\work\kubernetes\cluster\istio-ingress-mutation)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.0.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.1.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.10.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.11.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.12.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.13.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.14.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.15.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.2.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.3.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.4.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.5.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.6.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.7.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.8.rcgu.o" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.istio_ingress_mutation.ed9ifrhp-cgu.9.rcgu.o" "/OUT:c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.exe" "c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\istio_ingress_mutation-50088becae605ecc.hx2urqyzopdn3pw.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "/LIBPATH:c:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps" "/LIBPATH:C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libtest-1a8c4f55ed0f24f9.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libterm-a376e7dc619aae86.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libgetopts-c336fe72c68fb82c.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunicode_width-bafd2623bdb49f37.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_std-0af7ad2c3a405099.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libkubewarden_policy_sdk-467717bdf6b95e13.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libanyhow-914fe189ff5a1fd9.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libk8s_openapi-e586a2cf1e36ca42.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libbase64-663caaed9a490bd9.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\liburl-bdf6f8562b4d58a6.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libidna-e3301a94a57c0946.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libunicode_normalization-a2276d9e89932434.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libtinyvec-2535dcc3d8be36d6.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libtinyvec_macros-0926bd5ffe7cec39.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libunicode_bidi-a2dbfa522afdf219.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libform_urlencoded-6a8852b2d67590be.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libmatches-a29291476d72f7b8.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libserde_value-bc01d6320a120914.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libordered_float-d0148be6a9e48a78.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libserde_json-dc4c2d179fa454dc.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libryu-8e5eba0d6ebdd151.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libpercent_encoding-c23c2e4e93c092f6.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libhttp-d4db65130be9c1ba.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libitoa-970fddc1b4e90aa0.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libbytes-a3a530f1ecb50784.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libfnv-877a65f3c9dd7719.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libchrono-441bde5a78889a62.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libserde-c9249562c2162093.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libnum_integer-ea2a8ea6a8af7898.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libnum_traits-f19476345d5c5022.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\liblibc-9ae68bd847c2269d.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libtime-d5d65255d7e6b3de.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libwinapi-8b7192a778c065d2.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\libwapc_guest-9fac9d6081d397cd.rlib" "C:\\Dev\\work\\kubernetes\\cluster\\istio-ingress-mutation\\target\\debug\\deps\\liblazy_static-e2c1663048b36bb0.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-68b25ab3829cbbae.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-dd86b2a9657509c7.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-a32547dedd895cf6.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-2d29ef3bbf523eaa.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-2a226fea424b96ba.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-e28afa8739a1fa1c.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-5e97a47829d8661c.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-c7a4b246b1481113.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-2b5ec6322b49dd45.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-c1df47dd61fa6cd5.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-3cedc7817d8eb468.rlib" "C:\\Users\\dbell\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-c115f0a110b00510.rlib" "kernel32.lib" "advapi32.lib" "kernel32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___guest_request referenced in function __guest_call
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___guest_response referenced in function __guest_call
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___guest_error referenced in function __guest_call
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___host_call referenced in function _ZN10wapc_guest9host_call17hb910ebca0c209682E
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___host_error_len referenced in function _ZN10wapc_guest9host_call17hb910ebca0c209682E
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___host_response_len referenced in function _ZN10wapc_guest9host_call17hb910ebca0c209682E
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___host_error referenced in function _ZN10wapc_guest9host_call17hb910ebca0c209682E
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___host_response referenced in function _ZN10wapc_guest9host_call17hb910ebca0c209682E
          libwapc_guest-9fac9d6081d397cd.rlib(wapc_guest-9fac9d6081d397cd.wapc_guest.37ujs94n-cgu.14.rcgu.o) : error LNK2019: unresolved external symbol __imp___console_log referenced in function _ZN10wapc_guest11console_log17hc140e2827d990325E
          c:\Dev\work\kubernetes\cluster\istio-ingress-mutation\target\debug\deps\istio_ingress_mutation-50088becae605ecc.exe : fatal error LNK1120: 9 unresolved externals


error: aborting due to previous error

error: could not compile `istio-ingress-mutation`

To learn more, run the command again with --verbose.

When I try `cargo test --target wasm32-unknown-unknown'

λ cargo test --target wasm32-unknown-unknown                                                                                                                                                          
   Compiling autocfg v1.0.1                                                                                                                                                                           
   Compiling proc-macro2 v1.0.27                                                                                                                                                                      
   Compiling unicode-xid v0.2.2                                                                                                                                                                       
   Compiling syn v1.0.72                                                                                                                                                                              
   Compiling serde_derive v1.0.126                                                                                                                                                                    
   Compiling serde v1.0.126                                                                                                                                                                           
   Compiling matches v0.1.8                                                                                                                                                                           
   Compiling tinyvec_macros v0.1.0                                                                                                                                                                    
   Compiling libc v0.2.95                                                                                                                                                                             
   Compiling ryu v1.0.5                                                                                                                                                                               
   Compiling itoa v0.4.7                                                                                                                                                                              
   Compiling serde_json v1.0.64                                                                                                                                                                       
   Compiling percent-encoding v2.1.0                                                                                                                                                                  
   Compiling k8s-openapi v0.11.0                                                                                                                                                                      
   Compiling bytes v1.0.1                                                                                                                                                                             
   Compiling fnv v1.0.7                                                                                                                                                                               
   Compiling anyhow v1.0.40                                                                                                                                                                           
   Compiling base64 v0.13.0                                                                                                                                                                           
   Compiling lazy_static v1.4.0                                                                                                                                                                       
   Compiling unicode-bidi v0.3.5                                                                                                                                                                      
   Compiling tinyvec v1.2.0                                                                                                                                                                           
   Compiling form_urlencoded v1.0.1                                                                                                                                                                   
   Compiling wapc-guest v0.4.0                                                                                                                                                                        
   Compiling num-traits v0.2.14                                                                                                                                                                       
   Compiling num-integer v0.1.44                                                                                                                                                                      
   Compiling http v0.2.4                                                                                                                                                                              
   Compiling time v0.1.44                                                                                                                                                                             
   Compiling unicode-normalization v0.1.18                                                                                                                                                            
   Compiling quote v1.0.9                                                                                                                                                                             
   Compiling idna v0.2.3                                                                                                                                                                              
   Compiling ordered-float v2.5.1                                                                                                                                                                     
   Compiling url v2.2.2                                                                                                                                                                               
   Compiling serde-value v0.7.0                                                                                                                                                                       
   Compiling chrono v0.4.19                                                                                                                                                                           
   Compiling kubewarden-policy-sdk v0.1.0                                                                                                                                                             
   Compiling istio-ingress-mutation v0.1.0 (C:\Dev\work\kubernetes\cluster\istio-ingress-mutation)                                                                                                    
    Finished test [unoptimized + debuginfo] target(s) in 1m 04s                                                                                                                                       
     Running unittests (target\wasm32-unknown-unknown\debug\deps\istio_ingress_mutation-3b7bca3840e3190a.wasm)                                                                                        
error: test failed, to rerun pass '--lib'                                                                                                                                                             
                                                                                                                                                                                                      
Caused by:                                                                                                                                                                                            
  could not execute process `c:\Dev\work\kubernetes\cluster\istio-ingress-mutation\target\wasm32-unknown-unknown\debug\deps\istio_ingress_mutation-3b7bca3840e3190a.wasm` (never executed)            

I can build it on Windows 10. I can also build and test it using WSL.

Thanks in advance
Darren

cargo test --target wasm32-unknown-unknown is expected to not work because the resulting binary cannot be executed in the host platform.

The cargo test issue should have been fixed by f56092a.

Closing, please reopen if the issue persists. Thanks for your report!

I could try in a Windows 10 environment, I can still reproduce this issue.

Just confirmed that cargo test works fine on Windows on a project created from scratch with cargo-generate.