Alpine Linux - Error: Error loading shared library libsasl2.so.2

See original GitHub issue

Environment Information

  • OS: Alpine Linux 3.8
  • Node Version: 10.13.0
  • NPM Version: 6.0.0
  • node-rdkafka version: 2.4.2

Hi, I am having an impossible time trying to get node-rdkafka to run inside an Alpine linux docker image. I am using node:10-alpine as my base and have installed all the desired packages defined: https://github.com/Blizzard/node-rdkafka/blob/master/examples/docker-alpine.md

/usr/src/app/node_modules/bindings/bindings.js:88
throw e
^
Error: Error loading shared library libsasl2.so.2: No such file or directory (needed by /usr/src/app/node_modules/node-rdkafka/build/Release/../deps/librdkafka.so.1)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:717:18)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (/usr/src/app/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/usr/src/app/node_modules/node-rdkafka/librdkafka.js:10:32)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! your-app-name-here@0.1.0 prod:start: `node dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the your-app-name-here@0.1.0 prod:start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-11-15T15_53_45_048Z-debug.log

when I “step into” the docker image and search for find / -name libsasl2* I get the following:

/usr/src/app # find / -name libsasl2*
/usr/lib/pkgconfig/libsasl2.pc
/usr/lib/libsasl2.so.3
/usr/lib/libsasl2.so
/usr/lib/libsasl2.so.3.0.0
/usr/src/app/node_modules/node-rdkafka/deps/librdkafka/packaging/cmake/try_compile/libsasl2_test.c

so libsasl2.so.3 is available but libsasl2.so.2 is nowhere to be found.

If I switch to a node:10.13.0-stretch docker base image and install libsasl2-dev

# find / -name libsasl2.*
/usr/lib/x86_64-linux-gnu/libsasl2.a
/usr/lib/x86_64-linux-gnu/pkgconfig/libsasl2.pc
/usr/lib/x86_64-linux-gnu/libsasl2.so
/usr/lib/x86_64-linux-gnu/libsasl2.so.2
/usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25

So it appears Alpine no longer has the desired version of libsasl2 required for librdkafka ?

does anyone have a work around for this? Is there an older package I can install somehow?

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

2reactions
vdrgcommented, Nov 29, 2018

I used node:10-alpine and it worked. Dockerfile:

FROM node:10-alpine

RUN apk --no-cache add \
      bash \
      g++ \
      ca-certificates \
      lz4-dev \
      musl-dev \
      cyrus-sasl-dev \
      openssl-dev \
      make \
      python

RUN apk add --no-cache --virtual .build-deps gcc zlib-dev libc-dev bsd-compat-headers py-setuptools bash

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies (allow caching)
COPY package.json yarn.lock /usr/src/app/
RUN yarn install --pure-lockfile

COPY . /usr/src/app/

EXPOSE 3000

CMD [ "yarn", "start" ]

Did you add a .dockerignore file to your repo? It may be happening because you are overriding the lib that is built inside the container with your local node_modules 🤔

0reactions
Vidz51commented, Jun 16, 2021

hi @Chebura I resolved it by making sibling. I am using centos8. here is my docker file inputs:

RUN yum -y install epel-release python3-configobj gcc python3-devel
RUN yum -y install openssl-devel
RUN cd /usr/lib64 \
 && ln -s  /usr/lib64/libsasl2.so.3.0.0 libsasl2.so.2
RUN yum install cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl-gssapi cyrus-sasl-devel -y
RUN yum install -y gcc-c++
RUN dnf install -y librdkafka

hope it helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Samba can't find shared library libsasl2.so.2 ...
I found some info in this topic but I still can't figure out how to get so.2: https://bbs.archlinux.org/viewtopic.php?pid=1272906 I did notice ...
Read more >
Unable to load dynamic library 'intl.so'... Error ... - alpine · GitLab
Hi, When using v3.12, I get the error below. It used to work before 3.12 ... Error loading shared library libicuio.so ... Edited...
Read more >
python - How to resolve missing dependencies in Docker Alpine
I found this post very helpful Docker Alpine Linux python (missing) It allowed me to resolve some of the missing dependencies. Appreciate your ......
Read more >
1143874 – Hitting error while loading shared libraries: libsasl2 ...
Bug 1143874 - Hitting error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory.
Read more >
Libsasl2.so.2: no version information available - MongoDB
I am getting an error when running the mongo enterprise shell: ... /opt/mongoent/bin/mongo: /usr/lib/libsasl2.so.2: no version information ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found