Open Apollon77 opened 1 year ago
#0 1.719 CMake Error at third_party/openthread/CMakeLists.txt:95 (add_subdirectory):
#0 1.719 The source directory
#0 1.719
#0 1.719 /app/third_party/openthread/repo
#0 1.719
#0 1.719 does not contain a CMakeLists.txt file.
I wonder if you have initialized your git submodules? Check your local repository if anything is in third_party/openthread/repo/
. If not, you may need to initialize the submodules: git submodule update --init
.
it was after the initial checkout, so there should be nothing missing, but I can check that again
@Apollon77 Did you fix the problem?
not really, missed to update here. I ended up in using a VM instead of container
I see the same issue even after I initialize the submodules. Any ideas on what I can do to resolve the issue?
I try just now and I have no problems:
cd /tmp
git clone https://github.com/openthread/ot-br-posix.git
cd ot-br-posix/
git submodule update --init --recursive
docker build --no-cache -t openthread/otbr -f etc/docker/Dockerfile .
Attached you will find the full logs.
As suggested by @superwhd the problem is probably due to the fact that the submodules are not pulled correctly.
Please check if you have something in ot-br-posix/third_party/openthread/repo
Try to execute my commands as-is
Sure, will try and get back to you!
It worked when I checked out the modules recursively: git submodule update --init --recursive.
Thank you!
I recommend updating the guide, it does not mention this step: https://openthread.io/guides/border-router/docker#build_the_dockerfile
I recommend updating the guide, it does not mention this step: https://openthread.io/guides/border-router/docker#build_the_dockerfile
@adis-ikea , the Dockerfile should already do this: https://github.com/openthread/ot-br-posix/blob/b6299f3d7830a0a7f703689a21b0d0c28f5bb4b1/etc/docker/Dockerfile#L93 https://github.com/openthread/ot-br-posix/blob/b6299f3d7830a0a7f703689a21b0d0c28f5bb4b1/script/bootstrap#L171
Can confirm that running git submodule update --init --recursive
solve the problem
@jwhui - I know above you mentioned the docker file does this, but I ran into the same issue. Whatever the docker file is supposed to do, is not doing it when I try to build. I got the same exact error as the person who posted this issue. I had to manually run git submodule update --init to proceed. I created a log file of the docker build command and here is what I saw:
#11 0.159 ++ [[ -d /app/build ]]
#11 0.159 ++ mkdir -v -p /app/build
#11 0.159 mkdir: created directory '/app/build'
#11 0.159 ++ export PATH=/app/stage/usr/bin:/app/stage/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#11 0.159 ++ PATH=/app/stage/usr/bin:/app/stage/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#11 0.160 +++ basename ./script/bootstrap
#11 0.160 ++ TASKNAME=bootstrap
#11 0.160 ++ BEFORE_HOOK=examples/platforms/ubuntu/before_bootstrap
#11 0.160 ++ AFTER_HOOK=examples/platforms/ubuntu/after_bootstrap
#11 0.160 ++ [[ ! -f examples/platforms/ubuntu/before_bootstrap ]]
#11 0.160 ++ BEFORE_HOOK=/dev/null
#11 0.160 ++ [[ ! -f examples/platforms/ubuntu/after_bootstrap ]]
#11 0.160 ++ AFTER_HOOK=/dev/null
#11 0.160 + NAT64_SERVICE=openthread
#11 0.160 + FIREWALL=1
#11 0.160 + main
#11 0.160 + . /dev/null
#11 0.160 + git submodule update --init --recursive --depth 1
#11 0.166 fatal: not a git repository (or any of the parent directories): .git
#11 0.166 + true
#11 0.166 + install_packages
#11 0.166 + have apt-get
#11 0.166 + command -v apt-get
#11 0.166 + install_packages_apt
#11 0.166 + sudo apt-get update
@krbvroc1 , did you git clone
the ot-br-posix
repo?
#11 0.166 fatal: not a git repository (or any of the parent directories): .git
Using git clone
should result in having a .git
directory.
@jwhui I followed the instructions listed here EXACTLY:
https://openthread.io/guides/border-router/docker#build_the_dockerfile
And it resulted in the issue I posted (as well as several other people apparently). So something is not working properly. Maybe that script/bootstrap is running in the wrong directory under docker?
When I clone I do see:
drwxr-xr-x 8 1001 1001 4096 Feb 12 14:46 .git
drwxr-xr-x 4 1001 1001 4096 Feb 12 14:46 .github
-rw-r--r-- 1 1001 1001 1612 Feb 12 14:46 .gitignore
-rw-r--r-- 1 1001 1001 389 Feb 12 14:46 .gitmodules
@jwhui Per some quick google - I see that docker does NOT copy dot folders/files at the root level into the build environment by default.
I modified the Dockerfile to add explicit copies of the .gitmodules
COPY .gitmodules .gitmodules
RUN ./script/bootstrap
COPY . .
RUN ./script/setup
How has this been working for you guys? I had this same issue the last time I tried to build in 2021.
Hello,
The problem is because in the Dockerfile only some folders are copied. In my opinion we should copy everything.
0001-Fix-docker-build-isssue.patch:
From 22e0cdebbc9a8be022b203eb067d839f76a6ed4a Mon Sep 17 00:00:00 2001
From: caipiblack <mathieu.caldeira@laposte.net>
Date: Mon, 12 Feb 2024 21:11:04 +0100
Subject: [PATCH] Fix docker build isssue
---
etc/docker/Dockerfile | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/etc/docker/Dockerfile b/etc/docker/Dockerfile
index eef7a948d8..27b91dfcf5 100644
--- a/etc/docker/Dockerfile
+++ b/etc/docker/Dockerfile
@@ -89,12 +89,10 @@ RUN apt-get update \
&& ([ "${OT_BACKBONE_CI}" != "1" ] || apt-get install --no-install-recommends -y $OTBR_OT_BACKBONE_CI_DEPS) \
&& ln -fs /usr/share/zoneinfo/UTC /etc/localtime
-COPY ./script /app/script
-COPY ./third_party/mDNSResponder /app/third_party/mDNSResponder
+COPY . /app
WORKDIR /app
RUN ./script/bootstrap
-COPY . .
RUN ./script/setup
RUN ([ "${DNS64}" = "0" ] || chmod 644 /etc/bind/named.conf.options) \
--
2.34.1
Also, I think the person who set this line COPY ./third_party/mDNSResponder /app/third_party/mDNSResponder
see the problem, but maybe did not understand what was missing.
With this patch the build succeed but I did not check if it works as expected, (don't have time right now).
In other terms: We still have to check if the docker images works as expected
@caipiblack Yes the resulting image works. As a further optimization, combine all the RUN commands into a single run. It saves about 800MB in the resulting image. Diff below.
diff --git a/etc/docker/Dockerfile b/etc/docker/Dockerfile
index eef7a948d8..aa53f829fc 100644
--- a/etc/docker/Dockerfile
+++ b/etc/docker/Dockerfile
@@ -84,20 +84,18 @@ ENV OTBR_OT_BACKBONE_CI_DEPS curl lcov wget build-essential python3-dbus python3
ENV OTBR_NORELEASE_DEPS \
cpputest-dev
-RUN apt-get update \
- && apt-get install --no-install-recommends -y $OTBR_DOCKER_REQS $OTBR_DOCKER_DEPS \
- && ([ "${OT_BACKBONE_CI}" != "1" ] || apt-get install --no-install-recommends -y $OTBR_OT_BACKBONE_CI_DEPS) \
- && ln -fs /usr/share/zoneinfo/UTC /etc/localtime
-
COPY ./script /app/script
COPY ./third_party/mDNSResponder /app/third_party/mDNSResponder
+COPY . /app
WORKDIR /app
-RUN ./script/bootstrap
-COPY . .
-RUN ./script/setup
-
-RUN ([ "${DNS64}" = "0" ] || chmod 644 /etc/bind/named.conf.options) \
+RUN apt-get update \
+ && apt-get install --no-install-recommends -y $OTBR_DOCKER_REQS $OTBR_DOCKER_DEPS \
+ && ([ "${OT_BACKBONE_CI}" != "1" ] || apt-get install --no-install-recommends -y $OTBR_OT_BACKBONE_CI_DEPS) \
+ && ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
+ && ./script/bootstrap \
+ && ./script/setup \
+ && ([ "${DNS64}" = "0" ] || chmod 644 /etc/bind/named.conf.options) \
&& ([ "${OT_BACKBONE_CI}" = "1" ] || ( \
mv ./script /tmp \
&& mv ./etc /tmp \
&& mv ./etc /tmp \
Note that in my original patch i removed these lines:
-COPY ./script /app/script
-COPY ./third_party/mDNSResponder /app/third_party/mDNSResponder
They are not useful anymore as we copy everything here:
+COPY . /app
WORKDIR /app
Describe the bug A clear and concise description of what the bug is.
To Reproduce Information to reproduce the behavior, including:
docker build --no-cache -t openthread/otbr -f etc/docker/Dockerfile .
Expected behavior Docker image should build
Console/log output
Additional context Add any other context about the problem here.