IREE cross compilation from Linux Host to Windows Target using MinGW toolchain - build issues #23261
Replies: 2 comments 1 reply
-
|
Could you be a bit more specific about the issues you're facing ... and fix your markdown? I can't really tell what's going on here or what the error is |
Beta Was this translation helpful? Give feedback.
-
|
I’m trying to cross-compile an IREE model from MLIR to VMFB for a Windows x86_64 target, while running the compilation on a Linux host. I’m using the following command: iree-compile model/squeezenet.mlir When inspecting the output with: iree-dump-module model/squeezenet_windows.vmfb I see that the generated VMFB contains an executable with the format: hal.executable.format = "embedded-elf-x86_64" Relevant excerpt: .rodata[ 3] embedded 19 bytes I also tried switching the target triple to MSVC: --iree-llvmcpu-target-triple=x86_64-pc-windows-msvc but the resulting VMFB still uses embedded-elf-x86_64. Questions:
Any guidance on the expected workflow or limitations here would be greatly appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings!
I'm trying to use iree host tools on linux and compile my image classification inference - C files and cross compile it for Windows target to get it as a windows executable (e.g., inference.exe).
For cross compilation I'm using MinGW toolchain and CMAKE_C_COMPILER: x86_64-w64-mingw32-gcc-posix and CXX_COMPILER: x86_64-w64-mingw32-g++-posix. During the cross compilation build, I'm having issues with
I have tried these options in my CMake before fetching iree
if(CMAKE_CROSSCOMPILING)
message(STATUS "Cross-compilation detected: ${TARGET_DEVICE}")
set(IREE_HAL_DRIVER_LOCAL_ELF OFF CACHE BOOL "" FORCE)
set(IREE_HAL_LOCAL_ELF_ENABLED OFF CACHE BOOL "" FORCE)
set(IREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF OFF CACHE BOOL "" FORCE)
set(IREE_HAL_EXECUTABLE_PLUGIN_EMBEDDED_ELF OFF CACHE BOOL "" FORCE)
set(IREE_HAL_LOCAL_ELF_TESTDATA OFF CACHE BOOL "" FORCE)
=======================================================
Disable unnecessary IREE components
=======================================================
set(IREE_BUILD_COMPILER OFF CACHE BOOL "" FORCE)
set(IREE_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(IREE_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
set(IREE_ENABLE_MLIR OFF CACHE BOOL "" FORCE)
set(IREE_BUILD_PYTHON_BINDINGS OFF CACHE BOOL "" FORCE)
set(IREE_BUILD_BINDINGS_TFLITE OFF CACHE BOOL "" FORCE)
set(IREE_ENABLE_RUNTIME_TRACING OFF CACHE BOOL "" FORCE)
set(IREE_ENABLE_BENCHMARKS OFF CACHE BOOL "" FORCE)
set(IREE_ENABLE_PARAMETER_SUPPORT OFF CACHE BOOL "" FORCE)
Disable ELF test components
set(IREE_HAL_LOCAL_ELF_TESTDATA OFF CACHE BOOL "" FORCE)
set(IREE_HAL_LOCAL_ELF_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
Benchmark configuration
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_LIBPFM OFF CACHE BOOL "" FORCE)
MinGW-specific disables
set(HAVE_PTHREAD_AFFINITY OFF CACHE BOOL "" FORCE)
set(BENCHMARK_HAS_PTHREAD_AFFINITY OFF CACHE BOOL "" FORCE)
set(HAVE_STD_REGEX OFF CACHE BOOL "" FORCE)
=======================================================
Disable problematic modules
=======================================================
set(IREE_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
set(IREE_TASK_TOPOLOGY_INLINE OFF CACHE BOOL "" FORCE)
=======================================================
Enable only runtime features
=======================================================
set(IREE_HAL_DRIVER_LOCAL_SYNC ON CACHE BOOL "" FORCE)
set(IREE_HAL_DRIVER_LOCAL_TASK ON CACHE BOOL "" FORCE)
set(IREE_TARGET_BACKEND_LLVM_CPU ON CACHE BOOL "" FORCE)
set(IREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF OFF CACHE BOOL "" FORCE)
=======================================================
Fetch IREE runtime
=======================================================
include(FetchContent)
FetchContent_Declare(
iree
GIT_REPOSITORY https://github.com/iree-org/iree.git
GIT_TAG candidate-20241104.1068
GIT_SUBMODULES_RECURSE OFF
GIT_SHALLOW ON
GIT_PROGRESS ON
USES_TERMINAL_DOWNLOAD ON
)
And I've also tried running cmake with these options:
cmake -S "$PROJECT_ROOT" -B "$TARGET_BUILD_DIR" -G Ninja
-DCMAKE_BUILD_TYPE=MinSizeRel
-DCMAKE_INSTALL_PREFIX="$TARGET_BUILD_DIR/install"
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_PATH"
-DCMAKE_EXE_LINKER_FLAGS="-lkernelbase"
-DIREE_HAL_DRIVER_LOCAL_ELF=OFF
-DIREE_HAL_LOCAL_ELF_ENABLED=OFF
-DIREE_HAL_LOCAL_ELF_TESTDATA=OFF
-DIREE_BUILD_COMPILER=OFF
-DIREE_BUILD_TOOLS=OFF
-DIREE_BUILD_RUNTIME=ON
-DIREE_BUILD_TESTS=OFF
-DIREE_BUILD_SAMPLES=OFF
-DIREE_BUILD_PYTHON_BINDINGS=OFF
-DIREE_ENABLE_RUNTIME_TRACING=OFF
-DIREE_HAL_LOCAL_ENABLE_EMBEDDED_ELF=OFF
-DTARGET_DEVICE="$TARGET_DEVICE"
-DIREE_HOST_BIN_DIR="$HOST_BIN_DIR_FOR_CMAKE"
Beta Was this translation helpful? Give feedback.
All reactions