Artificial truth

The more you see, the less you believe.

[archives] [latest] | [homepage] | [atom/rss/twitter]

Error loading shared library ld-linux-x86-64.so.2: on Alpine Linux
Sat 04 April 2020 — download

Since I've encountered this issue so much, here is how to fix it:

$ ldd /opt/my_binary
    /lib64/ld-linux-x86-64.so.2 (0x7f65ef0f9000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f65ef0f9000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f65ef0f9000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f65eefa4000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f65ef0f9000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f65eef90000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f65ef0f9000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /opt/my_binary)
$ apk add libc6-compat
$ ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
$ ldd /opt/my_binary
    /lib64/ld-linux-x86-64.so.2 (0x7f79d8d75000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f79d8d75000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f79d8d75000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f79d8c20000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f79d8d75000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f79d8c0c000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f79d8d75000)
$