wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

Bug: Rust wrapper `cargo build` fails with apple silicon for cdylib target

Open krisbitney opened this issue 3 years ago • 0 comments

I can build a Rust wrapper without issue using polywrap build. However, I cannot build with cargo build if I have the crate-type value of ["cdylib"] in my cargo.toml. This caused issues with IDE features. It took me awhile to realize there was a build issue because cargo check and polywrap build worked perfectly well.

This issue matters because IDE features like type inference and code completion do not work when cargo build is failing. I use the JetBrains WebStorm IDE. I'm not sure if this issue is present for VS Code users.

This is low priority because the issue is resolved by simply changing "cdylib" to "rlib" during development.

Here is the error:

 error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-Wl,-exported_symbols_list,/var/folders/yw/22bds55973997zxjb4v_1_r40000gn/T/rustc2dJbLH/list" "-arch" "arm64" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.10jcl5z55qxrvuqx.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.14m25wpcs25ijwce.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.19qfvvdveoye105n.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.19u9jx94qr2d43rd.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1ac3y1ysfk5hdwpe.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1ahzh3f3s0x7y09a.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1d63tsjjoa04jbr0.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1m5ism0c0wo3pnp.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1ouvxgcx2cb3vz3d.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1s573kvol4wchtd5.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1uee6pe4ukhbdsap.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1vky0tmma9ll1h5p.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1w7jnjxkvcfheyp4.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.1whgbrunz2ky2x4u.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.219oykx5ipx5crvy.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.23szs92kanj45sn6.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.23vu1jcmvgrysa69.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.2499we6gqog5yca3.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.2981r8m1rxwz0u9y.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.2rtlkw9913cq1wek.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.2ws7pr6bjpzxkgd1.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.31fy6p15idz3y9pm.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.36ue433r46l1kxu0.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.37361nqfp5pbsm91.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3bg268nmulx7kl33.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3btpefbbguoqwzgt.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3kzb3ysatoywdzew.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3lhl58g74a989n6m.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3qjg0vgobk135hut.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.3xuqhsuhccrfnx0x.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.49dz9vfeqf3rjhw1.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4bewd8455ipa490n.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4dmit469p0296m6p.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4mm7u2v6j0t4sysy.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4nkawylazcagwb69.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4q0rufm8r45sbenw.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.4xwggenacwxoehqr.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.55d8gimz8ilx38rq.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.57sfx520nxmadi68.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.5djux561y0pay2mg.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.5g4yc6hy667rcrdr.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.75pkphz719hl2tf.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.7nheorixny0yrlx.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.96j0bfqyua7s07y.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.dng6xnfm9wqx9i6.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.txkzwv8g3bwpqap.rcgu.o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/graph_node_wasm_rs.2vfxw4ab4qv8sjp6.rcgu.o" "-L" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps" "-L" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libpolywrap_wasm_rs-8d0064206c7fec16.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libserde_json-3e2692b422025324.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libryu-90ea2a7919821d97.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libitoa-00cf147319a06894.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libbigdecimal-775a001137b6d2e3.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libnum_bigint-c9053787d42f677d.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libserde-818e4f8248d583a4.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libnum_integer-eaa0e727155c616b.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libnum_traits-aed9bd3cb5c73bd2.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libbyteorder-ab55e28375e65d40.rlib" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libthiserror-9289a781f7551e0b.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-14131fec8d68ac91.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-b9f6e3876ed2586c.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-86fcbf6a3440cba5.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-d18a5d6796083fb1.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-d6774f4e1f890943.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-d280ea049e216073.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-adf188cef5835aec.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-3319673a080f2054.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-fdeb0068d017c92e.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-d3d760f168f99f16.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-bbc1ff69954ec7aa.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-eb937e4ebb9dfc13.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-b7ebdbddd4f4f732.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-a4fd6bd0981bd1bd.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-a6ba5abd095110d9.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-081494498d0f8be5.rlib" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-4b0e4c844ac47183.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/kris/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/kris/WebstormProjects/integrations/system/graph-node/wrapper/target/debug/deps/libgraph_node_wasm_rs.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
  = note: Undefined symbols for architecture arm64:
            "___wrap_invoke_result", referenced from:
                polywrap_wasm_rs::invoke::wrap_invoke::hc7254be172b7a20f in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.4.rcgu.o)
            "___wrap_invoke_error", referenced from:
                polywrap_wasm_rs::invoke::wrap_invoke::hc7254be172b7a20f in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.4.rcgu.o)
            "___wrap_abort", referenced from:
                polywrap_wasm_rs::abort::wrap_abort_setup::_$u7b$$u7b$closure$u7d$$u7d$::h0c714d1d7ee453ca in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.7.rcgu.o)
            "___wrap_invoke_args", referenced from:
                polywrap_wasm_rs::invoke::wrap_invoke_args::ha7ca1f5d71c3354a in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.4.rcgu.o)
            "___wrap_subinvoke_result_len", referenced from:
                polywrap_wasm_rs::subinvoke::wrap_subinvoke::h4d64e008409f88d2 in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
            "___wrap_subinvoke_error", referenced from:
                polywrap_wasm_rs::subinvoke::wrap_subinvoke::h4d64e008409f88d2 in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
            "___wrap_subinvoke_error_len", referenced from:
                polywrap_wasm_rs::subinvoke::wrap_subinvoke::h4d64e008409f88d2 in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
            "___wrap_subinvoke", referenced from:
                polywrap_wasm_rs::subinvoke::wrap_subinvoke::h4d64e008409f88d2 in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
            "___wrap_subinvoke_result", referenced from:
                polywrap_wasm_rs::subinvoke::wrap_subinvoke::h4d64e008409f88d2 in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
            "___wrap_load_env", referenced from:
                polywrap_wasm_rs::env::wrap_load_env::hd8347f7a20469b4d in libpolywrap_wasm_rs-8d0064206c7fec16.rlib(polywrap_wasm_rs-8d0064206c7fec16.polywrap_wasm_rs.1c61dcba-cgu.9.rcgu.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

krisbitney avatar Aug 13 '22 11:08 krisbitney