iree
iree copied to clipboard
Fix runtime trace console provider dependency
This PR fix the undefined reference to iree_time_now in https://github.com/iree-org/iree/pull/16454.
The console tracy provider should depend on iree::base::base library.
The original link log is
: && /scratch/yunh/iree/prebuilt/toolchain/clang/linux/RISCV/bin/clang --sysroot=/scratch/yunh/iree/prebuilt/toolchain/clang/linux/RISCV/sysroot -march=rv64i2p1ma2p1f2p2d2p2c2p0 -mabi=lp64d -g -lstdc++ -lpthread -lm -ldl -lm tools/CMakeFiles/iree-cpuinfo.dir/iree-cpuinfo.c.o -o tools/iree-cpuinfo runtime/src/iree/base/libiree_base_base.a runtime/src/iree/base/internal/libiree_base_internal_cpu.a runtime/src/iree/base/libiree_base_base.a runtime/src/iree/base/tracing/libiree_base_tracing_provider.a && :
/scratch/yunh/iree/prebuilt/toolchain/clang/linux/RISCV/bin/riscv64-unknown-linux-gnu-ld: runtime/src/iree/base/tracing/libiree_base_tracing_provider.a(console.c.o): in function `iree_tracing_zone_begin':
/scratch/yunh/iree/runtime/src/iree/base/tracing/console.c:143:(.text+0x336): undefined reference to `iree_time_now'
/scratch/yunh/iree/prebuilt/toolchain/clang/linux/RISCV/bin/riscv64-unknown-linux-gnu-ld: runtime/src/iree/base/tracing/libiree_base_tracing_provider.a(console.c.o): in function `iree_tracing_zone_end':
/scratch/yunh/iree/runtime/src/iree/base/tracing/console.c:172:(.text+0x4ca): undefined reference to `iree_time_now'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
libiree_base_tracing_provider.a comes after libiree_base_base.a so it can't find the symbol. Another way to solve the problem might be using --start-group and --end-group to wrap it.
O_O I found a workaround for the failed build: set -DIREE_ENABLE_LLD=ON (to link to lld instead of the system linker)
Proposed another solution: https://github.com/iree-org/iree/pull/17493