Splunk AppDynamics

Golang SDK - libappdynamics.so: cannot open shared object file

David_Boardman
Explorer

 I've build a simple Golang application and have packaged it inside Docker, building off of the image '

busybox:ubuntu-14.04'

 

When I run the built app I get this error:

 

/usr/local/bin # ./golang-example-app
./golang-example-app: error while loading shared libraries: libappdynamics.so: cannot open shared object file: No such file or directory

 

Trying to fix it, I copied the AppDynamics Golang SDK folder underneath /usr/local/bin:

 

/usr/local/bin # ls -al
total 2432
drwxr-xr-x 4 root root 4096 Nov 22 15:03 .
drwxr-xr-x 6 root root 4096 Nov 22 15:03 ..
drwxr-xr-x 3 root root 4096 Nov 22 15:03 appdynamics
-rwxr-xr-x 1 root root 2473864 Nov 22 05:19 golang-example-app
-rwxr-xr-x 1 root root 238 Nov 21 17:47 run.sh
/usr/local/bin # ls -l appdynamics/
total 544
-rw-r--r-- 1 root root 1917 Nov 22 14:58 README.md
-rw-r--r-- 1 root root 91 Nov 22 14:58 VERSION
-rw-r--r-- 1 root root 22393 Nov 22 14:58 appdynamics.go
-rw-r--r-- 1 root root 279504 Nov 22 14:58 ca-bundle.crt
-rw-r--r-- 1 root root 236061 Nov 22 14:58 ca-bundle.crt.moveaway
drwxr-xr-x 3 root root 4096 Nov 22 14:58 sdk_lib

 

 

I still get this error when running.

 

Do I need to "install" the 'libappdynamics.so' file in a certain location so it can be found by the Golang app?

Labels (1)
0 Karma

Pedro_Oliveira
Engager

If anyone is still having this issue for golang-sdk-x64-linux-4.5.2.0 and couldn't get it working from Sebastian's fix above, that is because you still need to add the appdynamics-golang-sdk library on to the shared library folder within Linux.

In a brief summary, in Linux when an executable is looking for a dynamic library (.so file) the linker tries several directories, including directories on the system search path, which consists of entries in /etc/ld.so.conf plus /lib and /usr/lib. For more information please check this Unix stackexchange reply.

The Dockerfile should look as follows:

FROM ubuntu:18.04
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*

COPY appdynamics/lib /lib

...

...

ENTRYPOINT ["/<yourExecutable>"]

Hope that helps! 🙂

Sebastian_Ma
Engager

If anyone still faces the same issue, for golang-sdk-x64-linux-4.5.2.0.tbz2 which I am using now, I managed to to fix my multi-stage Dockerfile as follows:

# stage 2 - build deployment
# libappdynamics.so required version of glibc shared libraries are not found in alpine,
therefore follow development environment, use ubuntu
FROM ubuntu:18.04

RUN apt-get update \
    && apt-get install -y wget \
    && rm -rf /var/lib/apt/lists/*

RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
    wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/g... && \
    chmod +x /bin/grpc_health_probe

...

...

ENTRYPOINT ["/<yourExecutable>"]

Ray_Waldock
New Member

Hi David,

You don't want to have appdynamics/ directory in /usr/local/bin/.

Try moving your golang-example-app in to the appdynamics/ directory and running it there.

In your specific case:

mv -v /usr/local/bin/golang-example-app /usr/local/bin/appdynamics/;
mv -v /usr/local/bin/appdynamics /;  # keep bin/ tidy.
cd /appdynamics; ./golang-example-app;

For additional information see: https://golang.org/cmd/cgo/

0 Karma
Get Updates on the Splunk Community!

Best Strategies to Optimize Observability Costs

 Join us on Tuesday, May 6, 2025, at 11 AM PDT / 2 PM EDT for an insightful session on optimizing ...

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...