Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Can't build Node with debug symbols #80

Closed
kevinburke opened this issue Jan 27, 2017 · 4 comments
Closed

Can't build Node with debug symbols #80

kevinburke opened this issue Jan 27, 2017 · 4 comments

Comments

@kevinburke
Copy link

I'm trying to build the following Dockerfile, using docker 1.13 on a Mac. It's the 6.9.2 build, but I set CONFIG_FLAGS equal to --debug.

# copied from mhart/alpine-node with --debug flag added to configure
FROM alpine:3.4

# ENV VERSION=v0.10.48 CFLAGS="-D__USE_MISC" NPM_VERSION=2
# ENV VERSION=v0.12.17 NPM_VERSION=2
# ENV VERSION=v4.6.2 NPM_VERSION=2
ENV VERSION=v6.9.2 NPM_VERSION=3
# ENV VERSION=v7.2.0 NPM_VERSION=3

# For base builds
# ENV CONFIG_FLAGS="--without-npm" RM_DIRS=/usr/include
# ENV CONFIG_FLAGS="--fully-static --without-npm" DEL_PKGS="libgcc libstdc++" RM_DIRS=/usr/include
ENV CONFIG_FLAGS="--debug"

RUN apk add --no-cache curl make gcc g++ python linux-headers paxctl libgcc libstdc++ gnupg && \
  gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
    9554F04D7259F04124DE6B476D5A82AC7E37093B \
    94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
    0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
    FD3A5288F042B6850C66B31F09FE44734EB7990E \
    71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
    DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
    C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
    B9AE9905FFD7803F25714661B63B535A4C206CA9 && \
  curl -o node-${VERSION}.tar.gz -sSL https://nodejs.org/dist/${VERSION}/node-${VERSION}.tar.gz && \
  curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/${VERSION}/SHASUMS256.txt.asc && \
  gpg --verify SHASUMS256.txt.asc && \
  grep node-${VERSION}.tar.gz SHASUMS256.txt.asc | sha256sum -c - && \
  tar -zxf node-${VERSION}.tar.gz && \
  cd node-${VERSION} && \
  export GYP_DEFINES="linux_use_gold_flags=0" && \
  ./configure --prefix=/usr ${CONFIG_FLAGS} && \
  NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
  make -j${NPROC} -C out mksnapshot BUILDTYPE=Release && \
  paxctl -cm out/Release/mksnapshot && \
  make -j${NPROC} && \
  make install && \
  paxctl -cm /usr/bin/node && \
  cd / && \
  if [ -x /usr/bin/npm ]; then \
    npm install -g npm@${NPM_VERSION} && \
    find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf; \
  fi && \
  apk del curl make gcc g++ python linux-headers paxctl gnupg ${DEL_PKGS} && \
  rm -rf /etc/ssl /node-${VERSION}.tar.gz /SHASUMS256.txt.asc /node-${VERSION} ${RM_DIRS} \
    /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp /root/.gnupg \
    /usr/lib/node_modules/npm/man /usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html

This fails with the following error - I've just pasted the end of the build output.

  LD_LIBRARY_PATH=/node-v6.9.2/out/Debug/lib.host:/node-v6.9.2/out/Debug/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/icu; mkdir -p /node-v6.9.2/out/Debug/obj/gen/icutmp; python icutrim.py -P "/node-v6.9.2/out/Debug" -D ../../deps/icu-small/source/data/in/icudt57l.dat --delete-tmp -T "/node-v6.9.2/out/Debug/obj/gen/icutmp" -F icu_small.json -O icudt57l.dat -v -L en,root
Options: {'verbose': 1, 'filterfile': 'icu_small.json', 'toolpath': '/node-v6.9.2/out/Debug', 'deltmpdir': 1, 'outfile': 'icudt57l.dat', 'datfile': '../../deps/icu-small/source/data/in/icudt57l.dat', 'locales': 'en,root', 'endian': 'little', 'tmpdir': '/node-v6.9.2/out/Debug/obj/gen/icutmp'}
/node-v6.9.2/out/Debug/obj/gen/icutmp/lang/res_index.txt:7: warning: Encountered empty table
en
en
/node-v6.9.2/out/Debug/obj/gen/icutmp/rbnf/res_index.txt:7: warning: Encountered empty table
/node-v6.9.2/out/Debug/obj/gen/icutmp/brkitr/res_index.txt:7: warning: Encountered empty table
en
/node-v6.9.2/out/Debug/obj/gen/icutmp/region/res_index.txt:7: warning: Encountered empty table
en
/node-v6.9.2/out/Debug/obj/gen/icutmp/unit/res_index.txt:7: warning: Encountered empty table
icu_small.json: icutrim.py config: Trim down ICU to just a certain locale set, needed for node.js use.
* converters: 0 items
* stringprep: 0 items
* translit: 0 items
* brkfiles: 0 items
* brkdict: 0 items
* confusables: 0 items
* brkitr: 0 items
* coll: 1 items
* curr: 1 items
* lang: 0 items
* rbnf: 0 items
* region: 0 items
* ROOT: 1 items
* unit: 0 items
* zone: 1 items
  LD_LIBRARY_PATH=/node-v6.9.2/out/Debug/lib.host:/node-v6.9.2/out/Debug/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/icu; mkdir -p /node-v6.9.2/out/Debug/obj/gen/icutmp; cp "/node-v6.9.2/out/Debug/obj/gen/icutmp/icudt57l.dat" "/node-v6.9.2/out/Debug/obj/gen/icutmp/icusmdt57.dat"
  LD_LIBRARY_PATH=/node-v6.9.2/out/Debug/lib.host:/node-v6.9.2/out/Debug/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/icu; mkdir -p /node-v6.9.2/out/Debug/obj/gen; "/node-v6.9.2/out/Debug/genccode" -d "/node-v6.9.2/out/Debug/obj/gen" "/node-v6.9.2/out/Debug/obj/gen/icutmp/icusmdt57.dat"
