Gateway on an arm64 VM

I successfully built and run the Gateway on a x86-64 laptop on both Linux VM and Linux host.
Now I am trying to perform the same steps described on the Gateway’s README.md in a Virtual Machine running Ubuntu 22.04 aarch64 that, in turns, runs on my Macbook Air M2 having UTM as hypervisor.

The dependencies for Ubuntu are installed, and I installed node 10.23.0. But here, differently from what happens on the x86-64 laptop, when I try to install the dependencies inside the gateway folder through npm ci I obtain several errors.

Here the output:

ubuntu@ubuntu:~/gateway$ npm ci
npm WARN prepare removing existing node_modules/ before installation

> sqlite3@5.1.1 install /home/ubuntu/gateway/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/home/ubuntu/gateway/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm64/node_sqlite3.node" is installed via remote

> segfault-handler@1.3.0 install /home/ubuntu/gateway/node_modules/segfault-handler
> node-gyp rebuild

make: Entering directory '/home/ubuntu/gateway/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
In file included from ../../nan/nan.h:60,
                 from ../src/segfault-handler.cpp:2:
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/node.h:573:7: warning: cast between incompatible function types from \u2018void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)\u2019 {aka \u2018void (*)(v8::Local<v8::Object>)\u2019} to \u2018node::addon_register_func\u2019 {aka \u2018void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)\u2019} [-Wcast-function-type]
  573 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/node.h:607:3: note: in expansion of macro \u2018NODE_MODULE_X\u2019
  607 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/segfault-handler.cpp:346:3: note: in expansion of macro \u2018NODE_MODULE\u2019
  346 |   NODE_MODULE(segfault_handler, init)
      |   ^~~~~~~~~~~
In file included from /home/ubuntu/.cache/node-gyp/10.23.0/include/node/node.h:63,
                 from ../../nan/nan.h:60,
                 from ../src/segfault-handler.cpp:2:
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/v8.h: In instantiation of \u2018void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]\u2019:
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/node_object_wrap.h:84:25:   required from here
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/v8.h:9502:16: warning: cast between incompatible function types from \u2018v8::WeakCallbackInfo<node::ObjectWrap>::Callback\u2019 {aka \u2018void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)\u2019} to \u2018Callback\u2019 {aka \u2018void (*)(const v8::WeakCallbackInfo<void>&)\u2019} [-Wcast-function-type]
 9502 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/v8.h: In instantiation of \u2018void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]\u2019:
../../nan/nan_object_wrap.h:64:57:   required from here
/home/ubuntu/.cache/node-gyp/10.23.0/include/node/v8.h:9502:16: warning: cast between incompatible function types from \u2018v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback\u2019 {aka \u2018void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)\u2019} to \u2018Callback\u2019 {aka \u2018void (*)(const v8::WeakCallbackInfo<void>&)\u2019} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/segfault-handler.node
  COPY Release/segfault-handler.node
make: Leaving directory '/home/ubuntu/gateway/node_modules/segfault-handler/build'

> optipng-bin@7.0.1 postinstall /home/ubuntu/gateway/node_modules/optipng-bin
> node lib/install.js

Command failed: /home/ubuntu/gateway/node_modules/optipng-bin/vendor/optipng --version
/home/ubuntu/gateway/node_modules/optipng-bin/vendor/optipng: 1: @@8\ufffd@@@@@@@\ufffd@@@@\ufffd\ufffd\ufffd\ufffd: not found
/home/ubuntu/gateway/node_modules/optipng-bin/vendor/optipng: 2: d: not found
/home/ubuntu/gateway/node_modules/optipng-bin/vendor/optipng: 1: ELF: not found
/home/ubuntu/gateway/node_modules/optipng-bin/vendor/optipng: 1: Syntax error: ";" unexpected


optipng pre-build test failed
compiling from source
Error: Command failed: /bin/sh -c make install
pngrtran.c:99:1: warning: \u2018png_rtran_ok\u2019 defined but not used [-Wunused-function]
   99 | png_rtran_ok(png_structrp png_ptr, int need_IHDR)
      | ^~~~~~~~~~~~
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
pngxmem.c: In function \u2018pngx_malloc_rows_extended\u2019:
pngxmem.c:38:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]
   38 |        (pngx_alloc_size_t)height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
      |                                  ^
ar: `u' modifier ignored since `D' is the default (see `U')
/usr/bin/ld: ../libpng/libpng.a(pngrutil.o): in function `png_read_filter_row':
pngrutil.c:(.text+0x22f0): undefined reference to `png_init_filter_functions_neon'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:100: optipng] Error 1
make: *** [Makefile:14: install] Error 2

