scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

ldd error on Alpine 3.10 #99

Closed mcasper closed 5 years ago

mcasper commented 5 years ago

Hey folks,

On at least alpine 3.10, this library outputs an error when trying to detect the libc version:

$ /lib/ld-musl-x86_64.so.1: cannot load --version: No such file or directory

which comes from https://github.com/scoutapp/scout_apm_elixir/blob/b9ce2312cd59e4f3ca8718fdbb6b30d5cb83d784/lib/scout_apm/core.ex#L76

Calling the .so directly yields the expected response:

$ /lib/ld-musl-x86_64.so.1 --version
musl libc (x86_64)
Version 1.1.22
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname [args]
mcasper commented 5 years ago

It looks like this is because the ldd wrapper script in /usr/bin is only sending things on to the args part of the binary:

$ cat $(which ldd)
#!/bin/sh
exec /lib/ld-musl-x86_64.so.1 --list -- "$@"
cschneid commented 5 years ago

Thank you, that's annoying. It's surprisingly difficult to figure out if the underlying platform is musl or glibc in a generic manner.

As a workaround, you should be able to set the platform triple explicitly:

core_agent_triple: "i686-unknown-linux-musl" next to the other Scout configs.

mcasper commented 5 years ago

Nice, thank you for the workaround!