I am trying to cross-compile flang, running into
'*** No rule to make target ‘NATIVE/bin/mlir-linalg-ods-yaml-gen’
I would be grateful for any hints or suggestions.
In more detail, I would like to build a native LLVM+flang compiler that will run on Windows/aarch64 and produce code for that platform. I want to build this compiler on Linux/x86_64. I am cross-compiling it using LLVM(clang).
I am using LLVM 16.0.5. My setup worked for clang: I could cross-compile a native LLVM+clang compiler. But not for flang.
The flang README.md shows how to build flang out of LLVM tree, providing it with -DMLIR_DIR= to point to an existing mlir build. Is that a possible work-around? Or should it be possible to do this without pre-building native MLIR, allowing LLVM to build it automatically when cross-compiling flang?
I am building the cross-compilers (to run on Linux/x86_64 and produce code for Windows/aarch64) already including MLIR, so there is already an installed version of mlir-linalg-ods-yaml-gen (in a directory layout after installation). Is it possible to tell LLVM to use such external build when cross-compiling? Or does it need the layout produced during the build (before installation)?
In case anyone else runs into this, I found a solution to a part of my question. The cmake variable name is MLIR_LINALG_ODS_YAML_GEN and this specific problem was about cross-compilation of mlir (even without flang, but mlir is being compiled automatically as a dependency of flang).
I found the variable name from Julia scripts to cross-compile LLVM: