Pkg: Alpine target binary is missing symbols

Created on 27 Jun 2019  路  4Comments  路  Source: vercel/pkg

馃憢 and thank you so much for this valuable project! We've been using it successfully for the past 2 years, and really appreciate the hard work behind it!

We're facing an issue where building our project for the alpine platform generates a binary file that ~segfaults~ has missing symbols when executed.

~Our workaround is to spin up an alpine container and build our project inside it for the alpine platform. This generates a proper binary.~
This wasn't really the workaround, it's just that node:alpine includes libstdc++, and alpine:latest doesn't.

Our project is https://github.com/snyk/snyk, ~and our workaround is described here - https://github.com/snyk/snyk/pull/608~ and we now simply build against the alpine target.

~1. How can we help troubleshoot and fix this issue?~

  1. If you are facing something similar, please see if our workaround can help you.

Most helpful comment

Adding the following two libs got the binary working for me. I'd love a way to compile them in statically though, any thoughts?

apk add libstdc++
apk add libgcc

All 4 comments

Further investigation reveals that for the alpine target, pkg pulls in a libstdc++ based nodejs build, so alpine users need to run apk add libstdc++ prior to running the binary we've built.

Please comment here if we got something wrong, or if you can confirm this is the expected behaviour.

+1

If users are expected to make environments ready for your produced binaries by installing prerequisites to use the binary ? that is defeating the entire purpose of there being a binary release of the software..

I.e. until the binary release is working standalone as designed, we users cannot use software packaged by this at all in most circumstances a binary release would be required (i.e. environments that are unable to install said prerequisite/s)

I've run into this problem in https://github.com/mapbox/ecs-watchbot/issues/327#issuecomment-569965695.

However, @adrukh's suggested workaround of adding libstdc++ to the containers that run the alpine binary doesn't seem to work for me. Instead, the only functional alpine binaries I've been able to produce I've had to construct on alpine OS.

This came up after switching from a pkg node8-alpine to node10-alpine target. Builds are currently run on Amazon Linux 2 containers.

Adding the following two libs got the binary working for me. I'd love a way to compile them in statically though, any thoughts?

apk add libstdc++
apk add libgcc
Was this page helpful?
0 / 5 - 0 ratings