Link error for target aarch64-unknown-linux-gnu

Does anyone know about the following link error? where to find the needed libs? I try to add hikey board to tock os, same original Makefile.common file for hail has no issue:

~/tock/0724/tock/boards/hikey$ make
Compiling tock-cells v0.1.0 (file:///home/shawnpeng/tock/0724/tock/libraries/tock-cells)
Compiling tock-registers v0.1.0 (file:///home/shawnpeng/tock/0724/tock/libraries/tock-register-interface)
Compiling hikey v0.1.0 (file:///home/shawnpeng/tock/0724/tock/boards/hikey)
Compiling kernel v0.1.0 (file:///home/shawnpeng/tock/0724/tock/kernel)
Compiling cortexa53 v0.1.0 (file:///home/shawnpeng/tock/0724/tock/arch/cortex-a53)
Compiling capsules v0.1.0 (file:///home/shawnpeng/tock/0724/tock/capsules)
Compiling hi6220 v0.1.0 (file:///home/shawnpeng/tock/0724/tock/chips/hi6220)
error: linking with lld failed: exit code: 1
|
= note: "lld" "-flavor" "gnu" "-L" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps/hikey-fb876f21c2527240.hikey0.rcgu.o" "-o" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps/hikey-fb876f21c2527240" "--gc-sections" "-z,relro,-z,now" "-L" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps" "-L" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/release/deps" "-L" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "--start-group" "-Bstatic" "/tmp/rustcH9rgno/libstd-1d788a3e6eae5ccc.rlib" "--end-group" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-990fa33e9fc6c062.rlib" "-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "-Tlayout.ld" "-zmax-page-size=512"
= note: lld: error: unable to find library -ldl
lld: error: unable to find library -lrt
lld: error: unable to find library -lpthread
lld: error: unable to find library -lgcc_s
lld: error: unable to find library -lc
lld: error: unable to find library -lm
lld: error: unable to find library -lrt
lld: error: unable to find library -lpthread
lld: error: unable to find library -lutil
lld: error: unable to find library -lutil

error: aborting due to previous error

error: Could not compile hikey.

To learn more, run the command again with --verbose.
../Makefile.common:166: recipe for target 'target/aarch64-unknown-linux-gnu/release/hikey' failed
make: *** [target/aarch64-unknown-linux-gnu/release/hikey] Error 101

Shawn

If you're cross-compiling, then you need to install cross-linker and all system libraries for the target system.

Rust only knows how to make static libraries for the given target, but can't make executables itself.

Thank you, the I checked the linker(lld) of llvm does not match aarch64 platform.

Can somebody who has compiled Rust to Cortex-A for Tock OS help me the link error issue, it may relate to the option - -Z linker-flavor=ld.lld, of Makefile.common file. I could not locate the ld.lld, the toolchain for this is "nightly-x86_64-unknown-linux-gnu"

:

~/tock/0724/tock/boards/hikey$ make
Compiling tock-registers v0.1.0 (file:///home/shawnpeng/tock/0724/tock/libraries/tock-register-interface)
Compiling tock-cells v0.1.0 (file:///home/shawnpeng/tock/0724/tock/libraries/tock-cells)
Compiling kernel v0.1.0 (file:///home/shawnpeng/tock/0724/tock/kernel)
Compiling cortexa53 v0.1.0 (file:///home/shawnpeng/tock/0724/tock/arch/cortex-a53)
Compiling capsules v0.1.0 (file:///home/shawnpeng/tock/0724/tock/capsules)
Compiling hi6220 v0.1.0 (file:///home/shawnpeng/tock/0724/tock/chips/hi6220)
Compiling hikey v0.1.0 (file:///home/shawnpeng/tock/0724/tock/boards/hikey)
error: linking with aarch64-linux-gnu-gcc failed: exit code: 1
|
= note: "aarch64-linux-gnu-gcc" "-flavor" "gnu" "-L" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps/hikey-fb876f21c2527240.hikey0.rcgu.o" "-o" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps/hikey-fb876f21c2527240" "--gc-sections" "-no-pie" "-z,relro,-z,now" "-L" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/aarch64-unknown-linux-gnu/release/deps" "-L" "/home/shawnpeng/tock/0724/tock/boards/hikey/target/release/deps" "-L" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "--start-group" "-Bstatic" "/tmp/rustc5AS0kU/libstd-1d788a3e6eae5ccc.rlib" "--end-group" "/home/shawnpeng/.rustup/toolchains/nightly-2018-06-26-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-990fa33e9fc6c062.rlib" "-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "-Tlayout.ld" "-zmax-page-size=512"
= note: aarch64-linux-gnu-gcc: error: gnu: No such file or directory
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-flavor’; did you mean ‘-flto’?
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘--gc-sections’; did you mean ‘--data-sections’?
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘--start-group’; did you mean ‘--stdarg-opt’?
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘--end-group’; did you mean ‘--no-out’?

error: aborting due to previous error

error: Could not compile hikey.

To learn more, run the command again with --verbose.
../Makefile.common:170: recipe for target 'target/aarch64-unknown-linux-gnu/release/hikey' failed
make: *** [target/aarch64-unknown-linux-gnu/release/hikey] Error 101

Most of the time these are dependency-issues. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. When encountering this error please note before the error it may say you are missing a package or header file — you should find those and install them and verify if it works

For Python 2.x use:

$ sudo apt-get install python-dev

If you using python 3, try to replace python-dev with python3-dev

For a specific version of Python 3, replace x with the minor version in

$ sudo apt-get install python3.x-dev