Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using buildx and QEMU emulator on the amd64 architecture to virtualize an arm64 architecture image, encountered an error during the source compilation of nginx (./configure: error: cannot detect system byte ordering) #5630

Open
lincoohe opened this issue Jan 5, 2025 · 3 comments

Comments

@lincoohe
Copy link

lincoohe commented Jan 5, 2025

10:57:38  #16 125.8 checking for system byte ordering ...
10:57:38  #16 125.8 ./configure: error: cannot detect system byte ordering
10:57:38  #16 ERROR: process "/bin/sh -c mv /etc/apk/repositories /etc/apk/repositories_bak \t&& .... mv /etc/apk/repositories_bak /etc/apk/repositories" did not complete successfully: exit code: 1
10:57:38  ------
10:57:38   > [linux/arm64 stage-0 5/8] RUN --mount=type=cache,id=apk-arm64,sharing=private,target=/var/cache/apk    .... mv /etc/apk/repositories_bak /etc/apk/repositories:
10:57:38   found
10:57:38   found
10:57:38   4 bytes
10:57:38   found
10:57:38   found
10:57:38   found
10:57:38   found
10:57:38   uintptr_t found
10:57:38  125.8 checking for system byte ordering ...
10:57:38  125.8 ./configure: error: cannot detect system byte ordering
10:57:38  ------
10:57:38  
10:57:38   1 warning found (use docker --debug to expand):
10:57:38   - JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 61)
10:57:38  Dockerfile:22
10:57:38  --------------------
10:57:38    21 |     
10:57:38    22 | >>> RUN mv /etc/apk/repositories /etc/apk/repositories_bak \
10:57:38    39 | >>>     && apk update && apk upgrade \
10:57:38    40 | >>>     && apk add --no-cache zlib-dev build-base linux-headers gcc musl musl-dev gcompat \
10:57:38    41 | >>> 	&& apk add --no-cache --virtual build-dependencies patch g++ pcre-dev  automake autoconf make openssl openssl-dev zstd \
10:57:38    42 | >>> 	&& apk add --no-cache pcre logrotate \
10:57:38    44 | >>> 	&& tar zxvf nginx-1.26.1.tar.gz \
10:57:38    45 | >>> 	&& cd /nginx-1.26.1/ \
10:57:38    47 | >>>  	&& unzip nginx_upstream_check_module-master.zip \
10:57:38    48 | >>> 	&& patch -p1 < nginx_upstream_check_module-master/check_1.20.1\+.patch \
10:57:38    49 | >>> 	&& mv /build.sh ./ && chmod +x build.sh \
10:57:38    50 | >>> 	&& ./build.sh \
10:57:38    51 | >>>  && make && make install \
10:57:38  7 v0.18.2 buildkitd --allow-insecure-entitlement=network.host
10:57:38  github.com/moby/buildkit/executor/runcexecutor.exitError
10:57:38  	/src/executor/runcexecutor/executor.go:390
10:57:38  github.com/moby/buildkit/executor/runcexecutor.(*runcExecutor).Run
10:57:38  	/src/executor/runcexecutor/executor.go:338
10:57:38  github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
10:57:38  	/src/solver/llbsolver/ops/exec.go:472
10:57:38  github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
10:57:38  	/src/solver/jobs.go:1100
10:57:38  github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
10:57:38  	/src/util/flightcontrol/flightcontrol.go:122
10:57:38  sync.(*Once).doSlow
10:57:38  	/usr/local/go/src/sync/once.go:76
10:57:38  sync.(*Once).Do
10:57:38  	/usr/local/go/src/sync/once.go:67
10:57:38  runtime.goexit
10:57:38  	/usr/local/go/src/runtime/asm_amd64.s:1700
10:57:38  
10:57:38  746 v0.19.2 /usr/libexec/docker/cli-plugins/docker-buildx buildx build --pull --debug --no-cache --provenance=false --progress=plain --build-arg QEMU_CPU=max --build-arg CACHEBUST=1736045730 -t alpine/nginx:0.0.999.79 --platform linux/arm64,linux/amd64  -f output/Dockerfile output --push
10:57:38  google.golang.org/grpc.(*ClientConn).Invoke
10:57:38  	google.golang.org/[email protected]/call.go:35
10:57:38  github.com/moby/buildkit/api/services/control.(*controlClient).Solve
10:57:38  	github.com/moby/[email protected]/api/services/control/control_grpc.pb.go:88
10:57:38  github.com/moby/buildkit/client.(*Client).solve.func2
10:57:38  	github.com/moby/[email protected]/client/solve.go:269
10:57:38  golang.org/x/sync/errgroup.(*Group).Go.func1
10:57:38  	golang.org/x/[email protected]/errgroup/errgroup.go:78
10:57:38  runtime.goexit
10:57:38  	runtime/asm_amd64.s:1695
@AkihiroSuda AkihiroSuda changed the title Using buildx and QEMU emulator on the amd64 architecture to virtualize an arm64 architecture image, encountered an error during the source compilation of nginx Using buildx and QEMU emulator on the amd64 architecture to virtualize an arm64 architecture image, encountered an error during the source compilation of nginx (./configure: error: cannot detect system byte ordering) Jan 5, 2025
@AkihiroSuda
Copy link
Member

