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

Missing "execinfo.h" on Node Alpine #70

Open
soundstep opened this issue Apr 30, 2020 · 7 comments
Open

Missing "execinfo.h" on Node Alpine #70

soundstep opened this issue Apr 30, 2020 · 7 comments

Comments

@soundstep
Copy link

Hi,

I've got an issue running an NPM install with this module in Docker (node-alpine):

FROM node:12.15.0-alpine

The issue:

> segfault-handler@1.3.0 install /opt/hades/node_modules/segfault-handler
> node-gyp rebuild

make: Entering directory '/opt/hades/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:23:10: fatal error: execinfo.h: No such file or directory
   23 | #include <execinfo.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: Leaving directory '/opt/hades/node_modules/segfault-handler/build'
make: *** [segfault-handler.target.mk:113: Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/hades/node_modules/segfault-handler
gyp ERR! node -v v12.15.0
gyp ERR! node-gyp -v v5.0.5

I tried the fix found there:
nodejs/node-report#86 (comment)

RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update
RUN apk add libexecinfo-dev@edge

I got a lot of red warnings like:
warning: cast between incompatible function types from 'void

But the install go through and the docker image is built successfully.

However it is still not working, it seems it doesn't find the backtrace tool when a SIGSEGV signal happens:

/opt/hades/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: Error relocating /opt/hades/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1021:18)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at bindings (/opt/hades/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/opt/hades/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)

Any clue?

@soundstep
Copy link
Author

@ddopson Busy time? :)
Let me know if you have any direction I could investigate, I don't know much about gcc.

@iosifnicolae2
Copy link

iosifnicolae2 commented Feb 6, 2021

Any update on this issue?

EDIT: I've managed to fix the issue by adding the following content to my Dockerfile:

RUN apk add --no-cache --no-progress --virtual .gyp \
        python \
        make \
        g++ \
        libexecinfo-dev \
        libexecinfo

Now, I'm receiving the following error:

/home/node/app/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: Error relocating /home/node/app/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1142:18)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at bindings (/home/node/app/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/node/app/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32) {
  code: 'ERR_DLOPEN_FAILED'
}

@ddopson
Copy link
Owner

ddopson commented Feb 9, 2021 via email

@LaurentGoderre
Copy link

This fixes it: #76. Could you merge an publish 1.3.1?

@LaurentGoderre
Copy link

Nevermind, the current unrelease fixed is better.

@Venryx
Copy link

Venryx commented Jan 12, 2022

Good news: I looked at the "network" page for this repo, and found this fork: https://github.com/node-3d/segfault-raub

I've tried it, and I think it works fine on Node Alpine. (no errors during installation nor pod startup at least; I have not hit a segfault since installing it though, so cannot yet completely confirm it works)

Unfortunately, the fork developer changed the API to remove some of the customization options, such that the segfaults are always written to the standard-error stream, and written to a local segfault.log file (if it already exists).

It's a bit annoying that you can't add a callback hook to customize the log messages, or change the log filename, but it does get the job done.

@ddopson
Copy link
Owner

ddopson commented Jan 12, 2022 via email

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

No branches or pull requests

5 participants