My setup:
Colibri iMX6 512MB IT v1.1B running on the
Colibri Evaluation Board
TorizonCore upstream 5.6.0
I am struggling to run the gpio-toggle.c sample.
I would be okay if I could skip this step and just get the gpiod.h library into my development container for VSCODE, but maybe I should do it properly…
I can see there are instructions but I am unable to follow.
I have downloaded the torizon-samples configured my development environment by sourcing the following batch file from my /~/tcbworkdir:
wslfetch
sudo apt-get update && sudo apt-get install rsync ssh
sudo apt install openssh-client
docker --version
docker run hello-world
docker run --rm -it --privileged torizon/binfmt
docker run --platform linux/arm/v7 --rm -it arm32v7/debian arch
docker run --platform linux/arm64/v8 --rm -it arm64v8/debian arch
rm tcb-env-setup.sh*
wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh
source ./tcb-env-setup.sh
Then I made a copy of the Dockerfile.armhf file and put it in the tcbworkdir as well.
But I get this error message:
leighjboyd@EMERALENOVO11:~/tcbworkdir$ docker build -f Dockerfile.armhf -t leighjboyd/arm32v7-c-gpiod .
Sending build context to Docker daemon 1.096GB
Step 1/17 : ARG CROSS_TC_IMAGE_ARCH=armhf
Step 2/17 : ARG CROSS_TC_DOCKER_REGISTRY=torizon
Step 3/17 : ARG BASE_NAME=debian
Step 4/17 : ARG IMAGE_ARCH=linux/arm/v7
Step 5/17 : ARG IMAGE_TAG=2-bullseye
Step 6/17 : ARG DOCKER_REGISTRY=torizon
Step 7/17 : FROM $CROSS_TC_DOCKER_REGISTRY/debian-cross-toolchain-$CROSS_TC_IMAGE_ARCH:$IMAGE_TAG AS cross-container
---> 4f8af6cdb008
Step 8/17 : ARG GCC_PREFIX=arm-linux-gnueabihf
---> Using cache
---> 2d848376ad7c
Step 9/17 : ARG CROSS_TC_IMAGE_ARCH
---> Using cache
---> cc101410d8ef
Step 10/17 : RUN apt-get -y update && apt-get -y upgrade && apt-get install -y --no-install-recommends libgpiod-dev:$CROSS_TC_IMAGE_ARCH libgpiod2:$CROSS_TC_IMAGE_ARCH && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 07b31403182e
Step 11/17 : WORKDIR /project
---> Using cache
---> 291eb787898f
Step 12/17 : COPY . /project
---> Using cache
---> bb475ee1b291
Step 13/17 : RUN mkdir build && cd build && $GCC_PREFIX-gcc -o gpio-toggle ../gpio-toggle.c -lgpiod && $GCC_PREFIX-gcc -o gpio-event ../gpio-event.c -lgpiod
---> Running in ffb4a0734e47
arm-linux-gnueabihf-gcc: error: ../gpio-toggle.c: No such file or directory
The command '/bin/sh -c mkdir build && cd build && $GCC_PREFIX-gcc -o gpio-toggle ../gpio-toggle.c -lgpiod && $GCC_PREFIX-gcc -o gpio-event ../gpio-event.c -lgpiod' returned a non-zero code: 1
If Im understanidng this right, step 13/17 seems to think gpio-toggle.c should be in a parallel folder from where I run this command. (…/gpio-toggle.c)
If I try this from the location where the Dockerfile.armhf is located :
leighjboyd@EMERALENOVO11:~/torizon-samples/gpio/c$ docker build -f Dockerfile.armhf -t leighjboyd/arm32v7-c-gpiod .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/leighjboyd/torizon-samples/gpio/c/Dockerfile.armhf: no such file or directory
So that’s not the right location either…
Should I copy the /gpio/c/gpio-toggle.c folder so that it is in fact located parallel to tcbworkdir?
Also tried running from the torizon-samples folder:
leighjboyd@EMERALENOVO11:~/torizon-samples$ docker build -f Dockerfile.armhf -t leighjboyd/arm32v7-c-gpiod .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/leighjboyd/torizon-samples/Dockerfile.armhf: no such file or directory
I am hoping that all this will magically solve my REAL issue which is that
#include <gpiod.h> is not found
The last time I experienced a problem like that I went in to docker and installed the library file via the CLI there. but I’m sure that’s not best practice… I am hoping there is a way to use VSCODE to command an apt-get to get the necessary library(ies).
Leigh