Needs a minimal and complete reproducer

@lincoohe
Copy link
Author

lincoohe commented Jan 7, 2025

@AkihiroSuda Thanks for tracking the issue:
command:

  1.         export DOCKER_CLI_EXPERIMENTAL=enabled
             export BUILDKIT_PROGRESS=plain
             export DOCKER_BUILDKIT=1
             docker pull moby/buildkit:latest
             docker tag  moby/buildkit:latest moby/buildkit:buildx-stable-1
             docker run --rm --privileged  tonistiigi/binfmt  --install  linux/arm64,linux/amd64
             docker buildx create --use --name multiple-arch-simulate
             docker buildx inspect --bootstrap
             docker buildx build --provenance=false -t alpine/nginx:xxxx --platform linux/arm64,linux/amd64  -f output/Dockerfile output --push
    
  2. make nginx :
    ./configure
    --add-module=/nginx-1.26.1/nginx_upstream_check_module-master
    --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
    --modules-path=/usr/lib/nginx/modules
    --conf-path=/etc/nginx/nginx.conf
    --error-log-path=/var/log/nginx/error.log
    --http-log-path=/var/log/nginx/access.log
    --pid-path=/var/run/nginx.pid
    --lock-path=/var/run/nginx.lock
    --http-client-body-temp-path=/var/cache/nginx/client_temp
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp
    --user=nginx --group=nginx
    --with-compat --with-threads
    --with-http_addition_module
    --with-http_auth_request_module
    --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module
    --with-http_mp4_module --with-http_random_index_module --with-http_realip_module
    --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module
    --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail
    --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module
    --with-stream_ssl_preread_module
    --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic'

@lincoohe
Copy link
Author

lincoohe commented Jan 9, 2025

15:31:04 + docker version
15:31:04 Client:
15:31:04 Version: 24.0.7
15:31:04 API version: 1.41 (downgraded from 1.43)
15:31:04 Go version: go1.21.1
15:31:04 Git commit: 24.0.7-0ubuntu2~22.04.1
15:31:04 Built: Wed Mar 13 20:23:54 2024
15:31:04 OS/Arch: linux/amd64
15:31:04 Context: default
15:31:04
15:31:04 Server: Docker Engine - Community
15:31:04 Engine:
15:31:04 Version: 20.10.12
15:31:04 API version: 1.41 (minimum version 1.12)
15:31:04 Go version: go1.16.12
15:31:04 Git commit: 459d0df
15:31:04 Built: Mon Dec 13 11:46:12 2021
15:31:04 OS/Arch: linux/amd64
15:31:04 Experimental: false
15:31:04 containerd:
15:31:04 Version: v1.4.12
15:31:04 GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
15:31:04 runc:
15:31:04 Version: 1.0.2
15:31:04 GitCommit: v1.0.2-0-g52b36a2d
15:31:04 docker-init:
15:31:04 Version: 0.19.0
15:31:04 GitCommit: de40ad0
15:31:04 + docker buildx version
15:31:04 github.com/docker/buildx v0.19.2 1fc5647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants