I'm trying to build a dockerfile for installing saprfc on an Alpine linux base image.

The instructions say to create /etc/ld.so.conf.d/nwrfcsdk.conf and to put /usr/local/sap/nwrfcsdk/lib in the nwrfcsdk.conf file. ldconfig should then load the saprfc libraries.

However, I have learned that ldconfig on Alpine does not read from ld.so.conf.d. ldconfig -p is also not a recognized option.

So how do you add a custom library search path on Alpine Linux?

1 Answer 1


This worked for me. My java needed additional library paths for setcap to work:

echo "/lib:/usr/local/lib:/usr/lib:/usr/lib/jvm/default-jvm/jre/lib/amd64:/usr/lib/jvm/default-jvm/jre/lib/amd64/jli:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server" > /etc/ld-musl-x86_64.path

From musl manual:

../etc/ld-musl-$(ARCH).path, taken relative to the location of
the "program interpreter" specified in the program's headers -
 if present, this will be processed as a text file containing 
the shared library search path, with components delimited by 
newlines or colons. If absent, a default path of 
"/lib:/usr/local/lib:/usr/lib" will be used. 
Not used by static-linked programs.

The exact path used by ld might be different for your arch, I found out mine by doing:

# strace java ... 2>&1 | grep ld
open("/etc/ld-musl-x86_64.path", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .