Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dockerfile and Travis CI integration for p4c #251

Merged
merged 2 commits into from
Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Travis CI integration for p4c using Docker.

services:
- docker

install:
- docker build -t p4c .

script:
- docker run -w /p4c/build p4c sh -c 'make check VERBOSE=1 -j8'
# We should enable this once 'make cpplint' comes back clean.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpplint should always come back clean.

# - docker run -w /p4c/build p4c sh -c 'make cpplint'
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:14.04
MAINTAINER Seth Fowler <seth.fowler@barefootnetworks.com>

# Install dependencies.
RUN apt-get update && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how Docker works, but where are the other dependences for testing, such as the behavioral simulator? Testing will run without it (there is a check in configure), but will test much less.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll be adding bmv2 as a dependence to run the tests. But we need to checkout the source and build it since we don't have ubuntu packages.

apt-get install -y \
automake \
bison \
build-essential \
flex \
g++ \
git \
libboost-dev \
libgc-dev \
libgmp-dev \
libtool \
python2.7 \
python-ipaddr \
python-scapy \
tcpdump

# Copy entire repository.
COPY . /p4c/
WORKDIR /p4c/

# Build.
RUN ./bootstrap.sh && \
cd build && \
make -j8
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/p4lang/p4c.svg?branch=master)](https://travis-ci.org/p4lang/p4c)

This folder contains the C++ source code for the P4-16 compiler. This
is a reference implementation of a compiler for the 2016 version of
the P4 programming language, also called P4-16. The P4-16 draft spec
Expand Down Expand Up @@ -125,6 +127,21 @@ make check -j4
We recommend using `clang++` with no optimizations for speeding up
compilation and simplifying debugging.

# Docker

A Dockerfile is included. You can generate an image which contains a copy of p4c
in `/p4c/build` by running:

```
docker build -t p4c .
```

On some platforms Docker limits the memory usage of any container, even
containers used during the `docker build` process. On macOS in particular the
default is 2GB, which is not enough to build p4c. Increase the memory limit to
at least 4GB via Docker preferences or you are likely to see "internal compiler
errors" from gcc which are caused by low memory.

## Additional documentation

More documentation is in [docs/README.md](docs/README.md)