Menu

ldd says 'not a dynamic executable' — your static binary is fine
📰

ldd says 'not a dynamic executable' — your static binary is fine

DEV Community: docker·Weifeng Liu·1 day ago
#lpRyWuLM
#devtodocker#devto#dev#binary#static
Reading 0:00
15s threshold

Short answer

ldd reads the dynamic section of an ELF file. A statically linked binary has none,

so ldd reports not a dynamic executable and exits 1. The binary is not broken.

It simply does not need a loader at runtime.

This is the most common false alarm in Linux binary troubleshooting: people read it as

"the executable is invalid" and start looking for a missing library that does not exist.

Confirm it in three commands

Take any static binary — a Go or Rust build, or busybox from a static image — and run:

$ ldd ./hello-static not a dynamic executable $ echo $? 1

Enter fullscreen mode

Exit fullscreen mode

$ file ./hello-static ./hello-static: ELF 64-bit LSB executable, x86-64, version 1 ( SYSV ) , statically linked, Go BuildID = rLXBd7VvG-TozsbigJ3a/..., stripped

Enter fullscreen mode

Exit fullscreen mode

$ readelf -d ./hello-static There is no dynamic section in this file.

Enter fullscreen mode

Exit fullscreen mode

file says statically linked and readelf -d says no dynamic section .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.