FWIW, I'm able to compile bash statically with: dualbus@debian:~/src/gnu/bash$ ./configure --enable-static-link --without-bash-malloc [...] dualbus@debian:~/src/gnu/bash$ make [...] dualbus@debian:~/src/gnu/bash$ file bash bash: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=183cd0733ecc4aae4d60226fd419c616cfcc5f57, not stripped dualbus@debian:~/src/gnu/bash$ ./bash --version GNU bash, version 4.4.12(2)-maint (x86_64-unknown-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. In my system (Debian), libc.a is provided by libc6-dev: dualbus@debian:~/src/gnu/bash$ dpkg -S /usr/lib/x86_64-linux-gnu/libc.a libc6-dev:amd64: /usr/lib/x86_64-linux-gnu/libc.a dualbus@debian:~/src/gnu/bash$ gcc --version gcc (Debian 6.3.0-16) 6.3.0 20170425 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It fails if I try to use clang though: dualbus@debian:~/src/gnu/bash$ CC=clang ./configure --enable-static-link --without-bash-malloc [...] dualbus@debian:~/src/gnu/bash$ make bison -y -d ./parse.y ./parse.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] touch parser-built rm -f mksyntax clang -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"x86_64"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"x86_64-unknown-linux-gnu"' -DCONF_VENDOR='"unknown"' -DLOCALEDIR='"/usr/local/share/locale"' -DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H -DDEBUG -DMALLOC_DEBUG -I. -I. -I./include -I./lib -g -O2 -Wno-parentheses -Wno-format-security -rdynamic -g -O2 -Wno-parentheses -Wno-format-security -static -rdynamic -g -O2 -Wno-parentheses -Wno-format-security -o mksyntax ./mksyntax.c /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie clang: error: linker command failed with exit code 1 (use -v to see invocation) Makefile:702: recipe for target 'mksyntax' failed make: *** [mksyntax] Error 1 dualbus@debian:~/src/gnu/bash$ clang --version clang version 3.8.1-23 (tags/RELEASE_381/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin It seems to be caused by the combination of `-static' and `rdynamic' (from LOCAL_LDFLAGS). This "works" though: dualbus@debian:~/src/gnu/bash$ CC=clang ./configure --enable-static-link --without-bash-malloc [...] dualbus@debian:~/src/gnu/bash$ make LOCAL_LDFLAGS= [...] dualbus@debian:~/src/gnu/bash$ file ./bash ./bash: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=26ee2a8080868b2923e21f3c17c6814ae30905fb, not stripped dualbus@debian:~/src/gnu/bash$ ./bash --version GNU bash, version 4.4.12(1)-maint (x86_64-unknown-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.