Add the following -static -static-libgcc -static-libstdc++
-
Verify there is really no dynamic linkage
ldd executable -
Verify there are no unresolved symbols
nm executable | grep " U "The list should be empty or should contain only some special kernel-space symbols likeU __tls_get_addr -
Run executable
source: https://stackoverflow.com/questions/3283021/compile-a-standalone-static-executable