CMake C++ Hello

Hi,
I try to compile the default CMake C++ Hello project.
I use Visual Code with Torizon extension, my host is a fedora 41.
Compilation for local machine work fine.
Compilation for my imx6ULL didn’t. I have this error:Executing task: DOCKER_HOST= docker run --**rm -v /home/XXXXXX//test0:/home/torizon/app cross-toolchain-arm-test0-container cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -Bbuild-arm

CMake Error: The source directory “/home/torizon/app” does not appear to contain CMakeLists.txt.**

I tried to run the command:
docker run --rm -it -v /home/XXXXXX/test0:/home/torizon/app cross-toolchain-arm-test0-container bash
Command work fine, I’m in the container, under /home/torizon/app but I cannot do anything in this directory, no ‘touch’ no ‘ls’ , I receive a “permission denied”.
It’s very strange because if I go on the parent directory and do a ‘ls -la’ I got:
drwxr-xr-x. 1 torizon torizon 348 Dec 6 07:01 app

whoami says : torizon

id -u says 1000 // the same user host id
id -g says 1000 // the same group host id

So I suspect a right access problem when launching the container but I don’t know what to do to solve the problem ! Rebuild the container ?

Any clue ?

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,

It seems you’re encountering a permissions issue when trying to compile your C++ project for the iMX6ULL using Docker. This is likely due to how the volume is mounted and the user permissions within the container. Here are some steps to help you resolve this:

  1. Check Volume Mount Permissions:

    • Ensure the directory /home/XXXXXX/test0 on your host has the correct permissions for the torizon user inside the container. You can temporarily set more permissive permissions to test this:
      chmod -R 777 /home/XXXXXX/test0
      
    • If this resolves the issue, adjust the permissions to be more secure, ensuring the torizon user has the necessary access.
  2. Verify User and Group IDs:

    • Make sure the user and group IDs match between your host and the container. The torizon user inside the container should have the same UID and GID as your host user.
    • You can specify these IDs in your Docker run command using the --user flag:
      docker run --rm -it -v /home/XXXXXX/test0:/home/torizon/app --user $(id -u):$(id -g) cross-toolchain-arm-test0-container bash
      
  3. Check Docker Group Membership:

    • Ensure your host user is part of the docker group to avoid permission issues when running Docker commands without sudo:
      sudo usermod -aG docker $USER
      
    • Log out and back in for the changes to take effect.

By following these steps, you should be able to resolve the permission issues and successfully compile your project for the iMX6ULL target. If the problem persists, double-check your Docker and user configurations.

Best regards,
Toradex AI Assistant

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

Docker pull permission denied.

Arg, seems to be a selinux issue. Doing a ‘sudo setenforce 0’ solve the problem.