Skip to content

SCL Environment for the translation of P4 related projects

License

Notifications You must be signed in to change notification settings

benycze/centos-p4-scl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SCL P4 Repository with the SCL environment

The repository containes files required for building and translation of projects related to P4 language.

Currently, the environment allows to build and use:

How to build packages

This SCL environment is prepared for the Centos 7, Centos Stream 8 and Centos Stream 9 Releases

Currently available spec files:

  • centos7/p4scl.spec - SPEC file with libs to build mentioned projects.
  • centos7/p4scl-tool.spec - SPEC file with tools (p4c, behavioral model). It requies packages RPM packages builded from the p4scl.spec file. The environment contains everything from p4scl.spec packages.
  • centos-stream8/p4scl.spec - SPEC file with libs to build mentioned projects.
  • centos-stream8/p4scl-tool.spec - SPEC file with tools (p4c, behavioral model). It requies packages RPM packages builded from the p4scl.spec file. The environment contains everything from p4scl.spec packages.
  • centos-stream9/p4scl.spec - SPEC file with libs to build mentioned projects.
  • centos-stream9/p4scl-tool.spec - SPEC file with tools (p4c, behavioral model). It requies packages RPM packages builded from the p4scl.spec file. The environment contains everything from p4scl.spec packages.

Centos Stream 9

Install plugins and enable CRB repo:

dnf install -y dnf-plugins-core
dnf config-manager --set-enabled crb

Install following packages which are required for the build:

dnf install autoconf automake binutils bison flex gcc gcc-c++ gdb glibc-devel libtool make pkgconf pkgconf-m4 pkgconf-pkg-config redhat-rpm-config rpm-build rpm-sign strace asciidoc byacc diffstat git intltool jna ltrace patchutils perl-Fedora-VSP perl-generators pesign source-highlight systemtap valgrind valgrind-devel cmake expect rpmdevtools rpmlint scl-utils scl-utils-build wget binutils cmake python3-pip openssl-devel boost-devel boost-static libffi-devel boost-devel python3-devel libpcap-devel gc-devel python3-wheel python3-cffi

The P4 Environment package can be builded like following:

rpmbuild -bb p4scl.spec --define 'scl p4lang-p4'

Install generated RPMS (find the rpmbuild folder):

dnf localinstall ~/rpmbuild/RPMS/*/*.rpm

After the instalation you can run the environment:

scl enable p4lang-p4 bash

Very similarly can be build the package with tools. You can also run the compile-and-install.sh script which removes all p4lang packages in the system. The script builds RPM packages and install everything from scratch. You can also inspect that file to see how you can build all RPM packages.

Centos Stream 8

Install the EPEL and dnf plugins:

dnf install epel-release dnf-plugins-core

We also need to enable the PowerTools repository (to get some libs):

dnf config-manager --set-enabled powertools

Install following packages which are required for the build:

dnf install autoconf automake binutils bison flex gcc gcc-c++ gdb glibc-devel libtool make pkgconf pkgconf-m4 pkgconf-pkg-config redhat-rpm-config rpm-build rpm-sign strace asciidoc byacc ctags diffstat git intltool jna ltrace patchutils perl-Fedora-VSP perl-generators pesign source-highlight systemtap valgrind valgrind-devel cmake expect rpmdevtools rpmlint scl-utils scl-utils-build wget binutils cmake python3-pip python3-pip openssl-devel boost169-devel boost169-static libffi-devel boost-devel python3-devel python36-devel libpcap-devel gc-devel ccache python3-cffi python3-wheel

The P4 Environment package can be builded like following:

rpmbuild -bb p4scl.spec --define 'scl p4lang-p4'

Install generated RPMS (find the rpmbuild folder):

dnf localinstall ~/rpmbuild/RPMS/*/*.rpm

After the installation you can run the environment:

scl enable p4lang-p4 bash

Very similarly can be build the package with tools. You can also run the compile-and-install.sh script which removes all p4lang packages in the system. The script builds RPM packages and install everything from scratch. You can also inspect that file to see how you can build all RPM packages.

Centos 7

In Centos 7, these packages are available in centos-release-scl-rh or centos-release-scl. So, you need to additionally install these packages:

yum install centos-release-scl-rh epel-release

Install following packages which are required for the build:

yum install scl-utils scl-utils-build rpm-build devtoolset-9 wget binutils cmake3 git autoconf automake libtool python-pip libatomic_ops-devel bison flex openssl-devel boost169-devel boost-devel-static python2-devel python3-devel python2-pip python3-pip python-cffi python36-cffi

The P4 Environment package can be builded like following:

rpmbuild -bb p4scl.spec --define 'scl p4lang-p4'

Install generated RPMS (find the rpmbuild folder):

yum localinstall ~/rpmbuild/RPMS/*/*.rpm

After the installation you can run the environment:

``bash scl enable p4lang-p4 bash


#### P4C Patch

The Centos 7 build is using the devtoolset-10 for compilation of all tools and libraries. The P4C project needs to be patched (so far) because it overloads some libstdc++ functions to achieve nicer error prints.
The not patched version leads to a situation that compilation fails during the linking. The patch itself comments out all multiple defined functions in `lib/backtrack.cpp` file. However, the community is already solving this and
I am hoping that this hack will be removed in near future.

## Sources

SCL build documentation: https://www.softwarecollections.org/en/docs/guide/

## Authors:

* Pavel Benáček

Contributions from other authors are welcomed!!

P.S. Sorry if something is not perfect but I am using the [Debian](https://www.debian.org) and this is one of my first attempt for RPMs :-). If you want to improve something, feel free to send me a merge request ;-).

About

SCL Environment for the translation of P4 related projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages