Creation of C++ CMake Applications fail from VSCode

Hello

I’m currently facing the issue that I can not deploy and debug C++ applications from VSCode. The VSCode Plug-In is up to date and the Verdin SoM was installed with the current Easy Pairing image.

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: DOCKER_HOST= docker run --rm -v /home/karsten-lnx/Desktop/TestProject:/home/torizon/app cross-toolchain-arm64-test-project cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -Bbuild-arm64 

CMake Error: Unable to (re)create the private pkgRedirects directory:
/home/torizon/app/build-arm64/CMakeFiles/pkgRedirects

 *  The terminal process "/usr/bin/bash '-c', 'DOCKER_HOST= docker run --rm -v /home/karsten-lnx/Desktop/TestProject:/home/torizon/app cross-toolchain-arm64-test-project cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -Bbuild-arm64'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

The error you’re encountering, “CMake Error: Unable to (re)create the private pkgRedirects directory,” suggests there might be an issue with directory permissions or Docker volume mounting. Here are some steps to troubleshoot and resolve this issue:

  1. Check Directory Permissions:

    • Ensure that the directory /home/karsten-lnx/Desktop/TestProject and its subdirectories have the correct permissions set, allowing the user to write to them. You can use the command chmod -R 755 /home/karsten-lnx/Desktop/TestProject to set appropriate permissions.
  2. Verify Docker Volume Mounting:

    • Confirm that the Docker volume is correctly mounted. The command you provided mounts the project directory to /home/torizon/app inside the container. Ensure that this path is correct and accessible.
  3. Container Permissions:

    • Make sure the Docker container has the necessary permissions to write to the mounted volume. You might need to adjust the user permissions within the container or run the container with elevated privileges.
  4. Configuration Files:

    • Check your .vscode/tasks.json and other configuration files for any misconfigurations related to paths or permissions. Ensure that the paths specified in these files match the actual directory structure.
  5. Rebuild the SDK Container:

    • If the issue persists, try rebuilding the SDK container. This can be done by running the command Remote-Containers: Rebuild Container from the command palette in Visual Studio Code.

These steps should help you resolve the issue with deploying and debugging your C++ application using the Torizon extension in Visual Studio Code.

Best regards, Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

How to cross compile rtl8192eu driver for imx8mp?.

Hi,

just for verification.
I am facing the error while using the stock Torizon Image with Easy Pairing containers together with the unmodified C++ Project created by the Torizon PlugIn in VSCode.

Greetings @KDehren,

This sounds like a permissions issue. As seen in your logs a container bind-mounts the directory /home/karsten-lnx/Desktop/TestProject from your host machine. The container will then run cmake to configure the build, which will result in files and directories being created in /home/karsten-lnx/Desktop/TestProject.

Now for whatever permission related reason, the container can’t create files/directories in /home/karsten-lnx/Desktop/TestProject. I’m not exactly sure why on your PC you have this permission issue, to clarify I don’t get this issue on my setup. I’m not sure if you’re on Linux or WSL or how you have your PC setup/configured. Generally I would say to change the permissions on your directory so that the container can write to it.

This other thread a customer got a similar error and found a way to workaround the permission issues: Qt Template Project not working on Ubuntu Linux

Best Regards,
Jeremias