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

Bug: Docker build failure on arm64, v0.12.0 #2115

Closed
YC opened this issue Jan 13, 2022 · 4 comments
Closed

Bug: Docker build failure on arm64, v0.12.0 #2115

YC opened this issue Jan 13, 2022 · 4 comments
Labels
Bug Something isn't working Help Wanted Extra attention is needed Up for grabs Looking for a contributor to fix it

Comments

@YC
Copy link
Contributor

YC commented Jan 13, 2022

Steps to reproduce the behavior

$ uname -a
Linux <redacted> 5.11.0-1022-oracle #23~20.04.1-Ubuntu SMP Fri Nov 12 15:45:47 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
Build output
$ docker build -f docker/Dockerfile .
Sending build context to Docker daemon   30.2MB
Step 1/21 : FROM node:16.3.0 as nodebuild
16.3.0: Pulling from library/node
310b368da982: Pull complete 
86422c44ee00: Pull complete 
9137877e0c26: Pull complete 
785171b903c4: Pull complete 
0373cebfde2c: Pull complete 
86a7b2799124: Pull complete 
026d4a372991: Pull complete 
99f213140006: Pull complete 
49285d4db505: Pull complete 
Digest: sha256:ca6daf1543242acb0ca59ff425509eab7defb9452f6ae07c156893db06c7a9a4
Status: Downloaded newer image for node:16.3.0
 ---> a6abb7a3800e
Step 2/21 : WORKDIR /webapp
 ---> Running in 7a949c408634
Removing intermediate container 7a949c408634
 ---> bd4358888640
Step 3/21 : ADD webapp/ /webapp
 ---> df5ec9bd28b8
Step 4/21 : RUN npm install --no-optional &&     npm run pack
 ---> Running in f2730972c794
