Question about running sample on bare-metal riscv32 target
chiachia36 opened this issue · comments
Hi,
I tried to run sample on spike (bare-metal riscv32 target).
After I checked the sample here, I think I should add some argument in original file to make final binary file be able to run on spike.
I add -iree-llvm-target-triple=riscv32-pc-linux-elf
in to my iree/iree/samples/static_library/CMakeList.txt
(https://github.com/google/iree/blob/main/iree/samples/static_library/CMakeLists.txt)
Then, I ran command
cmake --build ../iree-build/ --target iree_samples_static_library_static_library_demo
Here is my error messages.
FAILED: iree/samples/static_library/static_library_demo
: && /usr/bin/clang++ -O2 -g -Wno-unused-command-line-argument -fuse-ld=lld -lm -lpthread iree/samples/static_library/CMakeFiles/iree_samples_static_library_static_library_demo.dir/create_bytecode_module.c.o iree/samples/static_library/CMakeFiles/iree_samples_static_library_static_library_demo.dir/static_library_demo.c.o -o iree/samples/static_library/static_library_demo iree/samples/static_library/libiree_samples_static_library_simple_mul_c.a iree/hal/local/loaders/libiree_hal_local_loaders_static_library_loader.a iree/hal/local/libiree_hal_local_sync_driver.a iree/samples/static_library/libsimple_mul.a iree/runtime/libiree_runtime_impl.a iree/hal/drivers/libiree_hal_drivers_drivers.a iree/hal/dylib/registration/libiree_hal_dylib_registration_registration.a iree/hal/local/loaders/libiree_hal_local_loaders_system_library_loader.a iree/hal/dylib/registration/libiree_hal_dylib_registration_sync.a iree/hal/local/loaders/libiree_hal_local_loaders_embedded_library_loader.a iree/hal/local/elf/libiree_hal_local_elf_elf_module.a iree/hal/local/elf/libiree_hal_local_elf_arch.a iree/hal/local/elf/libiree_hal_local_elf_platform.a iree/hal/vmvx/registration/libiree_hal_vmvx_registration_registration.a iree/hal/local/libiree_hal_local_task_driver.a iree/task/libiree_task_api.a iree/task/libiree_task_task.a iree/base/internal/libiree_base_internal_event_pool.a iree/base/internal/libiree_base_internal_wait_handle.a third_party/cpuinfo/libcpuinfo.a -pthread third_party/cpuinfo/deps/clog/libclog.a iree/base/internal/libiree_base_internal_threading.a iree/hal/vmvx/registration/libiree_hal_vmvx_registration_sync.a iree/hal/local/libiree_hal_local_sync_driver.a iree/hal/local/loaders/libiree_hal_local_loaders_vmvx_module_loader.a iree/modules/vmvx/libiree_modules_vmvx_vmvx.a iree/hal/vulkan/registration/libiree_hal_vulkan_registration_registration.a iree/hal/vulkan/libiree_hal_vulkan_vulkan.a iree/hal/utils/libiree_hal_utils_buffer_transfer.a iree/hal/utils/libiree_hal_utils_resource_set.a iree/base/internal/libiree_base_internal_arena.a iree/base/internal/libiree_base_internal_atomic_slist.a iree/hal/vulkan/libiree_hal_vulkan_dynamic_symbols.a iree/base/libiree_base_cc.a iree/base/internal/libiree_base_internal_dynamic_library.a -ldl iree/base/internal/libiree_base_internal_file_path.a iree/hal/vulkan/builtin/libiree_hal_vulkan_builtin_builtin.a iree/hal/vulkan/util/libiree_hal_vulkan_util_arena.a iree/base/libiree_base_logging.a iree/base/internal/libiree_base_internal_flags.a iree/base/internal/libiree_base_internal_file_io.a iree/modules/hal/libiree_modules_hal_hal.a iree/vm/libiree_vm_bytecode_module.a iree/vm/libiree_vm_impl.a build_tools/third_party/flatcc/libflatcc_parsing.a -lm -lpthread iree/hal/local/libiree_hal_local_local.a iree/base/internal/libiree_base_internal_fpu_state.a iree/hal/local/libiree_hal_local_executable_environment.a iree/hal/libiree_hal_hal.a iree/base/internal/libiree_base_internal_synchronization.a iree/base/internal/libiree_base_internal_cpu.a iree/base/libiree_base_base.a && :
/usr/bin/ld.lld: error: iree/samples/static_library/libsimple_mul.a(simple_mul.o) is incompatible with elf_x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Do I have to set -iree-llvm-target-float-abi=hard
, -iree-llvm-link-embedded=false
, and -iree-llvm-system-linker-path
like here?
After setting the arguments, does it work on spike as I thought?
Thanks!
(as mentioned in #8938 (comment) this is not the best way to communicate about user support issues like this)
I will send an email to the mailing list.
Thanks!