Static build of 5.2 fails to build on FreeBSD 13.1-RELEASE (amd64). The logic in m4/strtoimax.m4 is inverted. The following patch replaces strtoimax() if and only if it is present and functional.
--- patch begins here --- --- m4/strtoimax.m4.orig 2022-04-11 20:31:52 UTC +++ m4/strtoimax.m4 @@ -29,7 +29,7 @@ AC_CACHE_VAL(bash_cv_func_strtoimax, fi ]) AC_MSG_RESULT($bash_cv_func_strtoimax) -if test $bash_cv_func_strtoimax = yes; then +if test $bash_cv_func_strtoimax = no; then AC_LIBOBJ(strtoimax) fi ]) --- patch ends here --- The compiler used: # cc --version FreeBSD clang version 13.0.0 (g...@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303) Target: x86_64-unknown-freebsd13.1 Thread model: posix InstalledDir: /usr/bin --- build failure begins here --- [trimmed] cc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde -L./lib/sh -fstack-protector-strong -fuse-ld=bfd -static -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -static -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lglob -lsh -lreadline -lhistory -ltinfow -ltilde lib/intl/libintl.a -L/usr/local/lib /usr/local/bin/ld.bfd: ./lib/sh/libsh.a(tmpfile.o): in function `sh_mktmpname': tmpfile.c:(.text+0x85): warning: warning: mktemp() possibly used unsafely; consider using mkstemp() /usr/local/bin/ld.bfd: /usr/lib/libc.a(strtoimax.o): in function `strtoimax': /usr/src/lib/libc/stdlib/strtoimax.c:153: multiple definition of `strtoimax'; ./lib/sh/libsh.a(strtoimax.o):strtoimax.c:(.text+0x0): first defined here cc: error: linker command failed with exit code 1 (use -v to see invocation) --- build failure ends here --- Emanuel