acap-native-sdk-examples icon indicating copy to clipboard operation
acap-native-sdk-examples copied to clipboard

Trying to build the web-server example, has issues with docker

Open elby0 opened this issue 1 year ago • 8 comments

Hello, I am trying to work with the web-server example. I pulled the code from GitHub repo and executed the following Docker command to build the example.

docker build . --build-arg ARCH=armv7hf --tag web-server:armv7hf

The docker execution resulted in the following error.

`=> ERROR [ 6/10] RUN git apply --ignore-space-change --ignore-whitespace ../monkey.patch && . /opt/axis/acapsdk/envi 0.2s

[ 6/10] RUN git apply --ignore-space-change --ignore-whitespace ../monkey.patch && . /opt/axis/acapsdk/environment-setup* && ./configure --enable-shared --malloc-libc --prefix=/usr/local --bindir=/usr/local/bin --libdir=/usr/local/lib --sysconfdir=/usr/local/packages/list/html --datadir=/usr/local/packages/list/html --mandir=/usr/local/man --logdir=/tmp --plugdir=/usr/local/packages/list/lib --pidfile=/tmp/monkey.pid --incdir=/usr/local/include/monkey --systemddir=/usr/lib/systemd/system && make && make install: 0.217 error: corrupt patch at line 6


Dockerfile:15

14 | WORKDIR /opt/monkey 15 | >>> RUN git apply --ignore-space-change --ignore-whitespace ../monkey.patch &&
16 | >>> . /opt/axis/acapsdk/environment-setup* &&
17 | >>> ./configure
18 | >>> --enable-shared
19 | >>> --malloc-libc
20 | >>> --prefix=/usr/local
21 | >>> --bindir=/usr/local/bin
22 | >>> --libdir=/usr/local/lib
23 | >>> --sysconfdir=/usr/local/packages/list/html
24 | >>> --datadir=/usr/local/packages/list/html
25 | >>> --mandir=/usr/local/man
26 | >>> --logdir=/tmp
27 | >>> --plugdir=/usr/local/packages/list/lib
28 | >>> --pidfile=/tmp/monkey.pid
29 | >>> --incdir=/usr/local/include/monkey
30 | >>> --systemddir=/usr/lib/systemd/system &&
31 | >>> make &&
32 | >>> make install 33 |

ERROR: failed to solve: process "/bin/sh -c git apply --ignore-space-change --ignore-whitespace ../monkey.patch && . /opt/axis/acapsdk/environment-setup* && ./configure --enable-shared --malloc-libc --prefix=/usr/local --bindir=/usr/local/bin --libdir=/usr/local/lib --sysconfdir=/usr/local/packages/list/html --datadir=/usr/local/packages/list/html --mandir=/usr/local/man --logdir=/tmp --plugdir=/usr/local/packages/list/lib --pidfile=/tmp/monkey.pid --incdir=/usr/local/include/monkey --systemddir=/usr/lib/systemd/system && make && make install" did not complete successfully: exit code: 128`

Am I wrong with versions here because that's the only possible scenario I could think off. As, I have just pulled the code from example and trying to execute it.

TIA!

elby0 avatar Sep 20 '24 09:09 elby0

Hi @lbRaytec , thanks for your question.

The example builds and test pass in nightly tests, so more information about your system would be required to see if the problem can be replicated.

What OS and OS version are you using? Which version of Docker Desktop or Docker Engine are you using? Run docker --version and paste command and result here

Are you standing on main branch of this repository when building? Could you paste the SHA1 of last commit or run git log -1 and paste the command and output here?

Have you modified the web-server example?

pataxis avatar Sep 27 '24 12:09 pataxis

Windows 11 version 23H2

Docker version

Docker version 27.2.0, build 3ab4256

last commit log:

commit bea36cadd81ca7a14ae0df52920018a5b94736a6 (HEAD -> main, origin/main, origin/HEAD)
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Sep 17 15:40:17 2024 +0000

chore(deps): update super-linter/super-linter action to v7

No, I have not modified the example. did git clone <url>. Then, navigated into the web-server example and ran as per the documentation.

elby0 avatar Sep 27 '24 12:09 elby0

Are you using Docker Desktop for Windows and building there or are you using Windows Subsystem for Linux (WSL) with Ubuntu? I'm not completely familiar with Docker Desktop setup.

pataxis avatar Sep 27 '24 12:09 pataxis

Navigated to web-server folder.

 set ARCH=armv7hf

Have to use set here because it is the windows alternate for export.

 docker build . --build-arg ARCH --tag web-server:ARCH

This gives me the error!

No, didn't use WSL. Although I have WSL , I didn't build there. Other examples like hello-world worked fine with Windows. Thus, I was optimistic that web-server would work as well.

elby0 avatar Sep 27 '24 12:09 elby0

Thanks for supplying more background. Just mentioning that there was a similar problem for applying patches in #85, but it was solved for Windows setup with WSL.

To troubleshoot, a thing that could be tested is to disable Buildkit to see if a newer version cause some issue DOCKER_BUILDKIT=0 docker build . --build-arg ARCH=armv7hf --tag web-server:armv7hf

If you have possibility to test on WSL, it would be interesting to know if that works better.

pataxis avatar Sep 27 '24 15:09 pataxis

Hi, I tested with WSL and it still reproduces the same error.

The commands I used:

 docker -v
 
 Docker version 27.2.0, build 3ab4256

As per the documentation:

 export ARCH=armv7hf
 
 docker build . --build-arg ARCH --tag web-server:$ARCH

Returned with same error as mentioned above!

My main goal is that I have a AXIS ACAP application which rely on root user. The application was built with Ubuntu Version 20.04 and SDK version 1.1. The Manifest schema version is 1.3. I wanted my ACAP application to make rootless which is the main reason I have to explore this example to understand how it works with the latest schema version and sdk. So that, I can replicate my ACAP application with the latest and make it work rootless.

elby0 avatar Sep 30 '24 09:09 elby0

Hi, just a quick update on this one. I created an Ubuntu 22.04 LTS set up in VM. I then pulled the code and ran the web-server example there and it worked. I am wondering there is something wrong when it comes to Windows may be? As you previously mentioned that it works for Mac OS.

I tried with three different Windows system and all resulted in the same error.

All the three Windows system has same OS version. docker version.

However, I will further generate EAP file and see how it goes! will keep you posted. Thanks for your time!

elby0 avatar Oct 03 '24 12:10 elby0

As you previously mentioned that it works for Mac OS.

We have tests on Linux machines which works. I'm not sure if Docker Desktop on Mac OS has the same issue.

pataxis avatar Oct 03 '24 16:10 pataxis