Unable to compile to aarch64-unknown-linux-gnu

rustup = 1.23.1
active toolchain = stable-x86_64-unknown-linux-gnu
rustc = 1.49.0
cargo = 1.49.0
// main.rs
// a simple calculator to test tier 1 aarch64 support in rust 1.49
use std::io;

fn main() {
    loop {
        println!("Please input an operation (Q to exit): ");
        let mut inp = String::new();
        io::stdin().read_line(&mut inp).expect("Enter a valid op.");
        if (inp.trim() == "Q") || (inp.trim() == "q") {
            break;
        } else {
            let parsebuf: Vec<&str> = inp.trim().split(" ").collect();
            let mut err = "";

            let res = match parsebuf[1] {
                "+" => parsebuf[0].parse::<f64>().unwrap() + parsebuf[2].parse::<f64>().unwrap(),
                "-" => parsebuf[0].parse::<f64>().unwrap() - parsebuf[2].parse::<f64>().unwrap(),
                "*" | "x" | "X" => parsebuf[0].parse::<f64>().unwrap() * parsebuf[2].parse::<f64>().unwrap(),
                "/" | "รท" => parsebuf[0].parse::<f64>().unwrap() / parsebuf[2].parse::<f64>().unwrap(),
                "^" | "**" => parsebuf[0].parse::<f64>().unwrap().powf(parsebuf[2].parse::<f64>().unwrap()),
                "mod" | "MOD" | "%" => parsebuf[0].parse::<f64>().unwrap() % parsebuf[2].parse::<f64>().unwrap(),
                _ => {
                    err = "Invalid op";
                    0.0
                }
            };

            if err != "" {
                println!("Error:{}", err);
            } else {
                println!("{}", res);
            };
        };
    };
}
# command used for compilation
cargo build --target aarch64-unknown-linux-gnu
# output (after re-running with --verbose)
   Compiling calc v0.1.0 (/home/saadi/Coding/rust_proj/calc)
     Running `rustc --crate-name calc --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=1bc38cfcfe825a6a -C extra-filename=-1bc38cfcfe825a6a --out-dir /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C incremental=/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/incremental -L dependency=/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/home/saadi/Coding/rust_proj/calc/target/debug/deps`
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.136h69aegbla1dwq.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.146twevhp3wlueea.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.14rg7s8kgcpzn50r.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.18gab1ifve63aiw1.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.19lgmws7oe50kc7j.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1cjq7sxn8kcfefhs.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1dsmq308p5jd4y84.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1isnx8uzyq5wtez3.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1kdeaw9rux8maltn.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1khjxco1icflu7hv.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1mrvyahqt77qja7m.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1vz9oi527swimxbx.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.1ygb0e6oh9ernhdw.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.28fc9rts3l6b5j50.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2cjab1xof533uzmd.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2cs0x0vfs0d62kwk.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2dnwkl47nzh4guvo.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2eyhcrzcbw3wcfg2.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2fac7t1pm2xrh2mg.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2m9i8aoi25akiw0l.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2mw0bj903lwcz2t1.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2p13xt8795otc392.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2pclcslkre5kddzf.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2pwig3bdkt3yfx7f.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2qhve7y2qij8qt13.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2vb776nkdlb7la66.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.2ygkmq9vmtvievpy.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.30qac9kk8w9uij5n.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.320ixu03p56pxz2j.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.32ixysv1moois0yt.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3bggaqwtlva0s3cl.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3ecdonfg1l2rnylv.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3erh58rc46d6g9a1.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3fpka6if38vubwvg.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3gcjsqmgdyrfhanv.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3iyt0tzpjuhocslu.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3mu8hvnhb1mn6fd4.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3tkx1g79m6k1d9r5.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3va0380pl5umkndw.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3vvui560jasyb669.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3wqs03htgk6drowo.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3zhhsq1ngaitonff.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.3zn40axk1dkg1yyf.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.40i3sql7ohymrqt4.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.42a66tmtgvk0uhxb.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.42j03es0a3hf4ra7.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.45nroz6wrzvmmaq9.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.46kcf6xl6ypfbjpj.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4a4vwyeh5auelnoq.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4buep9u3axzqrcyz.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4dct0m9w5ukukzhm.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4eclnscv1bo5xxx5.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4eimqwe2laeaow5p.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4fjo9a7a8s6a52ho.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4h81jz175ohjb7ys.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4kpmfy9pvp3kbw1q.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4ohe6bbx141konfx.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4qzsdsj9c1fj2cfr.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4savnnge7hdfgilf.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4tlksuxj8p4hvp19.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.4v8cbau1fgccjov2.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.501oj4zv0xtqmtdx.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.522taasb3czaj8zp.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.57c0yheg5vap851h.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.58q3m9q4b5qhryfl.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.5anzs6ybieov1p49.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.9cg873i60kl0394.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.ayux9apylyla9v0.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.uni1mggyhholdc5.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.wwpkg1i31usu608.rcgu.o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.zw9aum8c21eblyc.rcgu.o" "-o" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.19onri5z7l0d0505.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps" "-L" "/home/saadi/Coding/rust_proj/calc/target/debug/deps" "-L" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-5b1d7b96931a3aa7.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-a4d8cb8695e99ca2.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-8f7ee3a66d5263a2.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-073e727127f3a79a.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-5649783032f394ad.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-ab4907804cc31b6a.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-c892d6ceb573f38f.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-11099ac2cbd8ce76.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-bb11f2425839250b.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-6ea4e18b234faf5b.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-691f83b6be462127.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-ceb1eea30bd6972a.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-fc15488178b23d9c.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-55cbf548fbeff055.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-e841a26a80a43f98.rlib" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-6c113c0c183f3f13.rlib" "-Wl,--end-group" "/home/saadi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-dedf96718b1b5f55.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-lutil"
  = note: /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps/calc-1bc38cfcfe825a6a.11d4yjnq7c8j1q80.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: could not compile `calc`

Caused by:
  process didn't exit successfully: `rustc --crate-name calc --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=1bc38cfcfe825a6a -C extra-filename=-1bc38cfcfe825a6a --out-dir /home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C incremental=/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/incremental -L dependency=/home/saadi/Coding/rust_proj/calc/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/home/saadi/Coding/rust_proj/calc/target/debug/deps` (exit code: 1)
other relevant information:

OS = Ubuntu 20.04 LTS

arch = amd64 (x86-64)

installed gcc related libraries = [
cpp-9-aarch64-linux-gnu,
cpp-aarch64-linux-gnu, 
gcc-9-aarch64-linux-gnu-base,
gcc-aarch64-linux-gnu,
gcc-10-aarch64-linux-gnu,
...
]

I am unable to understand why this error occurs. Any help would be appreciated.

You'll need to create a .cargo/config.toml file (this can be under your project directory, or a higher-level directory like your home directory) to tell Cargo how to call the right linker:

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

For more details, see the rust-cross repo.

That doesn't work either. The manifest key is unused.

warning: unused manifest key: target.aarch64-unknown-linux-gnu.linker

cargo.toml

...

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

command

cargo build --target aarch64-unknown-linux-gnu

The linker line should be in ~/.cargo/config.toml rather than Cargo.toml.

.cargo/config.toml can also be in the current working directory or any parent of it.

It works now. Thank you so much.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.