chromiumos-sdk builder failing to build sys-apps/mosys -- possible issue with new Rust compiler... |
|||
Issue description
Ever since the new Rust compiler upgrade, the chromiumos-sdk builder has failed in the SDKTest stage (when it gets that far), failing to build sys-apps/mosys, with what looks suspiciously like a Rust compiler issue:
mosys-1.2.3-r782: [0m[0m[1m[32m Running[0m `rustc --crate-name mosys src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=d7af515d7fdcf13f -C extra-filename=-d7af515d7fdcf13f --out-dir /build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps --target armv7a-cros-linux-gnueabi -C linker=armv7a-cros-linux-gnueabi-clang -L dependency=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps -L dependency=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/release/deps --extern lazy_static=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/liblazy_static-9a3d02707c27815a.rlib --extern getopts=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/libgetopts-34fa8231471f606b.rlib --extern mosys=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/libmosys-850225f5d85604d2.rlib -L native=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3-build`
mosys-1.2.3-r782: [0m[1m[38;5;9merror[0m[0m[1m: linking with `armv7a-cros-linux-gnueabi-clang` failed: exit code: 1[0m
mosys-1.2.3-r782: [0m [0m[0m[1m[38;5;12m|[0m
mosys-1.2.3-r782: [0m [0m[0m[1m[38;5;12m= [0m[0m[1mnote[0m[0m: "armv7a-cros-linux-gnueabi-clang" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/mosys-d7af515d7fdcf13f.mosys3.rcgu.o" "-o" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/mosys-d7af515d7fdcf13f" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps" "-L" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/release/deps" "-L" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3-build" "-L" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "-Wl,-Bstatic" "/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/temp/rustc.uZjnjWHd8pjW/libstd-51636520219da480.rlib" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib" "-Wl,-Bdynamic" "-l" "mosys" "-l" "uuid" "-l" "fmap" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "unwind" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util"[0m
mosys-1.2.3-r782: [0m [0m[0m[1m[38;5;12m= [0m[0m[1mnote[0m[0m: ../mosys-1.2.3/lib/math/math.c:64: error: undefined reference to '__aeabi_ul2f'[0m
mosys-1.2.3-r782: [0m clang-7: error: linker command failed with exit code 1 (use -v to see invocation)[0m
mosys-1.2.3-r782: [0m [0m
mosys-1.2.3-r782:
mosys-1.2.3-r782: fatal runtime error: failed to initiate panic, error 5
mosys-1.2.3-r782: [0m[0m[1m[31merror:[0m Could not compile `mosys`.
mosys-1.2.3-r782:
mosys-1.2.3-r782: Caused by:
mosys-1.2.3-r782: process didn't exit successfully: `rustc --crate-name mosys src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=d7af515d7fdcf13f -C extra-filename=-d7af515d7fdcf13f --out-dir /build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps --target armv7a-cros-linux-gnueabi -C linker=armv7a-cros-linux-gnueabi-clang -L dependency=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps -L dependency=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/release/deps --extern lazy_static=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/liblazy_static-9a3d02707c27815a.rlib --extern getopts=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/libgetopts-34fa8231471f606b.rlib --extern mosys=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/armv7a-cros-linux-gnueabi/release/deps/libmosys-850225f5d85604d2.rlib -L native=/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3-build` (signal: 6, SIGABRT: process abort signal)
mosys-1.2.3-r782: * ERROR: sys-apps/mosys-1.2.3-r782::chromiumos failed (compile phase):
mosys-1.2.3-r782: * cargo build failed
mosys-1.2.3-r782: *
mosys-1.2.3-r782: * Call stack:
mosys-1.2.3-r782: * ebuild.sh, line 133: Called src_compile
mosys-1.2.3-r782: * environment, line 4771: Called cargo_src_compile
mosys-1.2.3-r782: * environment, line 1092: Called die
mosys-1.2.3-r782: * The specific snippet of code:
mosys-1.2.3-r782: * cargo build -v $(usex debug "" --release) --target="${CHOST}" || die "cargo build failed"
mosys-1.2.3-r782: *
mosys-1.2.3-r782: * If you need support, post the output of `emerge --info '=sys-apps/mosys-1.2.3-r782::chromiumos'`,
mosys-1.2.3-r782: * the complete build log and the output of `emerge -pqv '=sys-apps/mosys-1.2.3-r782::chromiumos'`.
mosys-1.2.3-r782: * The complete build log is located at '/build/arm-generic/tmp/portage/logs/sys-apps:mosys-1.2.3-r782:20180729-090939.log'.
mosys-1.2.3-r782: * For convenience, a symlink to the build log is located at '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/temp/build.log'.
mosys-1.2.3-r782: * The ebuild environment file is located at '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/temp/environment'.
mosys-1.2.3-r782: * Working directory: '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3'
mosys-1.2.3-r782: * S: '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3'
mosys-1.2.3-r782: >>> Failed to emerge sys-apps/mosys-1.2.3-r782 for /build/arm-generic/, Log file:
mosys-1.2.3-r782: >>> '/build/arm-generic/tmp/portage/logs/sys-apps:mosys-1.2.3-r782:20180729-090939.log'
mosys-1.2.3-r782:
mosys-1.2.3-r782: * Messages for package sys-apps/mosys-1.2.3-r782 merged to /build/arm-generic/:
mosys-1.2.3-r782:
mosys-1.2.3-r782: * ERROR: sys-apps/mosys-1.2.3-r782::chromiumos failed (compile phase):
mosys-1.2.3-r782: * cargo build failed
mosys-1.2.3-r782: *
mosys-1.2.3-r782: * Call stack:
mosys-1.2.3-r782: * ebuild.sh, line 133: Called src_compile
mosys-1.2.3-r782: * environment, line 4771: Called cargo_src_compile
mosys-1.2.3-r782: * environment, line 1092: Called die
mosys-1.2.3-r782: * The specific snippet of code:
mosys-1.2.3-r782: * cargo build -v $(usex debug "" --release) --target="${CHOST}" || die "cargo build failed"
mosys-1.2.3-r782: *
mosys-1.2.3-r782: * If you need support, post the output of `emerge --info '=sys-apps/mosys-1.2.3-r782::chromiumos'`,
mosys-1.2.3-r782: * the complete build log and the output of `emerge -pqv '=sys-apps/mosys-1.2.3-r782::chromiumos'`.
mosys-1.2.3-r782: * The complete build log is located at '/build/arm-generic/tmp/portage/logs/sys-apps:mosys-1.2.3-r782:20180729-090939.log'.
mosys-1.2.3-r782: * For convenience, a symlink to the build log is located at '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/temp/build.log'.
mosys-1.2.3-r782: * The ebuild environment file is located at '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/temp/environment'.
mosys-1.2.3-r782: * Working directory: '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3'
mosys-1.2.3-r782: * S: '/build/arm-generic/tmp/portage/sys-apps/mosys-1.2.3-r782/work/mosys-1.2.3'
=== Complete: job mosys-1.2.3-r782 (1m38.1s) ===
Failed sys-apps/mosys-1.2.3-r782 (in 1m38.1s). Your build has failed.
Pending 10/661, [Time 02:11:17 | Elapsed 171m24.3s | Load 2.23 5.02 9.93]
Packages failed:
sys-apps/mosys-1.2.3-r782
ERROR : Sun Jul 29 02:11:18 PDT 2018
ERROR : PGID PPID PID ELAPSED TIME %CPU COMMAND
ERROR : Arguments of 10: ./build_packages '--board=arm-generic' '--accept_licenses=@CHROMEOS' '--withdebugsymbols' '--skip_chroot_upgrade' '--nousepkg' '--reuse_pkgs_from_local_boards'
ERROR : Backtrace: (most recent call is last)
ERROR : build_packages:375:main(), called: die_err_trap
ERROR :
ERROR : Command failed:
ERROR : Command '( if [[ "${FLAGS_run_goma}" -eq "${FLAGS_TRUE}" ]]; then
ERROR : info "Starting goma compiler_proxy."; goma_ctl="${GOMA_DIR:-${HOME}/goma}/goma_ctl.py"; "${goma_ctl}" restart; trap "'${goma_ctl}' stop" EXIT;
ERROR : fi; set -o pipefail; sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "${PACKAGES[@]}" | tee "${tmpfile}" )' exited with nonzero code: 1
[1;31m02:11:18: ERROR:
return code: 1; command: /b/swarming/w/ir/cache/cbuild/repository/chromite/bin/cros_sdk --chroot new-sdk-chroot --chrome_root /b/swarming/w/ir/cache/cbuild/repository/.cache/distfiles/target-master/chrome-src 'PARALLEL_EMERGE_STATUS_FILE=/tmp/tmp_sVNO0' 'FEATURES=separatedebug' 'CHROME_ORIGIN=LOCAL_SOURCE' -- ./build_packages '--board=arm-generic' '--accept_licenses=@CHROMEOS' --withdebugsymbols --skip_chroot_upgrade --nousepkg --reuse_pkgs_from_local_boards
cmd=['/b/swarming/w/ir/cache/cbuild/repository/chromite/bin/cros_sdk', '--chroot', 'new-sdk-chroot', '--chrome_root', '/b/swarming/w/ir/cache/cbuild/repository/.cache/distfiles/target-master/chrome-src', 'PARALLEL_EMERGE_STATUS_FILE=/tmp/tmp_sVNO0', 'FEATURES=separatedebug', 'CHROME_ORIGIN=LOCAL_SOURCE', '--', './build_packages', u'--board=arm-generic', '--accept_licenses=@CHROMEOS', '--withdebugsymbols', '--skip_chroot_upgrade', '--nousepkg', '--reuse_pkgs_from_local_boards'], cwd=/b/swarming/w/ir/cache/cbuild/repository, extra env={'PARALLEL_EMERGE_STATUS_FILE': '/tmp/tmp_sVNO0', 'FEATURES': 'separatedebug', 'CHROME_ORIGIN': 'LOCAL_SOURCE'}[0m
[1;31m02:11:18: ERROR: ./build_packages failed (code=1)[0m
02:11:18: INFO: Translating result ./build_packages failed (code=1) to fail.
02:11:18: INFO: Running cidb query on pid 24658, repr(query) starts with <sqlalchemy.sql.expression.Update object at 0x7f6cc131d750>
02:11:18: INFO: Running cidb query on pid 24658, repr(query) starts with <sqlalchemy.sql.expression.Insert object at 0x7f6cc131dad0>
************************************************************
See complete logs at:
https://cros-goldeneye.corp.google.com/chromeos/healthmonitoring/buildDetails?buildbucketId=8939721212849060704
https://cros-goldeneye.corp.google.com/chromeos/healthmonitoring/buildDetails?buildbucketId=8939769092986804752
,
Aug 1
So what exactly is the solution to this problem? I changed the compiler invocation so that rust passes in --rtlib=compiler-rt to clang but it still doesn't appear to work:
Running `rustc --crate-name mosys src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=28b487f7d91f6787 -C extra-filename=-28b487f7d91f6787 --out-dir /build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps --target armv7a-cros-linux-gn
ueabi -C linker=armv7a-cros-linux-gnueabi-clang -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps --extern lazy_static=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gn
ueabi/release/deps/liblazy_static-9a3d02707c27815a.rlib --extern io_jail=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libio_jail-4cab7543d0ce6a0c.rlib --extern getopts=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libgetopts-34fa823
1471f606b.rlib --extern mosys=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libmosys-d4832ffe73eefeec.rlib -C link-args=--rtlib=compiler-rt -L native=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build`
error: linking with `armv7a-cros-linux-gnueabi-clang` failed: exit code: 1
|
= note: "armv7a-cros-linux-gnueabi-clang" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787.mosys8.rcgu.o" "-o" "/build/kevin/tmp/portage/sys-apps/mosy
s-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps" "-
L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build" "-L" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "-Wl,-Bstatic" "/build/kevin/tmp/portage/sys-apps/mosys-9999/temp/rustc.Jxqg8l87p7YO/libstd-51636520219da480.rlib" "/usr/l
ib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib" "-Wl,-Bdynamic" "-l" "minijail" "-l" "util" "-l" "util" "-l" "mosys" "-l" "uuid" "-l" "fmap" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "unwind" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "--rtlib=compiler-rt"
= note: ../mosys-9999/lib/math/math.c:64: error: undefined reference to '__aeabi_ul2f'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
fatal runtime error: failed to initiate panic, error 5
error: Could not compile `mosys`.
,
Aug 1
Issue is "-nodefaultlibs" argument passed to clang. Because of this, clang does not link any default libraries including builtins, it is up to the invoker (rus or mosys) to pass all libraries on the command line.
,
Aug 1
Chirantan, Can you can do the builtins library name to the end of rust invocation of clang command line some how?
The string to pass is : "${CC}" -print-libgcc-file-name
Basically -print-libgcc-file-name gives you the builtins file name.
$ clang -print-libgcc-file-name
/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-x86_64.a
$ armv7a-cros-linux-gnueabi-clang -print-libgcc-file-name
/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-armhf.a
Btw, I also see rust passing some builtins file here:
"/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib"
I don't know the contents of this file but you can also try to pass this at the end again i.e. passed twice; Once at beginning and then at end.
,
Aug 1
How does one "pass all libraries on the command line"? I tried to do that but the compiler refuses to find the library:
Running `rustc --crate-name mosys src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=28b487f7d91f6787 -C extra-filename=-28b487f7d91f6787 --out-dir /build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps --target armv7a-cros-linux-gn
ueabi -C linker=armv7a-cros-linux-gnueabi-clang -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps --extern io_jail=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueab
i/release/deps/libio_jail-4cab7543d0ce6a0c.rlib --extern lazy_static=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/liblazy_static-9a3d02707c27815a.rlib --extern getopts=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libgetopts-34fa823
1471f606b.rlib --extern mosys=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libmosys-d4832ffe73eefeec.rlib -C link-args=--rtlib=compiler-rt -lclang_rt.builtins-armhf -L native=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build`
error: linking with `armv7a-cros-linux-gnueabi-clang` failed: exit code: 1
|
= note: "armv7a-cros-linux-gnueabi-clang" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787.mosys8.rcgu.o" "-o" "/build/kevin/tmp/portage/sys-apps/mosy
s-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps" "-
L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build" "-L" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "-l" "clang_rt.builtins-armhf" "-Wl,-Bstatic" "/build/kevin/tmp/portage/sys-apps/mosys-9999/temp/rustc.eFG1AL7uk8HA/libstd
-51636520219da480.rlib" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib" "-Wl,-Bdynamic" "-l" "minijail" "-l" "clang_rt.builtins-armhf" "-l" "util" "-l" "util" "-l" "clang_rt.builtins-armhf" "-l" "clang_rt.builtins-armhf" "-l" "mosys" "-l" "uuid" "-l" "fmap" "-l" "clan
g_rt.builtins-armhf" "-l" "clang_rt.builtins-armhf" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "unwind" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "--rtlib=compiler-rt"
= note: /usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: cannot find -lclang_rt.builtins-armhf
../mosys-9999/lib/math/math.c:64: error: undefined reference to '__aeabi_ul2f'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
fatal runtime error: failed to initiate panic, error 5
error: Could not compile `mosys`.
I can see that /usr/lib64/clang/8.0.0/lib/linux/libclang_rt.builtins-armhf.a definitely exists in my chroot. What is the magic incantation to make this work?
,
Aug 1
I didn't see comment #4 before I posted, but as you can see passing in -lclang_rt.builtins-${arch} doesn't seem to work. So far I haven't found a way to control the exact order of the command line flags given to clang.
I tried the other approach of making libmosys a shared library instead of a static library. This seems to work fine without needing any changes to anything else so I'm inclined to just go that route instead.
,
Aug 1
We're about to land Rust -> C -> Rust FFI so if you broke libmosys out into a shared library it would go mosys -> libmosys.so -> mosys which I think isn't supported since LD would have to resolve symbols back into the loading binary?
,
Aug 1
For -lclang_rt.builtins-${arch} to work, you should also pass the location with -L before, i.e. -L/usr/lib64/clang/8.0.0/lib/linux/ -lclang_rt.builtins-${arch}
,
Aug 2
So passing in the library path and the name seems to have done it but now the link step fails because of duplicate symbols:
Running `rustc --crate-name mosys src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=28b487f7d91f6787 -C extra-filename=-28b487f7d91f6787 --out-dir /build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps --target armv7a-cros-linux-gn
ueabi -C linker=armv7a-cros-linux-gnueabi-clang -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps -L dependency=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps --extern lazy_static=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gn
ueabi/release/deps/liblazy_static-9a3d02707c27815a.rlib --extern getopts=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libgetopts-34fa8231471f606b.rlib --extern io_jail=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libio_jail-4cab754
3d0ce6a0c.rlib --extern mosys=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/libmosys-d4832ffe73eefeec.rlib -C link-args=-L/usr/lib64/clang/7.0.0/lib/linux -lclang_rt.builtins-armhf -L native=/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build`
error: linking with `armv7a-cros-linux-gnueabi-clang` failed: exit code: 1
|
= note: "armv7a-cros-linux-gnueabi-clang" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787.mosys8.rcgu.o" "-o" "/build/kevin/tmp/portage/sys-apps/mosy
s-9999/work/armv7a-cros-linux-gnueabi/release/deps/mosys-28b487f7d91f6787" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/armv7a-cros-linux-gnueabi/release/deps" "-L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/release/deps" "-
L" "/build/kevin/tmp/portage/sys-apps/mosys-9999/work/mosys-9999-build" "-L" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib" "-L" "/usr/lib64/rust/rustlib/armv7a-unknown-linux-gnueabi/lib" "-l" "clang_rt.builtins-armhf" "-Wl,-Bstatic" "/build/kevin/tmp/portage/sys-apps/mosys-9999/temp/rustc.rhh91w5gvC7c/libstd
-51636520219da480.rlib" "/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib" "-Wl,-Bdynamic" "-l" "minijail" "-l" "clang_rt.builtins-armhf" "-l" "util" "-l" "util" "-l" "clang_rt.builtins-armhf" "-l" "clang_rt.builtins-armhf" "-l" "mosys" "-l" "uuid" "-l" "fmap" "-l" "clan
g_rt.builtins-armhf" "-l" "clang_rt.builtins-armhf" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "unwind" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "-L/usr/lib64/clang/7.0.0/lib/linux"
= note: /usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: error: /usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib(compiler_builtins-7865a408eb6eb6fa.compiler_builtins43-cf9dd8e4461e18cf8abe849873b9834b.rs.rcgu.o): multiple definition
of '__aeabi_uidivmod'
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.27.0/ld.gold.real: /usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-armhf.a(aeabi_uidivmod.S.o): previous definition here
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
fatal runtime error: failed to initiate panic, error 5
error: Could not compile `mosys`.
Yay
,
Aug 2
Given that /usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib seems to have the symbols, So it seems rust has its own prebuilts library. So all rust needs to do it is to add it to the end of the linker command line as well i.e. repeat twice. This is what gcc and clang do when linking internal libraries. e.g. libclang_rt.builtins-x86_64.a is repeated twice with clang. $ clang a.c -o main -### "/usr/bin/x86_64-pc-linux-gnu-ld" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "main" "/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crt1.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crti.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/crtbegin.o" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64" "-L/usr/bin/../lib64" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../x86_64-pc-linux-gnu/lib" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../.." "-L/usr/bin/../lib" "-L/lib" "-L/usr/lib" "/tmp/a-638951.o" "/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-x86_64.a" "-lgcc_eh" "-lc" "/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-x86_64.a" "-lgcc_eh" "/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/crtend.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crtn.o"
,
Aug 7
Thinking a bit more, I think the issue would be fixed if rustc could put"/usr/lib64/rust/rustlib/armv7a-cros-linux-gnueabi/lib/libcompiler_builtins-7865a408eb6eb6fa.rlib" at the end instead of before other libraries.
,
Aug 7
Regarding #7 about making mosys as shared library, It may actually fix the symbols issue since linker should resolve the __aeabi functions from builtins in the shared library. To verify that, linking the shared library with "-Wl,-z,defs" or "-Wl,--no-undefined" shouldn't raise any errors. |
|||
►
Sign in to add a comment |
|||
Comment 1 by chirantan@chromium.org
, Jul 31The actual error is happening when compiling a C file so it's very unlikely to be an issue with the rust compiler: ../mosys-1.2.3/lib/math/math.c:64: error: undefined reference to '__aeabi_ul2f' More likely the build.rs in meson needs to pass in compiler_rt as a link library.