generating C code for /node-v6.9.2/out/Debug/obj/gen/icutmp/icusmdt57.dat
  cc '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_TRANSLITERATION=1' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=0' '-DUCONFIG_NO_BREAK_ITERATION=0' '-DUCONFIG_NO_LEGACY_CONVERSION=1' '-DDEBUG' '-D_DEBUG' -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -Wno-deprecated-declarations -g -O0  -MMD -MF /node-v6.9.2/out/Debug/.deps//node-v6.9.2/out/Debug/obj.target/icudata/gen/icusmdt57_dat.o.d.raw   -c -o /node-v6.9.2/out/Debug/obj.target/icudata/gen/icusmdt57_dat.o /node-v6.9.2/out/Debug/obj/gen/icusmdt57_dat.c
  rm -f /node-v6.9.2/out/Debug/obj.target/tools/icu/libicudata.a && ar crsT /node-v6.9.2/out/Debug/obj.target/tools/icu/libicudata.a /node-v6.9.2/out/Debug/obj.target/icudata/gen/icusmdt57_dat.o
  touch /node-v6.9.2/out/Debug/obj.target/tools/icu/icuuc.stamp
  g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_I18N_SUPPORT' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' '-DUCONFIG_NO_TRANSLITERATION=1' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=0' '-DUCONFIG_NO_BREAK_ITERATION=0' '-DUCONFIG_NO_LEGACY_CONVERSION=1' '-DUCONFIG_NO_CONVERSION=1' '-DV8_ENABLE_CHECKS' '-DOBJECT_PRINT' '-DVERIFY_HEAP' '-DDEBUG' '-DTRACE_MAPS' '-D_GLIBCXX_DEBUG=1' '-DENABLE_HANDLE_ZAPPING' '-DENABLE_SLOW_DCHECKS' '-D_DEBUG' -I../deps/v8 -I../deps -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fno-strict-aliasing -m64 -Woverloaded-virtual -fdata-sections -ffunction-sections -g -O0 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /node-v6.9.2/out/Debug/.deps//node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/accessors.o.d.raw   -c -o /node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc
  g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_I18N_SUPPORT' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' '-DUCONFIG_NO_TRANSLITERATION=1' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=0' '-DUCONFIG_NO_BREAK_ITERATION=0' '-DUCONFIG_NO_LEGACY_CONVERSION=1' '-DUCONFIG_NO_CONVERSION=1' '-DV8_ENABLE_CHECKS' '-DOBJECT_PRINT' '-DVERIFY_HEAP' '-DDEBUG' '-DTRACE_MAPS' '-D_GLIBCXX_DEBUG=1' '-DENABLE_HANDLE_ZAPPING' '-DENABLE_SLOW_DCHECKS' '-D_DEBUG' -I../deps/v8 -I../deps -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fno-strict-aliasing -m64 -Woverloaded-virtual -fdata-sections -ffunction-sections -g -O0 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /node-v6.9.2/out/Debug/.deps//node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/address-map.o.d.raw   -c -o /node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/address-map.o ../deps/v8/src/address-map.cc
In file included from ../deps/v8/include/v8.h:25:0,
                 from ../deps/v8/src/accessors.h:8,
                 from ../deps/v8/src/accessors.cc:5:
../deps/v8/src/lookup.h: In member function 'v8::internal::Handle<v8::internal::JSObject> v8::internal::LookupIterator::GetStoreTarget() const':
../deps/v8/src/lookup.h:182:12: error: 'receiver' was not declared in this scope
     DCHECK(receiver->IsJSObject());
            ^
../deps/v8/include/v8config.h:361:54: note: in definition of macro 'V8_UNLIKELY'
 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
                                                      ^
