Build MOFED 4.7- on CentOS 8

it seems that the spec file only checking python on rhel8 not centos 8

%global RHEL8 %(if test grep -E '^(ID="rhel"|VERSION="8)' /etc/os-release 2>/dev/null | wc -l -eq 2; then echo -n ‘1’; else echo -n ‘0’; fi)

%if %{RHEL8}

%global mlnx_python_env export MLNX_PYTHON_EXECUTABLE=python3


%global mlnx_python_env :

This would lead to error when build on CentOS 8

20:28:55 + make build_py_scripts

20:28:55 cd ofed_scripts/utils && python build && cd -

20:28:55 DEPRECATION WARNING: python2 invoked with /usr/bin/python.

20:28:55 Use /usr/bin/python3 or /usr/bin/python2

20:29:17 + /usr/lib/rpm/redhat/brp-mangle-shebangs

20:29:18 *** WARNING: ./usr/src/ofa_kernel-4.7/ofed_scripts/compat_gid_gen is executable but has empty or no shebang, removing executable bit

20:29:18 *** ERROR: ambiguous python shebang in /usr/src/ofa_kernel-4.7/ofed_scripts/utils/mlnx_mcg: #!/usr/bin/python. Change it to python3 (or python2) explicitly.

it was built fine on RHEL8

Hi Minh,

Many thanks for your response on the Mellanox Community.

Unfortunately there is a bug in the install script. We will have this fixed as soon as possible.

As relief, you can download the tarball with the modified ‘mlnxofedinstall’ script from the following link →

We had no problems installing this version with the modified script, in our lab on a Minimal CentOS 8.0.1905 installation.

Many thanks,

~Mellanox Technical Support

Hi Martijn,

I don’t think we even use the install script. This error is in the spec file when we run rpmbuild.