SoftetherVPN-docker icon indicating copy to clipboard operation
SoftetherVPN-docker copied to clipboard

build for arm is failing when using docker buildx

Open weidi opened this issue 3 years ago • 10 comments

When using docker buildx to build multiarch images the arm builds are failing to build blake2. If building natively on arm (RaspberryPi) there is no issue so somethings funky with the way how buildx does ARM abstraction.

weidi avatar Jul 19 '22 20:07 weidi

please provide steps how to invoke buildx to build arm (is it really arm64 ?) images

chipitsine avatar Jul 20 '22 17:07 chipitsine

You can invoke buildx this way creating amd64, arm64 and armv7(rpi1-3) images

docker buildx build -t softethervpn/vpnserver:stable -f .\Dockerfile.stable --push --platform linux/amd64,linux/arm64,linux/arm/v7 .

weidi avatar Jul 20 '22 18:07 weidi

I tried on Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1:

r$ docker buildx build -t softethervpn/vpnserver:stable -f Dockerfile.stable --push --platform linux/amd64,linux/arm64,linux/arm/v7 .
unknown shorthand flag: 't' in -t
See 'docker --help'.

...

chipitsine avatar Jul 21 '22 06:07 chipitsine

nevermind, I've figured out how to invoke it

chipitsine avatar Jul 21 '22 06:07 chipitsine

if I invoke like that docker build -f Dockerfile --platform linux/amd64 ., I see

Step 11/27 : FROM builder-$TARGETARCH AS builder
invalid reference format

chipitsine avatar Jul 21 '22 06:07 chipitsine

I picked build command from README ...

docker build -t softethevpn:latest .
Sending build context to Docker daemon  97.28kB
Step 1/27 : FROM alpine as base
 ---> d7d3d98c851f
Step 2/27 : ARG GIT_TAG=5.02.5180
 ---> Using cache
 ---> 1105e1a0e774
Step 3/27 : ARG TARGETPLATFORM
 ---> Using cache
 ---> b37b6da6ca22
Step 4/27 : ARG TARGETARCH
 ---> Using cache
 ---> 7688a88f9472
Step 5/27 : FROM base AS builder-amd64
 ---> 7688a88f9472
Step 6/27 : ENV TARGET_CONFIG_FLAGS ""
 ---> Using cache
 ---> 1975ce948d0d
Step 7/27 : FROM base AS builder-arm64
 ---> 7688a88f9472
Step 8/27 : ENV TARGET_CONFIG_FLAGS "--disable-sse2"
 ---> Using cache
 ---> ce734e35db7a
Step 9/27 : FROM base AS builder-arm
 ---> 7688a88f9472
Step 10/27 : ENV TARGET_CONFIG_FLAGS "--disable-sse2"
 ---> Using cache
 ---> ce734e35db7a
Step 11/27 : FROM builder-$TARGETARCH AS builder
invalid reference format

chipitsine avatar Jul 21 '22 06:07 chipitsine

Reverted the implementation of different Target config flags in 88972aeb6896e1a0ec1695cdb8da0d10a1c9400b as this was just a try for a workaround.

weidi avatar Jul 24 '22 19:07 weidi

I implemented a GitHub CI to try on a completely different platform but it seems that the buildx (qemu) ARM emulation has some drawbacks here. Still not sure on how to work around it

weidi avatar Sep 30 '22 07:09 weidi

Although this issue is closed, I found that it might be caused by the cmake_host_system_information() function returning the "real" CPU information, even when running inside a QEMU environment. This can be found in the SoftEtherVPN source at src/Cedar/CMakeLists.txt (link below).

https://github.com/SoftEtherVPN/SoftEtherVPN/blob/e475d70c0b0e62683cf03e764d0937f54aa62266/src/Cedar/CMakeLists.txt#L24

It may be fixed by using a different method, such as check_cxx_compiler_flag().

ohsawa avatar Oct 10 '24 12:10 ohsawa

we love pull requests.

chipitsine avatar Oct 10 '24 13:10 chipitsine