Chapter 2.1: Build and Package
System Requirements:
My Build Machine configurations
Ubuntu 14.04.05 ( Kernel 3.13.0-112-generic)
8GB RAM, 2 Core Processor
Virtual Machine (VM)
Build tools Installation
Install GIT & REPO
cd
sudo apt-get update
sudo apt-get install git
mkdir bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
sudo cp ~/bin/repo /usr/local/bin/repo
Downloading the source code (Make sure you have added your ssh key in github)
Note : I use R3.2 Version for this exercise
mkdir build
cd build
repo init -u [email protected]:Juniper/contrail-vnc -b R3.2
repo sync
If you want to use Contrail 5.0 version,
repo init -u [email protected]:Juniper/contrail-vnc -b R5.0
Contrail maintains the dependent library packages in its PPA repository
sudo add-apt-repository ppa:opencontrail/ppa
sudo apt-get update
Install the build tools
sudo apt-get install -y autoconf automake bison debhelper flex libcurl4-openssl-dev libexpat-dev libgettextpo0 libprotobuf-dev libtool libxml2-utils make protobuf-compiler python-all python-dev python-lxml python-setuptools python-sphinx ruby-ronn scons unzip vim-common libsnmp-python libipfix-dev librdkafka-dev librdkafka1
sudo apt-get install -y cmake lsb-release python-six libzookeeper-mt-dev libipfix libsasl2-dev
sudo apt-get install -y libboost-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libcurl4-openssl-dev google-mock libgoogle-perftools-dev liblog4cplus-dev libtbb-dev libhttp-parser-dev libxml2-dev libicu-dev
sudo apt-get install -y libboost-thread-dev
Just copy and run without any hesitation, it will run :).
Install the cassandra driver (cassandra library files requires for compilation)
wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.2.0/cassandra-cpp-driver_2.2.0-1_amd64.deb
wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.2.0/cassandra-cpp-driver-dev_2.2.0-1_amd64.deb
wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.7.5/libuv_1.7.5-1_amd64.deb
sudo dpkg -i libuv_1.7.5-1_amd64.deb cassandra-cpp-driver_2.2.0-1_amd64.deb cassandra-cpp-driver-dev_2.2.0-1_amd64.deb
Install contrail thirdparty packages
python third_party/fetch_packages.py
For contrail 5.0 build, i installed some more packages,
sudo apt-get install -y libgrok-dev libgrok1 libtokyocabinet-dev libpcre3-dev liburcu-dev libnuma-dev
Edit the SConstruct file and disabled the openstack/ceilometer_plugin, contrail-f5/SConscript, vcenter-manager/ build lines, as i dont need those.
Start the build
scons -j ${JOBS_COUNT:-$(grep -c processor /proc/cpuinfo || echo 1)} --without-dpdk
We are going to use vrouter as kernel module. vrouter can be used as dpdk mode also. It requires some dpdk dependency library., hence i am not building that.
It may take 60mins+ to build all. You see something like this on success case .
copying extra files... done
dumping search index... done
dumping object inventory... done
build succeeded, 1526 warnings.
You may see some doc error, that can be ignored.
But If you get any other build error, check contrail build issues in github.
Packaging(Debian):
Install the required Tools
sudo apt-get install ant default-jdk javahelper libcommons-codec-java libhttpcore-java liblog4j1.2-java
sudo apt-get install nodejs
sudo apt-get install module-assistant
Exclude the ceilometer,heat plugin from the build. Note: I could not succeed build with this plugin. Looks like some more packages to be downloaded etc. so i just skipped, as i dont need of contrail ceilometer and heat plugin.
Edit the packages.make, and comment ceilometer plugin and heat in "all" section, as below.
all: package-ifmap-server \
package-contrail-web-core \
package-contrail-web-controller \
package-contrail \
package-neutron-plugin-contrail \
#package-ceilometer-plugin-contrail \
#package-contrail-heat \
$(CONTRAIL_VROUTER_DPDK)
http://lists.opencontrail.org/pipermail/dev_lists.opencontrail.org/2016-July/002871.html
Start the Packaging
make -f packages.make all
The packages will be present in "build/packages" folder.
cloud@buildvm:~/build/build/packages$ ls
contrail contrail-vrouter-utils_1.1master~96e7f26_amd64.deb
contrail-analytics-dbg_1.1master~96e7f26_amd64.deb contrail-web-controller
contrail-analytics_1.1master~96e7f26_amd64.deb contrail-web-controller_1.1master~96e7f26.orig.tar.gz
contrail-config-openstack_1.1master~96e7f26_amd64.deb contrail-web-controller_1.1master~96e7f26_all.deb
contrail-config-vmware_1.1master~96e7f26_amd64.deb contrail-web-controller_1.1master~96e7f26_amd64.changes
contrail-config_1.1master~96e7f26_amd64.deb contrail-web-core
contrail-control-dbg_1.1master~96e7f26_amd64.deb contrail-web-core_1.1master~96e7f26_amd64.changes
contrail-control_1.1master~96e7f26_amd64.deb contrail-web-core_1.1master~96e7f26_amd64.deb
contrail-dns_1.1master~96e7f26_amd64.deb contrail_1.1master~96e7f26_amd64.changes
contrail-docs_1.1master~96e7f26_amd64.deb ifmap-server
contrail-lib_1.1master~96e7f26_amd64.deb ifmap-server_0.3.2-1contrail3_all.deb
contrail-nodemgr_1.1master~96e7f26_amd64.deb ifmap-server_0.3.2-1contrail3_amd64.changes
contrail-nova-driver_1.1master~96e7f26_amd64.deb ifmap-server_0.3.2.orig.tar.gz
contrail-utils_1.1master~96e7f26_amd64.deb neutron-plugin-contrail
contrail-vrouter-3.13.0-112-generic_1.1master~96e7f26_all.deb neutron-plugin-contrail_1.1master~fa6b3e8_all.deb
contrail-vrouter-agent-dbg_1.1master~96e7f26_amd64.deb neutron-plugin-contrail_1.1master~fa6b3e8_amd64.changes
contrail-vrouter-agent_1.1master~96e7f26_amd64.deb python-contrail-vrouter-api_1.1master~96e7f26_amd64.deb
contrail-vrouter-dbg_1.1master~96e7f26_amd64.deb python-contrail_1.1master~96e7f26_amd64.deb
contrail-vrouter-dkms_1.1master~96e7f26_amd64.deb python-opencontrail-vrouter-netns_1.1master~96e7f26_amd64.deb
contrail-vrouter-source_1.1master~96e7f26_amd64.deb
cloud@buildvm:~/build/build/packages$
Thats all.
Note: you may get some error during the packaging, fix the error and restart the packaging.
Errors:
I faced the below error,
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/librdkafka.a(rdkafka_transport.o): undefined reference to symbol 'SSL_get_verify_result@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
scons: *** [build/production/analytics/vizd] Error 1
scons: building terminated because of errors.
make[2]: *** [override_dh_auto_build] Error 2
The fix is available here,
https://github.com/Juniper/contrail-installer/issues/144#issuecomment-298599827
References :
http://juniper.github.io/contrail-vnc/README.html