dfinity / cycles-wallet

DFINITY Cycles Wallet
Apache License 2.0
55 stars 30 forks source link

Building on Ubuntu 20.04 fails with linker error #100

Closed jsonsivar closed 3 years ago

jsonsivar commented 3 years ago

Hello - I am trying to build the Rust code on Ubuntu 20.04 and I currently get this error related to the LD linker. Seems like it could be a quick fix in my environment but not really sure what it could be. cc @heldrida @Nima-Ra

jsonsivar@jsonsivar-dev:~/src/wallet-rs/wallet$ cargo clean
jsonsivar@jsonsivar-dev:~/src/wallet-rs/wallet$ cargo build
    Updating crates.io index
  Downloaded libflate_lz77 v1.1.0
  Downloaded darling_macro v0.13.0
  Downloaded darling v0.13.0
  Downloaded adler32 v1.2.0
  Downloaded ident_case v1.0.1
  Downloaded darling_core v0.13.0
  Downloaded libflate v1.1.0
  Downloaded rustversion v1.0.5
  Downloaded base64 v0.13.0
  Downloaded half v1.7.1
  Downloaded rle-decode-fast v1.0.1
  Downloaded serde_with_macros v1.4.2
  Downloaded serde_with v1.9.3
  Downloaded serde_cbor v0.11.1
  Downloaded ic-cdk-macros v0.3.0
  Downloaded ic-cdk v0.3.0
  Downloaded ic-certified-map v0.1.0
  Downloaded 17 crates (470.3 KB) in 0.72s
   Compiling unicode-xid v0.2.2
   Compiling proc-macro2 v1.0.27
   Compiling syn v1.0.73
   Compiling autocfg v1.0.1
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.126
   Compiling serde v1.0.126
   Compiling libc v0.2.97
   Compiling typenum v1.13.0
   Compiling version_check v0.9.3
   Compiling memchr v2.4.0
   Compiling fnv v1.0.7
   Compiling regex-syntax v0.6.25
   Compiling crunchy v0.2.2
   Compiling log v0.4.14
   Compiling opaque-debug v0.3.0
   Compiling lazy_static v1.4.0
   Compiling cpufeatures v0.1.4
   Compiling tiny-keccak v2.0.2
   Compiling siphasher v0.3.5
   Compiling hashbrown v0.9.1
   Compiling precomputed-hash v0.1.1
   Compiling new_debug_unreachable v1.0.4
   Compiling fixedbitset v0.2.0
   Compiling bit-vec v0.6.3
   Compiling either v1.6.1
   Compiling crc32fast v1.2.1
   Compiling pico-args v0.4.2
   Compiling diff v0.1.12
   Compiling beef v0.5.0
   Compiling strsim v0.10.0
   Compiling utf8-ranges v1.0.4
   Compiling ident_case v1.0.1
   Compiling typed-arena v2.0.1
   Compiling arrayvec v0.5.2
   Compiling unicode-width v0.1.8
   Compiling hex v0.4.3
   Compiling base32 v0.4.0
   Compiling termcolor v1.1.2
   Compiling paste v1.0.5
   Compiling rustversion v1.0.5
   Compiling leb128 v0.2.4
   Compiling byteorder v1.4.3
   Compiling cfg-if v0.1.10
   Compiling rle-decode-fast v1.0.1
   Compiling adler32 v1.2.0
   Compiling half v1.7.1
   Compiling base64 v0.13.0
   Compiling indexmap v1.6.2
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling num-bigint v0.3.2
   Compiling generic-array v0.14.4
   Compiling phf_shared v0.8.0
   Compiling itertools v0.10.1
   Compiling bit-set v0.5.2
   Compiling pretty v0.10.0
   Compiling codespan-reporting v0.9.5
   Compiling libflate_lz77 v1.1.0
   Compiling string_cache v0.8.1
   Compiling quote v1.0.9
   Compiling ena v0.14.0
   Compiling aho-corasick v0.7.18
   Compiling dirs-sys-next v0.1.2
   Compiling atty v0.2.14
   Compiling libflate v1.1.0
   Compiling petgraph v0.5.1
   Compiling dirs-next v2.0.0
   Compiling regex v1.5.4
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling term v0.7.0
   Compiling sha2 v0.9.5
   Compiling ascii-canvas v3.0.0
   Compiling lalrpop-util v0.19.6
   Compiling darling_core v0.13.0
   Compiling lalrpop v0.19.6
   Compiling wallet v0.1.0 (/home/jsonsivar/src/wallet-rs/wallet)
   Compiling thiserror-impl v1.0.25
   Compiling logos-derive v0.12.0
   Compiling derivative v2.2.0
   Compiling darling_macro v0.13.0
   Compiling candid_derive v0.4.4
   Compiling thiserror v1.0.25
   Compiling logos v0.12.0
   Compiling darling v0.13.0
   Compiling serde_with_macros v1.4.2
   Compiling toml v0.5.8
   Compiling serde_bytes v0.11.5
   Compiling serde_tokenstream v0.1.2
   Compiling serde_with v1.9.3
   Compiling serde_cbor v0.11.1
   Compiling ic-types v0.1.4
   Compiling ic-certified-map v0.1.0
   Compiling proc-macro-crate v0.1.5
   Compiling num_enum_derive v0.5.1
   Compiling candid v0.6.21
   Compiling num_enum v0.5.1
   Compiling ic-cdk v0.3.0
   Compiling ic-cdk-macros v0.3.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.0.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.1.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.10.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.11.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.12.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.13.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.14.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.15.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.2.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.3.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.4.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.5.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.6.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.7.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.8.rcgu.o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wallet.541vjirq-cgu.9.rcgu.o" "-o" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libwallet.so" "-Wl,--version-script=/tmp/rustcR6c9pr/list" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/wallet.wrwzatbjz6er481.rcgu.o" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps" "-L" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libbase64-a22e764ec6273e21.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libserde_cbor-b6d7a4ea588517ae.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libhalf-04f38dd7e714ef42.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libic_certified_map-db9e2e75d04e7820.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libic_cdk-578b01af5f7dac59.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libcandid-4d0b5d8531fef33f.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libleb128-9f8abe11fb887f94.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libbyteorder-54128b8e7267ef72.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/liblogos-00e96534ff5bf3ca.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libnum_bigint-8c849a4544ff5b2e.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libnum_integer-2b5dc59167677dae.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libnum_traits-eb4a5cec26cc8ed6.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libnum_enum-56250e9f7cb9c54e.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/liblalrpop_util-3033378361caf5b0.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libregex-398daf718360e6ff.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libaho_corasick-62bdcad60683d9cc.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libmemchr-95dff019b7f70deb.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libregex_syntax-bd0c6232f9bdad22.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libcodespan_reporting-dc57789d116d4c40.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libunicode_width-df30719f06b67443.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libtermcolor-30f23fe96a3bbab5.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libpretty-0f9c3a128cb48f41.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libarrayvec-6ecfa2689729ef4f.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libtyped_arena-3a45f312efd135a4.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libic_types-db23b175ea7d6675.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libcrc32fast-028f9c3df85424f8.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libbase32-2bbbb6c23bd6c26c.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libserde_bytes-1364b94e6efc4657.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libhex-b78510da5fe1fb81.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libthiserror-b9e125445bd9c3bc.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libsha2-eab44691cbbdd1f9.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libcpufeatures-84a22c0ab87675d6.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libcfg_if-e1080928fa259492.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libopaque_debug-69e38537916f2b30.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libdigest-690e26859f9b576c.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libblock_buffer-c9183e96f336dc78.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libgeneric_array-eb4412ba5bfe65ab.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libtypenum-fe04233c1ebe4053.rlib" "/home/jsonsivar/src/wallet-rs/wallet/target/debug/deps/libserde-5d1a3a7e93a23e29.rlib" "-Wl,--start-group" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-0a9489cf400f65e4.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-ff5dc44c66f8c479.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-3317c66a83501f9c.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-5d8dec11fc25537d.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-3af2a9328550e2a6.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-3092e2ecef0f49f1.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-29b776c021389465.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e8873bd287db0d28.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-1171b49d77e47426.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-c29894d22dc88b51.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-796a7750df3d8218.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-ff7772d803d3e0de.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-dae3eac9cfa44200.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-0fa02f580e987af5.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-7f7254233be843ed.rlib" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1395c6db3d116086.rlib" "-Wl,--end-group" "/home/jsonsivar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-b4bd87926720b651.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
  = note: /usr/bin/ld:/tmp/rustcR6c9pr/list:6: syntax error in VERSION script
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `wallet`

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

We tried upgrade clang and binutils and got the same thing. I.e.,

$ sudo apt install clang-11 --install-suggests
$ sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-11 100
$ sudo apt upgrade binutils

Also tried using lld instead using this command RUSTFLAGS="-C link-arg=-fuse-ld=lld" cargo build and it's a very similar error except the last bit is

  = note: ld.lld: error: /tmp/rustcqEqxfU/list:6: ; expected, but got get_chart
          >>>     canister_query get_chart;
          >>>                    ^
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
p-shahi commented 3 years ago

@jsonsivar You need to run build.sh instead of cargo build. Have you tried that?

jsonsivar commented 3 years ago

Thank you @p-shahi . That works. Spoke with Eric and he suggested the same and it was basically the --target wasm32-unknown-unknown I was missing in my cargo command. I'll close this issue now.