I am not able to create rpm package , getting below error.
/usr/lib/rpm/redhat/brp-ldconfig: line 5: RPM_BUILD_ROOT: unbound variable
My VM OS : Rocky Linux 9.3 (Blue Onyx)
I have tried to execute /usr/lib/rpm/redhat/brp-ldconfig and getting same error
/usr/lib/rpm/redhat/brp-ldconfig
/usr/lib/rpm/redhat/brp-ldconfig: line 5: RPM_BUILD_ROOT: unbound variable
Same issue with /usr/lib/rpm/redhat/brp-mangle-shebangs as well.
/usr/lib/rpm/redhat/brp-mangle-shebangs
/usr/lib/rpm/redhat/brp-mangle-shebangs: line 4: RPM_BUILD_ROOT: unbound variable
cat /usr/lib/rpm/redhat/brp-ldconfig
#!/usr/bin/sh -efu
# Force creating of DSO symlinks.
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
# Create an empty config file for ldconfig to shut up a warning
config=$(mktemp -p "$RPM_BUILD_ROOT")
/sbin/ldconfig -f $(basename "$config") -N -r "$RPM_BUILD_ROOT"
rm -f "$config"
# TODO: warn if it created new symlinks and guide people.
If I remove u from first line of the above file (#!/usr/bin/sh -efu), issue not reproducible.
I am able to create rpm package for RHEL 6/7/8, CentOS 6/7/8, Oracle Linux 6/7/8 , Rocky Linux 8 with same spec file but not with Rocky Linux 9.
There is a difference is in the /usr/lib/rpm/redhat/brp-ldconfig file for rocky linux 9.