How to build properly from source with CMake #8109
-
Due to some constraints, I'm unable to use the build.py file and must use cmake directly to build ORT (cross-compiling for another platform). I've tried the following, which seemed successful during compilation:
This generated the libonnxruntime.so library as desired, however I haven't been able to link it to a separate C/C++ test project without getting these errors:
The list of errors goes on, but they are all undefined references to mlas* symbols. I have managed to run my C++ test project linked with the .so generated by build.py earlier -- it's just not working when I compile with the cmake command above. Does anyone see a flaw with how I'm building ORT? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The script was created to manage the complexity of invoking the CMake. I suggest you simply run the script elsewhere with the appropriate arguments and capture the CMake arguments that are logged on the console. Then use them on your target environment. However, you will still need some python, as it invokes flake8 to check python code etc. You would probably need to explore how to disable those things. |
Beta Was this translation helpful? Give feedback.
-
Is the platform that you are cross-compiling to still an x86_64 architecture? I'm guessing that's true because the code is still importing x86_64 functions. cmake\onnxruntime_mlas.cmake selects the x86_64 code based on CMAKE_SYSTEM_PROCESSOR. Is your toolchain file overriding this variable? For the other cross-compiling scenarios (iOS and Android), the processor selection ends up being done through an alternate variable. |
Beta Was this translation helpful? Give feedback.
The script was created to manage the complexity of invoking the CMake. I suggest you simply run the script elsewhere with the appropriate arguments and capture the CMake arguments that are logged on the console. Then use them on your target environment. However, you will still need some python, as it invokes flake8 to check python code etc. You would probably need to explore how to disable those things.