Question
I was thinking what is the simplest way to get the yocto environment file generated, such that I can get CLion toolchain recognized in the IDE.
I have the yocto project machine so I can just bitbake the image.
I’m primarily interested in the application development with CLion, but not too familiar at all with the Yocto SDK workflows, just the normal yocto project bitbake and devtool.
I have CLion 2024.1.4.
Poky at this commit hash if you need to know
058465859e (HEAD -> master) xz: Update LICENSE variable for xz packages
Research
I did some research on this, and the suggested method was to build yocto SDK installer, and install it on the development machine. Then, you get the environment file and can source it and setup the toolchain into CLion with it.
Links that I found useful to set it up with the yocto SDK installer style
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000526840-CLion-fastest-way-to-integrate-yocto
Yocto SDK with cmake toolchain file
https://youtrack.jetbrains.com/issue/CPP-10677/Yocto-Poky-SDK-support-for-embedded-linux-development
https://docs.yoctoproject.org/sdk-manual/extensible.html
side comment, this one was about the sdk installer error and it fixed it, with this line in the local.conf
TOOLCHAIN_HOST_TASK:append = " nativesdk-cmake"
https://www.openembedded.org/pipermail/openembedded-core/2015-July/106931.html
experimenting with CLion with environment file via Yocto SDK
1.) I had a natively compiling simple helloworld C++ cmake Project on the WSL ubuntu (already worked using the existing g++)
2.) I installed Yocto Project and poky to the WSL ubuntu and I was able to run
bitbake core-image-sato
3.) I can access my WSL from the CLion and use normal toolchain (not yet the yocto toolchain)
4.) I made edit to the conf/local.conf about adding this line, needed seemingly for yocto SDK installer
TOOLCHAIN_HOST_TASK:append = " nativesdk-cmake"
5.1.) I build the yocto SDK installer with this bitbake, installed to my home dir path when it asked it.
bitbake core-image-sato -c populate_sdk
5.2.) I go to the build/deploy/sdk dir and there is the yocto SDK installer, which I run.
6.) I had to add execute permissions to that file, that appeared in my home dir afterwards
environment-setup-core2-64-poky-linux
7.) at least the Yocto SDK installer said that I need to source that environment file first to get access to the SDK,
./environment-setup-core2-64-poky-linux
8.1.) go to CLion settings -> toolchains new toolchain -> environment file -> I put this file
environment-setup-core2-64-poky-linux
8.2.) CLion recognizes now the yocto toolchain!
9.) I add a new CMake profile from CLion CMake page -> select the toolchain, and it recognizes it.
10.) I can build my hello world application at least using the yocto toolchain!