"rpmbuild -tb" is not enough on CentOS 8.1 to build SLURM 18.x and 19.x rpms.
yum install epel-release
yum --enablerepo=PowerTools install wget rpm-build bzip2-devel openssl-devel zlib-devel gcc readline-devel pam-devel perl-ExtUtils-MakeMaker perl-DBI mysql-devel make munge-devel python3
ln -s /usr/bin/python3 /usr/bin/python
curl -O https://download.schedmd.com/slurm/slurm-18.08.3.tar.bz2
tar xjf slurm-18.08.3.tar.bz2
Edit file slurm-18.08.3/slurm.spec Add this lines at the beginning of the file:
%undefine _hardened_build
%global _hardened_cflags "-Wl,-z,lazy"
%global _hardened_ldflags "-Wl,-z,lazy"
And change python to python3 in the same file:
BuildRequires: python3
Create archive and compile:
rm slurm-18.08.3.tar.bz2
tar cjf slurm-18.08.3.tar.bz2 slurm-18.08.3
rpmbuild -tb slurm-18.08.3.tar.bz2
Result:
# ls -1 /root/rpmbuild/RPMS/x86_64/
slurm-18.08.3-1.el8.x86_64.rpm
slurm-contribs-18.08.3-1.el8.x86_64.rpm
slurm-devel-18.08.3-1.el8.x86_64.rpm
slurm-example-configs-18.08.3-1.el8.x86_64.rpm
slurm-libpmi-18.08.3-1.el8.x86_64.rpm
slurm-openlava-18.08.3-1.el8.x86_64.rpm
slurm-pam_slurm-18.08.3-1.el8.x86_64.rpm
slurm-perlapi-18.08.3-1.el8.x86_64.rpm
slurm-slurmctld-18.08.3-1.el8.x86_64.rpm
slurm-slurmd-18.08.3-1.el8.x86_64.rpm
slurm-slurmdbd-18.08.3-1.el8.x86_64.rpm
slurm-torque-18.08.3-1.el8.x86_64.rpm