CLion fastest way to integrate yocto
Hi
I got a yocto SDK installed.
What is the fastest way to get everything working with the SDK?
I tried adding a toolchain and a cmake profile with environment variables set by the sourcing yocto script but I can't get it to work.
Kind regards
Please sign in to leave a comment.
Hello! The usual way to work with Yocto SDK in CLion is to create a CMake toolchain file (seems like Yocto SDK supports it: https://stackoverflow.com/questions/41964891/yocto-sdk-with-cmake-toolchain-file) and then pass it to CMake via -DCMAKE_TOOLCHAIN_FILE=/path/to/file.cmake in File | Settings | Build, Execution, Deployment | CMake | CMake options. Do you get any errors when you do that?
I tried the OEToolchainConfig.cmake file but it still requires to first source the environment with 'source /opt/poky/test/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi'
Is there an easy way to setup CLion without having to source anything but still use the yotcto SDK?
As far as I understand, this is a Yocto SDK requirement. From Yocto Project Software Development Kit (SDK) Developer's Guide:
Once you have the SDK installed, you must run the SDK environment setup script before you can actually use it.
Hi J,
After configuring the cmake toolchain with -DCMAKE_TOOLCHAIN_FILE=/path/to/file.cmake as described by Anna, you can set the environment variables in Run/Debug Configurations -> Environment variables. You can there, either select the yocto environment variables definition file, or directly write in the text area "source /path/to/yocto_sdk_variable_definition_file".
With that, you should be able to cross-compile your code directly in Clion.
Hope this helps you! ;)
Cheers.
Beñat Arejita.
In CLion 2021.3 EAP we introduced an ability to initialize toolchain environment via script - https://blog.jetbrains.com/clion/2021/09/clion-starts-2021-3-eap/#ability_to_initialize_toolchain_environment_via_script. Is might be useful for Yocto setup.