npm WARN deprecated xmldom@0.3.0: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     '/webapp/node_modules',
npm WARN cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/webapp/node_modules/gifsicle'] {
npm WARN cleanup       errno: -39,
npm WARN cleanup       code: 'ENOTEMPTY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '/webapp/node_modules/gifsicle'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm notice 
npm notice New major version of npm available! 7.15.1 -> 8.3.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
npm notice Run `npm install -g npm@8.3.0` to update!
npm notice 
npm ERR! code 1
npm ERR! path /webapp/node_modules/optipng-bin
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! Command failed: /webapp/node_modules/optipng-bin/vendor/optipng --version
npm ERR! /webapp/node_modules/optipng-bin/vendor/optipng: 1: /webapp/node_modules/optipng-bin/vendor/optipng: @@8�@@@@@@@�@@@@����: not found
npm ERR! /webapp/node_modules/optipng-bin/vendor/optipng: 2: /webapp/node_modules/optipng-bin/vendor/optipng: d: not found
npm ERR! /webapp/node_modules/optipng-bin/vendor/optipng: 1: /webapp/node_modules/optipng-bin/vendor/optipng: Syntax error: ";" unexpected
npm ERR! /webapp/node_modules/optipng-bin/vendor/optipng: 1: /webapp/node_modules/optipng-bin/vendor/optipng: �ELF: not found
npm ERR! 
npm ERR! 
npm ERR! optipng pre-build test failed
npm ERR! Error: Command failed: /bin/sh -c make install
npm ERR! pngrtran.c:99:1: warning: 'png_rtran_ok' defined but not used [-Wunused-function]
npm ERR!  png_rtran_ok(png_structrp png_ptr, int need_IHDR)
npm ERR!  ^~~~~~~~~~~~
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! pngxmem.c: In function 'pngx_malloc_rows_extended':
npm ERR! pngxmem.c:38:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]
npm ERR!         (pngx_alloc_size_t)height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
npm ERR!                                   ^
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! /usr/bin/ld: ../libpng/libpng.a(pngrutil.o): in function `png_read_filter_row':
npm ERR! pngrutil.c:(.text+0x1e94): undefined reference to `png_init_filter_functions_neon'
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make[1]: *** [Makefile:100: optipng] Error 1
npm ERR! make: *** [Makefile:14: install] Error 2
npm ERR! 
npm ERR! cd src/optipng && \
npm ERR! make install && \
npm ERR! cd ../..
npm ERR! make[1]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/optipng'
npm ERR! cd ../libpng && \
npm ERR! make -f Makefile PNGLIBCONF_H_PREBUILT=pnglibconf.h.optipng && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/libpng'
npm ERR! cp pnglibconf.h.optipng pnglibconf.h
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o png.o png.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngerror.o pngerror.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngget.o pngget.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngmem.o pngmem.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngpread.o pngpread.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngread.o pngread.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrio.o pngrio.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrtran.o pngrtran.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrutil.o pngrutil.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngset.o pngset.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtrans.o pngtrans.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwio.o pngwio.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwrite.o pngwrite.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwtran.o pngwtran.c
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwutil.o pngwutil.c
npm ERR! ar rcs libpng.a png.o pngerror.o pngget.o pngmem.o pngpread.o pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
npm ERR! ranlib libpng.a
npm ERR! gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtest.o pngtest.c
npm ERR! gcc  -L../zlib -o pngtest pngtest.o libpng.a -lz -lm
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/libpng'
npm ERR! cd ../opngreduc && \
npm ERR! make -f Makefile libopngreduc.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/opngreduc'
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -o opngreduc.o opngreduc.c
npm ERR! ar cru libopngreduc.a opngreduc.o
npm ERR! ranlib libopngreduc.a
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/opngreduc'
npm ERR! cd ../gifread && \
npm ERR! make -f Makefile libgifread.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/gifread'
npm ERR! gcc -c  -O2 -Wall -Wextra -o gifread.o gifread.c
npm ERR! ar cru libgifread.a gifread.o
npm ERR! ranlib libgifread.a
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/gifread'
npm ERR! cd ../pnmio && \
npm ERR! make -f Makefile libpnmio.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/pnmio'
npm ERR! gcc -c  -O2 -Wall -Wextra -o pnmin.o pnmin.c
npm ERR! gcc -c  -O2 -Wall -Wextra -o pnmout.o pnmout.c
npm ERR! gcc -c  -O2 -Wall -Wextra -o pnmutil.o pnmutil.c
npm ERR! ar cru libpnmio.a pnmin.o pnmout.o pnmutil.o
npm ERR! ranlib libpnmio.a
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/pnmio'
npm ERR!^[[?1;2c^[[?1;2c cd ../minitiff && \
npm ERR! make -f Makefile libminitiff.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/minitiff'
npm ERR! gcc -c  -O2 -Wall -Wextra -o tiffread.o tiffread.c
npm ERR! gcc -c  -O2 -Wall -Wextra -o tiffutil.o tiffutil.c
npm ERR! ar cru libminitiff.a tiffread.o tiffutil.o 
npm ERR! ranlib libminitiff.a
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/minitiff'
npm ERR! cd ../pngxtern && \
npm ERR! make -f Makefile libpngxtern.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/pngxtern'
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxread.o pngxread.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrbmp.o pngxrbmp.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrgif.o pngxrgif.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrjpg.o pngxrjpg.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrpnm.o pngxrpnm.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrtif.o pngxrtif.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxio.o pngxio.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxmem.o pngxmem.c
npm ERR! gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxset.o pngxset.c
npm ERR! ar cru libpngxtern.a pngxread.o pngxrbmp.o pngxrgif.o pngxrjpg.o pngxrpnm.o pngxrtif.o pngxio.o pngxmem.o pngxset.o
npm ERR! ranlib libpngxtern.a
npm ERR! make[2]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/pngxtern'
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optipng.o optipng.c
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optim.o optim.c
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o bitset.o bitset.c
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ioutil.o ioutil.c
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ratio.o ratio.c
npm ERR! gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o wildargs.o wildargs.c
npm ERR! gcc -s -o optipng optipng.o optim.o bitset.o ioutil.o ratio.o wildargs.o ../opngreduc/libopngreduc.a ../pngxtern/libpngxtern.a ../libpng/libpng.a  ../gifread/libgifread.a ../pnmio/libpnmio.a ../minitiff/libminitiff.a  -lz -lm 
npm ERR! make[1]: Leaving directory '/tmp/03c628b6-abbc-4b94-a0c6-95cbbf5d02ed/src/optipng'
npm ERR! 
npm ERR!     at /webapp/node_modules/bin-build/node_modules/execa/index.js:231:11
npm ERR!     at runMicrotasks (<anonymous>)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR!     at async /webapp/node_modules/optipng-bin/lib/install.js:17:4

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-13T06_47_20_389Z-debug.log
The command '/bin/sh -c npm install --no-optional &&     npm run pack' returned a non-zero code: 1

Expected behavior

Should build successfully

Edition and Platform

  • Edition: Personal Server
  • Version: commit dbae80b (HEAD, tag: v0.12.0, origin/release-0.12)
  • Browser and OS: N/A

Additional context

Should be irrelevant, but had patch applied

diff --git a/Makefile b/Makefile
index 0db63694..07aa41b5 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ server-mac: ## Build server for Mac.
 server-linux: ## Build server for Linux.
        mkdir -p bin/linux
        $(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=linux")
-       cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/focalboard-server ./main
+       cd server; env GOOS=linux GOARCH=arm64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/focalboard-server ./main
 
 server-win: ## Build server for Windows.
        $(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=win")
@YC YC added Bug Something isn't working Triage labels Jan 13, 2022
@YC YC changed the title Bug: Docker build failure on arm64 Bug: Docker build failure on arm64, v0.12.0 Jan 13, 2022
@YC
Copy link
Contributor Author

YC commented Jan 13, 2022

Mentioned in #1700

@chenilim
Copy link
Member

ARM64 is not part of our official build. Can someone help debug?

@YC
Copy link
Contributor Author

YC commented Jan 28, 2022

Adding the flag from imagemin/optipng-bin#118 (comment) to npm install in Dockerfile seems to be a temporary fix

@Genei180
Copy link
Contributor

For the Case, Anyone Wonders how exactly the Flag should be Added to the Dockerfile:
Instead of:
RUN npm install --no-optional && \ npm run pack

It should look like this:
RUN CPPFLAGS="-DPNG_ARM_NEON_OPT=0" npm install --no-optional && \ npm run pack

I might Deploy it as Temporary Fix in: #1700

Thanks, @YC, for Figuring it out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Help Wanted Extra attention is needed Up for grabs Looking for a contributor to fix it
Projects
None yet
Development

No branches or pull requests

3 participants