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

"undefined symbol: gcry_control" after building in linux/amd64 alpine #1975

Open
nicolaschambrier opened this issue Mar 20, 2023 · 0 comments

Comments

@nicolaschambrier
Copy link

System information

  • node version: 18.15.0
  • npm or yarn version: yarn 1.22.19
  • OS/version/architecture: Linux a2a48d191f5f 5.15.49-linuxkit Comment all code methods #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 GNU/Linux
  • Applicable nodegit version: 0.27.0

The issue

I built with following command:

apt-get install -y libgit2-27 libgit2-dev libkrb5-dev build-essential python2
alias python=python2
yarn --frozen-lockfile

it builds fine, but when I try to run my project, as soon as it requires nodegit:

node: symbol lookup error: /usr/share/apps/node_modules/nodegit/build/Release/nodegit.node: undefined symbol: gcry_control

On my runtime I have following packages installed:

apt-get install -y git libgit2-27 libkrb5-dev libssl1.1 libgcrypt20

When I inspect the built file with ldd node_modules/nodegit/build/Release/nodegit.node it says this:

	libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x0000004001cfc000)
	libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x0000004001d4b000)
	libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x0000004001e2b000)
	libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x0000004001e5f000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000004001e65000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000004001fe9000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x000000400216c000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000004002188000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00000040021a9000)
	libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x0000004002369000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x0000004002378000)
	libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x000000400237d000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x0000004002384000)
	/lib64/ld-linux-x86-64.so.2 (0x0000004000000000)

The workaround

I fixed it by running my process with LD_PRELOAD="/lib/x86_64-linux-gnu/libgcrypt.so.20" node build/server.js

The root-cause and additional questions

  • Shouldn't the lib be included right at build time? It's very bad to discover a crash at runtime and not at build time 😓
  • Is it possible I'll have other similar surprises at runtime, or the fact that it properly imports nodegit is enough to be reassured about this?
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

1 participant