trouble setting up Clion using remote build server with local sources with remote building, C++, yocto, podman

Hi, I figured might as well ask about this issue of setting up correctly clion when using yocto project and remote build server

 

my setup so far

-we have podman running on the build server, with the yocto toolchain installed on the podman image

-I can access normally with SSH the build server and compile my application using the podman container with ‘bitbake -c compile <appRecipe>’ when I logged into the container from the ssh connection. I can build anything successfully once I'm on the SSH into the build server and accessing the podman container with bash login.

-I have all the project sources cloned on the build server, including all the other yocto files and meta-layers

-I have clion on the windows machine locally and I can clone my application repo to windows side

- I opened port from the podman container so that I can actually connect to it from the Clion on windows, SSH connectivity works

 

what ive been unable to do, I would like to get done
* get the yocto toolchain recognized inside Clion via correctly formatted environment file from toolchains → add environment file

 

What I tried.

*created remote host setup from toolchains menu

* added the ssh connectivity to it, getting the green connected checkmark

*added an environment file clion-app.env into the remote side application repo with this kind of contents ( received this from collegue but not exactly got it working

*in Clion side it finds the environment file but cannot recognize toolchain in the proper amount of time. It hangs and just gets the wrong toolchain after very long time (I tested on a home project on my own wsl and when it recognizes any toolchain it does it very fast)

* i know that in normal yocto project environemnt (not sure if applicable to this current setup) there was a command called 'bitbake meta-ide-support' that can somehow generate and environment file for me.

*I know that in normal yocto project environment one could bitbake the SDK and install it, then one should also be able to get the yocto toolchain recognized, somehow according to official guide about it.

clion-app.env (has execute permissoin also with chmod +x) which I tried to use as environment file

this was the kind of file I had (just hidden the username from what my real username was!)

 

 

clion environment file upload id

it was bash script

Upload id: 2024_08_17_tBA8rXrpCL6o9qoaKPFS7c (file: clion-app.env.txt)

do you have any tips how I can ensure that I get yocto toolchain recognized by Clion in this situation?

 

 

 

 

0

allegedly this main approach worked with my collegue! but we trouble shooted it one evening and didnt get the toolchain recognized

0

I have done this exact setup but there's always some struggle to find the compiler(s) and archiver program (ar). I can give you some suggestions. What I do is try to replicate bitbake/openembedded cmake setup in CLion:

  • toolchain.cmake in the recipe's sysroot points to the compiler commands and other needed tools
  • the recipe in the meta layer  can have yocto-specific cmake options you need to replicate to CLion cmake 
  • use the environment file to export path e.g. WORKDIR to recipe's oe-workdirdirectory and append the location of compiler in sysroot-native to PATH env variable
  • in windows (localhost) add CMakeUserPresets.json to the repo root to configure a preset 
    • you can refer to ${WORKDIR} in the preset and construct other locations from there needed within the sysroot
    • I'm setting PKG_CONFIG_* and again PATH env variables here 
  • I deploy sources to the build server and configure the recipe with devtoolto this location so I can also bitbake the same code (useful for building package or different architecture)

Edit: I should add that my yocto environment is not the usual SDK approach with toolchain file that the OP is likely referring and it should require less of manual construction compared to what I described above.

0

请先登录再写评论。