docker-library / ghost

Docker Official Image packaging for Ghost
https://hub.docker.com/_/ghost
MIT License
745 stars 314 forks source link

Alpine images failing to build for arm32vN and arm64v8 #400

Closed tianon closed 6 months ago

tianon commented 11 months ago

Here's a snippet of the relevant log:

gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.19.0 | linux | arm
gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/var/lib/ghost/versions/5.75.2/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/var/lib/ghost/versions/5.75.2/node_modules/re2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/var/lib/ghost/versions/5.75.2/node_modules/re2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/node/.cache/node-gyp/18.19.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/node/.cache/node-gyp/18.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/var/lib/ghost/versions/5.75.2/node_modules/re2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/node/.cache/node-gyp/18.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/lib/ghost/versions/5.75.2/node_modules/re2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/var/lib/ghost/versions/5.75.2/node_modules/re2/build'
  CXX(target) Release/obj.target/re2/lib/addon.o
  CXX(target) Release/obj.target/re2/lib/new.o
  CXX(target) Release/obj.target/re2/lib/exec.o
  CXX(target) Release/obj.target/re2/lib/test.o
  CXX(target) Release/obj.target/re2/lib/match.o
  CXX(target) Release/obj.target/re2/lib/replace.o
  CXX(target) Release/obj.target/re2/lib/search.o
  CXX(target) Release/obj.target/re2/lib/split.o
  CXX(target) Release/obj.target/re2/lib/to_string.o
  CXX(target) Release/obj.target/re2/lib/accessors.o
  CXX(target) Release/obj.target/re2/lib/util.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/bitmap256.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/bitstate.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/compile.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/dfa.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/filtered_re2.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/mimics_pcre.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/nfa.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/onepass.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/parse.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/perl_groups.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/prefilter.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/prefilter_tree.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/prog.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/re2.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/regexp.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/set.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/simplify.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/tostring.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/unicode_casefold.o
  CXX(target) Release/obj.target/re2/vendor/re2/re2/unicode_groups.o
  CXX(target) Release/obj.target/re2/vendor/re2/util/pcre.o
  CXX(target) Release/obj.target/re2/vendor/re2/util/rune.o
  CXX(target) Release/obj.target/re2/vendor/re2/util/strutil.o
  CXX(target) Release/obj.target/re2/vendor/abseil-cpp/absl/base/internal/cycleclock.o
  CXX(target) Release/obj.target/re2/vendor/abseil-cpp/absl/base/internal/low_level_alloc.o
In file included from ../vendor/abseil-cpp/absl/base/internal/low_level_alloc.cc:26:
../vendor/abseil-cpp/absl/base/internal/direct_mmap.h:75:25: error: 'off64_t' has not been declared
   75 |                         off64_t offset) noexcept {
      |                         ^~~~~~~
make: *** [re2.target.mk:230: Release/obj.target/re2/vendor/abseil-cpp/absl/base/internal/low_level_alloc.o] Error 1
make: Leaving directory '/var/lib/ghost/versions/5.75.2/node_modules/re2/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/var/lib/ghost/versions/5.75.2/node_modules/re2/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
gyp ERR! System Linux 5.10.0-21-cloud-arm64
gyp ERR! command "/usr/local/bin/node" "/var/lib/ghost/versions/5.75.2/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /var/lib/ghost/versions/5.75.2/node_modules/re2
gyp ERR! node -v v18.19.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
tianon commented 11 months ago

Oh strange, fails on arm64v8 too in the same way :thinking:

LaurentGoderre commented 11 months ago

Minimally reproducible with:

docker run --rm -it node:18-alpine sh
apk add --no-cache --virtual .gyp python3 make g++ > /dev/null
npm install -g re2 > /dev/null
pm ERR! make: Leaving directory '/usr/local/lib/node_modules/re2/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.19.0 | linux | arm64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.19.0/node-v18.19.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.19.0/node-v18.19.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.19.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.19.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/re2/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/re2/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/re2/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/18.19.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.19.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/re2/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.19.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/re2',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../vendor/abseil-cpp/absl/base/internal/low_level_alloc.cc:26:
npm ERR! ../vendor/abseil-cpp/absl/base/internal/direct_mmap.h:36:10: fatal error: linux/unistd.h: No such file or directory
npm ERR!    36 | #include <linux/unistd.h>
npm ERR!       |          ^~~~~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [re2.target.mk:235: Release/obj.target/re2/vendor/abseil-cpp/absl/base/internal/low_level_alloc.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/re2/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 6.4.16-linuxkit
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/re2/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/re2
npm ERR! gyp ERR! node -v v18.19.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok 
npm ERR! node:internal/process/promises:288
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR! 
npm ERR! [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "1".] {
npm ERR!   code: 'ERR_UNHANDLED_REJECTION'
npm ERR! }
LaurentGoderre commented 11 months ago

This fix upstream could help: https://github.com/gperftools/gperftools/issues/693#issuecomment-173898629

LaurentGoderre commented 11 months ago

@tianon I isolated it even further

docker run --rm -it node:18-alpine sh
apk add --no-cache --virtual .gyp git python3 linux-headers make g++ > /dev/null
git clone https://github.com/uhop/node-re2.git && cd node-re2/
git checkout 1.20.3
git submodule init && git submodule update
npm install
yosifkit commented 11 months ago
In file included from ../vendor/abseil-cpp/absl/base/internal/low_level_alloc.cc:26:
../vendor/abseil-cpp/absl/base/internal/direct_mmap.h:75:25: error: 'off64_t' has not been declared
   75 |                         off64_t offset) noexcept {
      |                         ^~~~~~~

I think https://github.com/abseil/abseil-cpp/issues/1473 (https://github.com/abseil/abseil-cpp/commit/4500c2fada4e952037c59bd65e8be1ba0b29f21e) is the fix for this off64_t compilation error and node-re2 has already updated their vendor copy of abseil-cpp (https://github.com/uhop/node-re2/commit/bea0c0041b0c7c9614d3ff4b91bf17f344fefb80) which would mean that it needs to be using 1.20.5+ of node-re2.

LaurentGoderre commented 11 months ago

https://github.com/microlinkhq/metascraper/pull/681

brunoais commented 10 months ago

This was closed as completed: https://github.com/abseil/abseil-cpp/issues/1473 This was merged: https://github.com/microlinkhq/metascraper/pull/681

Please update on what's missing for this issue.

tianon commented 10 months ago

https://github.com/TryGhost/Ghost/pull/19401 :+1:

brunoais commented 10 months ago

Thank you. I'll track that one.

markstos commented 8 months ago

@tianon These failures started just after the update from Alpine 3.17 to 3.19, here: https://github.com/docker-library/ghost/commit/123735dbbb5a717a71ff941d85cc0ee0ca0717f4. Could that update be reverted until Ghost's fix is merged so that the most recent version of Ghost can be available on Alpine again?

LaurentGoderre commented 7 months ago

As per the upstream PR, a fix for this should be release on Friday so hopefully we can have this fixed early next week!

LaurentGoderre commented 6 months ago

Should be fixed in https://github.com/docker-library/official-images/pull/16782

tianon commented 6 months ago

https://oci.dag.dev/?image=oisupport/staging-arm32v6:6039183ab8b1d76ab7d580b06b2bd0d91b3481646648a83dc295c55694cb2701 :metal:

(coming soon to a library/ghost near you)