When building the static version of bash, runtime dependencies on
gettext-runtime and readline should not be present as the binary is
statically linked. This change excludes the PORTS_READLINE and NLS
options in the slave port to avoid unnecessary dependencies.
Details
- Reviewers
- None
- Commits
- R11:f8e5b5e2ce8d: shells/bash-static: Exclude PORTS_READLINE and NLS options with STATIC
Diff Detail
- Repository
- R11 FreeBSD ports repository
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 62708 Build 59592: arc lint + arc unit
Event Timeline
Why can't these archive files be leveraged:
osipovmi@deblndw011x:/usr/local/lib $ ll . | grep -e readline.a -e gettext.*.a -e intl.a -e btextstyle.a -e history.a -rw-r--r-- 1 root wheel 3093882 2025-01-09 17:56 libgettextlib.a -rw-r--r-- 1 root wheel 887444 2025-01-09 17:56 libgettextpo.a -rw-r--r-- 1 root wheel 723450 2025-01-09 17:56 libgettextsrc.a -rw-r--r-- 1 root wheel 73148 2025-01-09 17:53 libhistory.a -rw-r--r-- 1 root wheel 268444 2025-01-09 17:53 libintl.a -rw-r--r-- 1 root wheel 703534 2025-01-09 17:53 libreadline.a -rw-r--r-- 1 root wheel 1497002 2025-01-09 17:53 libtextstyle.a
in contrast to
$ ldd -a /usr/local/bin/bash /usr/local/bin/bash: libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x3d9c55c21000) libhistory.so.8 => /usr/local/lib/libhistory.so.8 (0x3d9c55465000) libncursesw.so.9 => /lib/libncursesw.so.9 (0x3d9c57482000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x3d9c5658b000) libdl.so.1 => /usr/lib/libdl.so.1 (0x3d9c594a1000) libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /usr/local/lib/libreadline.so.8: libncursesw.so.9 => /lib/libncursesw.so.9 (0x3d9c57482000) libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /usr/local/lib/libhistory.so.8: libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /lib/libncursesw.so.9: libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /usr/local/lib/libintl.so.8: libthr.so.3 => /lib/libthr.so.3 (0x3d9c58d4f000) libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /usr/lib/libdl.so.1: libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) /lib/libthr.so.3: libc.so.7 => /lib/libc.so.7 (0x3d9c57bb6000) [preloaded] [vdso] (0x7ffffffff000)
?
Just tried in poudriere, previously all dynamically linked, now statically:
root@134-release-amd64-default-head-common:/usr/ports/shells/bash # ls -l /usr/local/bin/bash -rwxr-xr-x 1 root wheel 2434520 Mar 1 21:27 /usr/local/bin/bash
What am I missing?
static port:
cd /usr/ports/shells/bash-static make rmconfig pkg delete -y bash-static || pkg delete -y bash BATCH=yes make install clean ldd `which bash` ldd: /usr/local/bin/bash: not a dynamic ELF executable
dynamic port:
cd /usr/ports/shells/bash
make rmconfig
pkg delete -y bash-static || pkg delete -y bash
BATCH=yes make install clean
ldd `which bash`
/usr/local/bin/bash:
libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x358f2f726000)
libhistory.so.8 => /usr/local/lib/libhistory.so.8 (0x358f30541000)
libtinfow.so.9 => /lib/libtinfow.so.9 (0x358f31405000)
libintl.so.8 => /usr/local/lib/libintl.so.8 (0x358f325a7000)
libdl.so.1 => /usr/lib/libdl.so.1 (0x358f316e1000)
libc.so.7 => /lib/libc.so.7 (0x358f33544000)
libthr.so.3 => /lib/libthr.so.3 (0x358f34ef2000)
[vdso] (0x358f2f53e000)I am not sure exactly what you mean. Could you elaborate a bit more in detail on what you're testing? Could you also please clarify the "leveraging" part?
This looks perfectly fine:
root@134-release-amd64-default-head-common:/usr/ports/shells/bash # pkg info bash
bash-5.2.37
Name : bash
Version : 5.2.37
Installed on : Sun Mar 2 18:59:55 2025 UTC
Origin : shells/bash
Architecture : FreeBSD:13:amd64
Prefix : /usr/local
Categories : shells
Licenses : GPLv3+
Maintainer : ehaupt@FreeBSD.org
WWW : https://www.gnu.org/software/bash/
Comment : GNU Project's Bourne Again SHell
Options :
DOCS : on
FDESCFS : on
HELP : on
NLS : on
PORTS_READLINE : on
STATIC : on
SYSBASHRC : on
SYSLOG : off
Annotations :
FreeBSD_version: 1304000
build_timestamp: 2025-03-02T18:58:50+00:00
built_by : poudriere-git-3.4.99.20250209
cpe : cpe:2.3:a:gnu:bash:5.2.37:::::freebsd13:x64
port_checkout_unclean: no
port_git_hash : ddd71f4562b6
ports_top_checkout_unclean: no
ports_top_git_hash: be43a1389fac
Flat size : 10.1MiB
Description :
This is GNU Bash. Bash is the GNU Project's Bourne Again SHell,
a complete implementation of the POSIX.2 shell spec, but also
with interactive command line editing, job control on architectures
that support it, csh-like features such as history substitution and
brace expansion, and a slew of other features.
root@134-release-amd64-default-head-common:/usr/ports/shells/bash # bash
[root@134-release-amd64-default-head-common /usr/ports/shells/bash]# echo $BASH
$BASH $BASHPID $BASH_ARGC $BASH_ARGV0 $BASH_COMMAND $BASH_LOADABLES_PATH $BASH_SUBSHELL $BASH_VERSION
$BASHOPTS $BASH_ALIASES $BASH_ARGV $BASH_CMDS $BASH_LINENO $BASH_SOURCE $BASH_VERSINFO
[root@134-release-amd64-default-head-common /usr/ports/shells/bash]# echo $BASH
/usr/local/bin/bash
[root@134-release-amd64-default-head-common /usr/ports/shells/bash]# ldd /usr/local/bin/bash
ldd: /usr/local/bin/bash: not a dynamic ELF executable
[root@134-release-amd64-default-head-common /usr/ports/shells/bash]# file /usr/local/bin/bash
/usr/local/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, for FreeBSD 13.4, FreeBSD-style, strippedThe message from ldd is expected because the executable isn't dynamic. Does this make sense for you?
The message from ldd is expected because the executable isn't dynamic. Does this make sense for you?
You chose:
STATIC : on
LDD reports:
[root@134-release-amd64-default-head-common /usr/ports/shells/bash]# ldd /usr/local/bin/bash ldd: /usr/local/bin/bash: not a dynamic ELF executable
- Makes sense
file reports:
/usr/local/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, for FreeBSD 13.4, FreeBSD-style, stripped
- Makes sense
Yes. I'd like to do that. If the user wants to have a static version without any port readline or gettext he can simply rebuild shells/bash-static without those options. Sure, no pre-built pkgs but that's just the way it is.