cd src/optipng && \
make install && \
cd ../..
make[1]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/optipng'
cd ../libpng && \
make -f Makefile PNGLIBCONF_H_PREBUILT=pnglibconf.h.optipng && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/libpng'
cp pnglibconf.h.optipng pnglibconf.h
gcc -c -I../zlib  -O2 -Wall -Wextra -o png.o png.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngerror.o pngerror.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngget.o pngget.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngmem.o pngmem.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngpread.o pngpread.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngread.o pngread.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrio.o pngrio.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrtran.o pngrtran.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrutil.o pngrutil.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngset.o pngset.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtrans.o pngtrans.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwio.o pngwio.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwrite.o pngwrite.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwtran.o pngwtran.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwutil.o pngwutil.c
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
ranlib libpng.a
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtest.o pngtest.c
gcc  -L../zlib -o pngtest pngtest.o libpng.a -lz -lm
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/libpng'
cd ../opngreduc && \
make -f Makefile libopngreduc.a && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/opngreduc'
gcc -c  -O2 -Wall -Wextra  -I../libpng -o opngreduc.o opngreduc.c
ar cru libopngreduc.a opngreduc.o
ranlib libopngreduc.a
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/opngreduc'
cd ../gifread && \
make -f Makefile libgifread.a && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/gifread'
gcc -c  -O2 -Wall -Wextra -o gifread.o gifread.c
ar cru libgifread.a gifread.o
ranlib libgifread.a
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/gifread'
cd ../pnmio && \
make -f Makefile libpnmio.a && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/pnmio'
gcc -c  -O2 -Wall -Wextra -o pnmin.o pnmin.c
gcc -c  -O2 -Wall -Wextra -o pnmout.o pnmout.c
gcc -c  -O2 -Wall -Wextra -o pnmutil.o pnmutil.c
ar cru libpnmio.a pnmin.o pnmout.o pnmutil.o
ranlib libpnmio.a
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/pnmio'
cd ../minitiff && \
make -f Makefile libminitiff.a && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/minitiff'
gcc -c  -O2 -Wall -Wextra -o tiffread.o tiffread.c
gcc -c  -O2 -Wall -Wextra -o tiffutil.o tiffutil.c
ar cru libminitiff.a tiffread.o tiffutil.o 
ranlib libminitiff.a
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/minitiff'
cd ../pngxtern && \
make -f Makefile libpngxtern.a && \
cd ../optipng
make[2]: Entering directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/pngxtern'
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxread.o pngxread.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrbmp.o pngxrbmp.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrgif.o pngxrgif.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrjpg.o pngxrjpg.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrpnm.o pngxrpnm.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrtif.o pngxrtif.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxio.o pngxio.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxmem.o pngxmem.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxset.o pngxset.c
ar cru libpngxtern.a pngxread.o pngxrbmp.o pngxrgif.o pngxrjpg.o pngxrpnm.o pngxrtif.o pngxio.o pngxmem.o pngxset.o
ranlib libpngxtern.a
make[2]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/pngxtern'
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optipng.o optipng.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optim.o optim.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o bitset.o bitset.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ioutil.o ioutil.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ratio.o ratio.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o wildargs.o wildargs.c
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 
make[1]: Leaving directory '/tmp/b70d7c53-2492-44e7-91e9-4c50bcb98d1d/src/optipng'

    at Promise.all.then.arr (/home/ubuntu/gateway/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! optipng-bin@7.0.1 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the optipng-bin@7.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2022-10-28T09_10_41_609Z-debug.log

Here is the log (170,3 KB)

I also tried on a VM running Fedora 36 and another one running Kali. Every time that I come at that step, the result is the same.
Is there anything am I missing?

I encounter a similar error when trying to build WT on a stock and patched Ubuntu 20.04.

The docker image builds, but I forget what the actual run-time error is when I try to execute it since it’s been a while.

I’ve never successfully built an image on Ubuntu 20.04.1 since I don’t know enough to debug the issue.

Linux elelinux 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[update]

I somehow succeeded in starting the Gateway despite the error messages I reported in the first post.
Basically, from within the gateway folder, what I did was this:

rm -rf node_modules  # generated by the npm ci command
npm install
npm start

That’s it! Now what remains to be examined is whether everything will work…

UPDATE: The build issue I had over the last months was that the previous GIT repository: gateway-docker was deprecated, but the gateway build instructions were not updated to use the correct Dockerfile. The build instructions were recently corrected and I was able to correctly clone, build and run the image.