../deps/v8/src/base/logging.h:156:32: note: in expansion of macro 'CHECK'
 #define DCHECK(condition)      CHECK(condition)
                                ^
../deps/v8/src/lookup.h:182:5: note: in expansion of macro 'DCHECK'
     DCHECK(receiver->IsJSObject());
     ^
In file included from ../deps/v8/src/base/build_config.h:8:0,
                 from ../deps/v8/src/base/macros.h:13,
                 from ../deps/v8/src/assert-scope.h:9,
                 from ../deps/v8/src/address-map.h:8,
                 from ../deps/v8/src/address-map.cc:5:
../deps/v8/src/lookup.h: In member function 'v8::internal::Handle<v8::internal::JSObject> v8::internal::LookupIterator::GetStoreTarget() const':
../deps/v8/src/lookup.h:182:12: error: 'receiver' was not declared in this scope
     DCHECK(receiver->IsJSObject());
            ^
../deps/v8/include/v8config.h:361:54: note: in definition of macro 'V8_UNLIKELY'
 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
                                                      ^
../deps/v8/src/base/logging.h:156:32: note: in expansion of macro 'CHECK'
 #define DCHECK(condition)      CHECK(condition)
                                ^
../deps/v8/src/lookup.h:182:5: note: in expansion of macro 'DCHECK'
     DCHECK(receiver->IsJSObject());
     ^
deps/v8/tools/gyp/v8_base.target.mk:502: recipe for target '/node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/address-map.o' failed
make[1]: *** [/node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/address-map.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
make: *** [node_g] Error 2
deps/v8/tools/gyp/v8_base.target.mk:502: recipe for target '/node-v6.9.2/out/Debug/obj.target/v8_base/deps/v8/src/accessors.o' failed
make[1]: Leaving directory '/node-v6.9.2/out'
Makefile:72: recipe for target 'node_g' failed
The command '/bin/sh -c apk add --no-cache curl make gcc g++ python linux-headers paxctl libgcc libstdc++ gnupg &&   gpg --keyserver ha.pool.sks-keyservers.net --recv-keys     9554F04D7259F04124DE6B476D5A82AC7E37093B     94AE36675C464D64BAFA68DD7434390BDBE9B9C5     0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93     FD3A5288F042B6850C66B31F09FE44734EB7990E     71DCFD284A79C3B38668286BC97EC7A07EDE3FC1     DD8F2338BAE7501E3DD5AC78C273792F7D83545D     C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8     B9AE9905FFD7803F25714661B63B535A4C206CA9 &&   curl -o node-${VERSION}.tar.gz -sSL https://nodejs.org/dist/${VERSION}/node-${VERSION}.tar.gz &&   curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/${VERSION}/SHASUMS256.txt.asc &&   gpg --verify SHASUMS256.txt.asc &&   grep node-${VERSION}.tar.gz SHASUMS256.txt.asc | sha256sum -c - &&   tar -zxf node-${VERSION}.tar.gz &&   cd node-${VERSION} &&   export GYP_DEFINES="linux_use_gold_flags=0" &&   ./configure --prefix=/usr ${CONFIG_FLAGS} &&   NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) &&   make -j${NPROC} -C out mksnapshot BUILDTYPE=Release &&   paxctl -cm out/Release/mksnapshot &&   make -j${NPROC} &&   make install &&   paxctl -cm /usr/bin/node &&   cd / &&   if [ -x /usr/bin/npm ]; then     npm install -g npm@${NPM_VERSION} &&     find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf;   fi &&   apk del curl make gcc g++ python linux-headers paxctl gnupg ${DEL_PKGS} &&   rm -rf /etc/ssl /node-${VERSION}.tar.gz /SHASUMS256.txt.asc /node-${VERSION} ${RM_DIRS}     /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp /root/.gnupg     /usr/lib/node_modules/npm/man /usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html' returned a non-zero code: 2

Any idea why it is failing or what I can do to make it work?

@mhart
Copy link
Owner

mhart commented Jan 27, 2017

None sorry, maybe it's an Alpine/musl issue? Probably better to ask at the node or v8 repos

@mhart mhart closed this as completed Jan 27, 2017
@kevinburke
Copy link
Author

Okay, I filed nodejs/node#11043.

@mhart
Copy link
Owner

mhart commented Jan 27, 2017

Is it because you're still doing BUILDTYPE=Release?

@mhart
Copy link
Owner

mhart commented Jan 27, 2017

TBH, this Dockerfile accounts for a lot of quirks in older Node.js versions – if you're compiling a more recent version, it might be simpler to go off something like: https://github.com/nodejs/docker-node/blob/ad54b39ef23e0c7e0df3ac4234c3ee77b58c3f5d/6.9/alpine/Dockerfile

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

No branches or pull requests

2 participants