Ok, I worked through several compile errors in order to get opensaf-5.21.06 to
build on RHEL 8.
Here's a summary of what I had to do.
The following files were updated:
opensaf.spec.in
* added the following line: %define __python /usr/bin/python3
* Changed BuildRequires: python-devel
To: BuildRequires: platform-python-devel
* Updated the following lines with the __pycache__ directory
%{python_sitelib}/pyosaf/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/immom/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/clm/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/log/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/ntf/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/immoi/__pycache__/*.pyc
* removed the following lines: %define __python /usr/bin/python3
%{python_sitelib}/pyosaf/*.pyo
%{python_sitelib}/pyosaf/utils/*.pyo
%{python_sitelib}/pyosaf/utils/immom/*.pyo
%{python_sitelib}/pyosaf/utils/clm/*.pyo
%{python_sitelib}/pyosaf/utils/log/*.pyo
%{python_sitelib}/pyosaf/utils/ntf/*.pyo
%{python_sitelib}/pyosaf/utils/immoi/*.pyo
configure.ac
* Changed systemdversion =$(pkg-config --modversion systemd)
* To: systemdversion=$(pkg-config --modversion systemd | awk '{print
$1}')
Change the shebang in the following files from #! /usr/bin/python to #!
/usr/bin/python3
* samples/immsv/immom_python/immom.py
* samples/immsv/immom_python/immomexamples.py
* samples/immsv/immom_python/immomtest.py
* src/imm/tools/immxml-merge
* src/imm/tools/immxml-validate
Details:
(1) Unversioned python
mkdir -p `pwd`/rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}
cp ./opensaf.spec `pwd`/rpms/SPECS
cp ./opensaf-5.21.06.tar.gz `pwd`/rpms/SOURCES rpmbuild -bb --clean --rmspec
--rmsource \
--define "_topdir `pwd`/rpms" --define "_tmppath `pwd`/rpms/tmp" \
`pwd`/rpms/SPECS/opensaf.spec
error: attempt to use unversioned python, define %__python to /usr/bin/python2
or /usr/bin/python3 explicitly
error: line 1556: %{python_sitelib}/pyosaf/*.py
make[1]: *** [Makefile:26843: rpm] Error 1
make[1]: Leaving directory '/root/osaf-build/opensaf-5.21.06'
make: *** [makefile:8: all] Error 2
FIX: added the following line to opensaf.spec.in:
%define __python /usr/bin/python3
(2) Dependency on python-devel needs to be changed to platform-python-devel
error: Failed build dependencies:
python-devel is needed by opensaf-5.21.06-1.el8.x86_64
make: *** [Makefile:26843: rpm] Error 1
FIX: changed the following line in opensaf.spec.in:
< BuildRequires: python-devel
---
> BuildRequires: platform-python-devel
(3) The value of systemdmodversion was "239 (239-41.el8_3.1)"
As a result, the following if statement within the Makefile failed:
if [ 239 (239-41.el8_3.1) -gt 204 ]; then
with the following compile error:
*** Setting default controller node configuration ***
...
hostname -s >
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/etc/opensaf/node_name
sed -i '/plmd/d'
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/etc/opensaf/nodeinit.conf.controller
if [ 239 (239-41.el8_3.1) -gt 204 ]; then \
sed -i '/ControlGroup/d'
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/systemd/system/opensafd.service;
\
fi
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `if [ 239 (239-41.el8_3.1) -gt 204 ]; then \'
make[5]: *** [Makefile:26880: install-data-hook] Error 1
make[5]: Leaving directory
'/root/osaf-build/opensaf-5.21.06/rpms/BUILD/opensaf-5.21.06'
make[4]: *** [Makefile:25727: install-data-am] Error 2
make[4]: Leaving directory
'/root/osaf-build/opensaf-5.21.06/rpms/BUILD/opensaf-5.21.06'
make[3]: *** [Makefile:24585: install-am] Error 2
make[3]: Leaving directory
'/root/osaf-build/opensaf-5.21.06/rpms/BUILD/opensaf-5.21.06'
make[2]: *** [Makefile:24062: install-recursive] Error 1
make[2]: Leaving directory
'/root/osaf-build/opensaf-5.21.06/rpms/BUILD/opensaf-5.21.06'
make[1]: *** [Makefile:24579: install] Error 2
make[1]: Leaving directory
'/root/osaf-build/opensaf-5.21.06/rpms/BUILD/opensaf-5.21.06'
error: Bad exit status from
/root/osaf-build/opensaf-5.21.06/rpms/tmp/rpm-tmp.81i79V (%install)
RPM build errors:
Bad exit status from
/root/osaf-build/opensaf-5.21.06/rpms/tmp/rpm-tmp.81i79V (%install)
make: *** [Makefile:26843: rpm] Error 1
FIX: The systemdmodversion gets assigned the value of systemdversion and that
in turn is set within the configure.ac file as follows:
systemdversion =$(pkg-config --modversion systemd)
Now in RHEL8, yum shows the package version as follows:
# yum list installed | grep systemd
systemd.x86_64 239-41.el8_3.1 @anaconda
And the pkg-config command returns the following:
# pkg-config --modversion systemd
239 (239-41.el8_3.1)
Whereas, in RHEL 7:
# yum list installed | grep systemd
systemd.x86_64 219-67.el7_7.2 @anaconda/7.6
And pkg-config command returns just the number before the dash:
# pkg-config --modversion systemd
219
So, the configure.ac file was updated as follows:
systemdversion=$(pkg-config --modversion systemd | awk '{print $1}')
(4) Python shebang needs to be explicitly set in several files:
Bytecompiling .py files below
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6
using /usr/libexec/platform-python
+ /usr/lib/rpm/brp-python-hardlink
+ PYTHON3=/usr/libexec/platform-python
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** ERROR: ambiguous python shebang in
/usr/share/opensaf/samples/immsv/immom_python/immom.py: #!/usr/bin/python.
Change it to python3 (or python2) explicitly.
*** ERROR: ambiguous python shebang in
/usr/share/opensaf/samples/immsv/immom_python/immomexamples.py: #!/usr/bin/env
python. Change it to python3 (or python2) explicitly.
*** ERROR: ambiguous python shebang in
/usr/share/opensaf/samples/immsv/immom_python/immomtest.py: #!/usr/bin/env
python. Change it to python3 (or python2) explicitly.
*** WARNING:
./usr/share/opensaf/samples/smfsv/campaigns/campaign_single_node.xml is
executable but has no shebang, removing executable bit
*** WARNING: ./usr/share/opensaf/samples/amf/non_sa_aware/net-snmp-longDN.xml
is executable but has no shebang, removing executable bit
*** WARNING: ./usr/share/opensaf/samples/amf/wrapper/net-snmp-longDN.xml is
executable but has no shebang, removing executable bit
*** WARNING: ./usr/share/opensaf/samples/amf/proxy/proxy-longDN.xml is
executable but has no shebang, removing executable bit
*** WARNING: ./usr/share/opensaf/samples/amf/sa_aware/AppConfig-2N-longDN.xml
is executable but has no shebang, removing executable bit
*** WARNING:
./usr/share/opensaf/samples/amf/sa_aware/AppConfig-nwayactive-longDN.xml is
executable but has no shebang, removing executable bit
*** WARNING: ./usr/share/opensaf/immxml/baseimm.py is executable but has no
shebang, removing executable bit
*** ERROR: ambiguous python shebang in /usr/share/opensaf/immxml/immxml-merge:
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
*** ERROR: ambiguous python shebang in
/usr/share/opensaf/immxml/immxml-validate: #!/usr/bin/env python. Change it to
python3 (or python2) explicitly.
*** WARNING:
./usr/src/debug/opensaf-5.21.06-1.el8.x86_64/src/amf/amfd/config.cc is
executable but has no shebang, removing executable bit
*** WARNING:
./usr/src/debug/opensaf-5.21.06-1.el8.x86_64/src/smf/smfd/SmfAdminState.cc is
executable but has no shebang, removing executable bit
error: Bad exit status from
/root/osaf-build/opensaf-5.21.06/rpms/tmp/rpm-tmp.qoUPiX (%install)
RPM build errors:
Bad exit status from
/root/osaf-build/opensaf-5.21.06/rpms/tmp/rpm-tmp.qoUPiX (%install)
make: *** [Makefile:26843: rpm] Error 1
FIX: update the shebang in the following files to "#!/usr/bin/python3"
* samples/immsv/immom_python/immom.py
* samples/immsv/immom_python/immomexamples.py
* samples/immsv/immom_python/immomtest.py
* src/imm/tools/immxml-merge
* src/imm/tools/immxml-validate
(5) python files not getting copied to appropriate directory
Processing files: opensaf-python-5.21.06-1.el8.x86_64
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/immom/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/immom/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/clm/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/clm/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/log/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/log/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/ntf/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/ntf/*.pyo
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/immoi/*.pyc
error: File not found:
/root/osaf-build/opensaf-5.21.06/rpms/BUILDROOT/opensaf-5.21.06-1.el8.x86_64/usr/lib/python3.6/site-packages/pyosaf/utils/immoi/*.pyo
FIX: With python3, the .pyc files are now saved in the __pycache__ directory.
Also, as of version 3.5, the .pyo files are no longer generated.
Updated the opensaf.spec.in as follows:
Modified the following lines by adding the __pycache__ directory
%{python_sitelib}/pyosaf/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/immom/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/clm/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/log/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/ntf/__pycache__/*.pyc
%{python_sitelib}/pyosaf/utils/immoi/__pycache__/*.pyc
Removed the following lines: %define __python /usr/bin/python3
%{python_sitelib}/pyosaf/*.pyo
%{python_sitelib}/pyosaf/utils/*.pyo
%{python_sitelib}/pyosaf/utils/immom/*.pyo
%{python_sitelib}/pyosaf/utils/clm/*.pyo
%{python_sitelib}/pyosaf/utils/log/*.pyo
%{python_sitelib}/pyosaf/utils/ntf/*.pyo
%{python_sitelib}/pyosaf/utils/immoi/*.pyo
Regards,
David
From: Hoyt, David
Sent: Wednesday, June 23, 2021 5:00 PM
To: [email protected]
Subject: Does opensaf-5.21.06 support python3?
Hi all,
I downloaded the opensaf-5.21.06 source code, placed it on a VM running RHEL8
and found that the 'make rpm' is failing with respect to python.
With RHEL 8, python3 is now the default version and I encountered the following
error:
mkdir -p `pwd`/rpms
mkdir -p `pwd`/rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}
cp ./opensaf.spec `pwd`/rpms/SPECS
cp ./opensaf-5.21.06.tar.gz `pwd`/rpms/SOURCES
rpmbuild -bb --clean --rmspec --rmsource \
--define "_topdir `pwd`/rpms" --define "_tmppath `pwd`/rpms/tmp" \
`pwd`/rpms/SPECS/opensaf.spec
error: attempt to use unversioned python, define %__python to /usr/bin/python2
or /usr/bin/python3 explicitly
error: line 1556: %{python_sitelib}/pyosaf/*.py
make[1]: *** [Makefile:26843: rpm] Error 1
make[1]: Leaving directory '/root/osaf-build/opensaf-5.21.06'
make: *** [makefile:8: all] Error 2
Does this version of OpenSAF not support python3?
Here's some of the output from the ./configure command:
# ./configure --enable-python --with-rpm-release=1
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
...
OpenSAF Build Configuration Summary
=======================================================
Version: 5.21.06
Release: 1
Installation Directories:
prefix: /usr/local
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
datadir: ${datarootdir}
sysconfdir: /etc
docdir: ${datarootdir}/doc/${PACKAGE_TARNAME}
localstatedir: /var
includedir: ${prefix}/include
libdir: ${exec_prefix}/lib
Compiling Options:
C Compiler: gcc
C++ Compiler: g++
CPPFLAGS:
CFLAGS: -g -O2
CXXFLAGS: -g -O2
OSAF_HARDEN_FLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector --param
ssp-buffer-size=4 -fPIE -pie -zrelro -znow
LDFLAGS:
Enable RPATH: yes
Using VPATH: no
Dependencies Options:
XML2_CFLAGS: -I/usr/include/libxml2
XML2_LIBS: -lxml2
OpenSAF Options:
Enable Python AIS Bindings: yes
Enable Java AIS Mapping: no
Enable AM4J: no
Enable PLM support: no
Enable TIPC transport: no
Enable systemd: yes
=======================================================
Here's the full output from the make rpm:
# make rpm
make dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory '/root/osaf-build/opensaf-5.21.06'
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
echo '#define PREFIX "/usr/local"'; \
echo '#define EXEC_PREFIX "/usr/local"'; \
echo '#define BINDIR "/usr/local/bin"'; \
echo '#define SBINDIR "/usr/local/sbin"'; \
echo '#define LIBEXECDIR "/usr/local/libexec"'; \
echo '#define DATAROOTDIR "/usr/local/share"'; \
echo '#define DATADIR "/usr/local/share"'; \
echo '#define SYSCONFDIR "/etc"'; \
echo '#define SHAREDSTATEDIR "/usr/local/com"'; \
echo '#define LOCALSTATEDIR "/var"'; \
echo '#define INCLUDEDIR "/usr/local/include"'; \
echo '#define OLDINCLUDEDIR "/usr/include"'; \
echo '#define DOCDIR "/usr/local/share/doc/opensaf-5.21.06"'; \
echo '#define INFODIR "/usr/local/share/info"'; \
echo '#define HTMLDIR "/usr/local/share/doc/opensaf-5.21.06"'; \
echo '#define DVIDIR "/usr/local/share/doc/opensaf-5.21.06"'; \
echo '#define PDFDIR "/usr/local/share/doc/opensaf-5.21.06"'; \
echo '#define PSDIR "/usr/local/share/doc/opensaf-5.21.06"'; \
echo '#define LIBDIR "/usr/local/lib"'; \
echo '#define LISPDIR ""'; \
echo '#define LOCALEDIR "/usr/local/share/locale"'; \
echo '#define MANDIR "/usr/local/share/man"'; \
echo '#define MANEXT ""'; \
echo '#define PKGDATADIR "/usr/local/share/opensaf"'; \
echo '#define PKGINCLUDEDIR "/usr/local/include/opensaf"'; \
echo '#define PKGLIBDIR "/usr/local/lib/opensaf"'; \
echo '#define PKGLIBEXECDIR "/usr/local/libexec/opensaf"'; \
echo '#define PKGSYSCONFDIR "/etc/opensaf"'; \
echo '#define PKGLOCALSTATEDIR "/var/lib/opensaf"'; \
echo '#define PKGPIDDIR "/var/run/opensaf"'; \
echo '#define PKGLOGDIR "/var/log/opensaf"'; \
echo '#define PKGCONFDIR "/usr/local/lib/pkgconfig"'; \
echo '#define PKGIMMXMLDIR "/usr/local/share/opensaf/immxml"'; \
echo '#define PKGIMMXMLSVCDIR "/usr/local/share/opensaf/immxml/services"'; \
echo '#define PKGCLCCLIDIR "/usr/local/lib/opensaf/clc-cli"'; \
echo '#define PKGCLMSCRIPTDIR "/usr/local/lib/opensaf/clm-scripts"'; \
echo '#define JAVADIR "/usr/local/share/java"'; \
echo '#define JAVADOCDIR "/usr/local/share/javadoc"'; \
echo '#define LSBINITDIR "/etc/init.d"'; \
echo '#define LOCKDIR "/var/lock/subsys"'; \
} | sed '/""/d' > src/osaf/configmake.h-t
mv src/osaf/configmake.h-t src/osaf/configmake.h
sed -e 's/\(.*\)/\L\1/' osafdir.conf-t > osafdir.conf
mv src/osaf/ssl_libs.cc-t src/osaf/ssl_libs.cc
make distdir-am
make[2]: Entering directory '/root/osaf-build/opensaf-5.21.06'
if test -d "opensaf-5.21.06"; then find "opensaf-5.21.06" -type d ! -perm -200
-exec chmod u+w {} ';' && rm -rf "opensaf-5.21.06" || { sleep 5 && rm -rf
"opensaf-5.21.06"; }; else :; fi
test -d "opensaf-5.21.06" || mkdir "opensaf-5.21.06"
test -n "" \
|| find "opensaf-5.21.06" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec /bin/sh
/root/osaf-build/opensaf-5.21.06/install-sh -c -m a+r {} {} \; \
|| chmod -R a+r "opensaf-5.21.06"
make[2]: Leaving directory '/root/osaf-build/opensaf-5.21.06'
tardir=opensaf-5.21.06 && ${TAR-tar} chof - "$tardir" | eval GZIP= gzip --best
-c >opensaf-5.21.06.tar.gz
make[1]: Leaving directory '/root/osaf-build/opensaf-5.21.06'
if test -d "opensaf-5.21.06"; then find "opensaf-5.21.06" -type d ! -perm -200
-exec chmod u+w {} ';' && rm -rf "opensaf-5.21.06" || { sleep 5 && rm -rf
"opensaf-5.21.06"; }; else :; fi
mkdir -p `pwd`/rpms
mkdir -p `pwd`/rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}
cp ./opensaf.spec `pwd`/rpms/SPECS
cp ./opensaf-5.21.06.tar.gz `pwd`/rpms/SOURCES
rpmbuild -bb --clean --rmspec --rmsource \
--define "_topdir `pwd`/rpms" --define "_tmppath `pwd`/rpms/tmp" \
`pwd`/rpms/SPECS/opensaf.spec
/bin/sh: rpmbuild: command not found
make: *** [Makefile:26843: rpm] Error 127
#
Regards,
David
Notice: This e-mail together with any attachments may contain information of
Ribbon Communications Inc. and its Affiliates that is confidential and/or
proprietary for the sole use of the intended recipient. Any review, disclosure,
reliance or distribution by others or forwarding without express permission is
strictly prohibited. If you are not the intended recipient, please notify the
sender immediately and then delete all copies, including any attachments.
_______________________________________________
Opensaf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-users