build: require gcc >= 5.3 and switch to C++14
Change-Id: Iba0a1fc8e4a0a0d5ec4150d4dca96792a73237e3
Refs: #3076, #4462
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 765338d..c362297 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -9,13 +9,12 @@
if has OSX $NODE_LABELS; then
brew update
brew upgrade
- brew install boost pkg-config cryptopp openssl log4cxx
+ brew install pkg-config boost openssl
brew cleanup
fi
if has Ubuntu $NODE_LABELS; then
sudo apt-get -qq update
sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
- libcrypto++-dev libsqlite3-dev libssl-dev \
- liblog4cxx10-dev
+ libsqlite3-dev libssl-dev
fi
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/10-ndn-cxx.sh
index e5f7585..c9e2a63 100755
--- a/.jenkins.d/10-ndn-cxx.sh
+++ b/.jenkins.d/10-ndn-cxx.sh
@@ -8,13 +8,25 @@
pushd "${CACHE_DIR:-/tmp}" >/dev/null
-INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
+INSTALLED_VERSION=
+if has OSX $NODE_LABELS; then
+ BOOST=$(brew ls --versions boost)
+ OLD_BOOST=$(cat boost.txt || :)
+ if [[ $OLD_BOOST != $BOOST ]]; then
+ echo "$BOOST" > boost.txt
+ INSTALLED_VERSION=NONE
+ fi
+fi
+
+if [[ -z $INSTALLED_VERSION ]]; then
+ INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
+fi
sudo rm -Rf ndn-cxx-latest
git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
-LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
sudo rm -Rf ndn-cxx
@@ -23,21 +35,22 @@
sudo rm -Rf ndn-cxx-latest
fi
-sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/bin/ndnsec*
+sudo rm -fr /usr/local/include/ndn-cxx
sudo rm -f /usr/local/lib/libndn-cxx*
-sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
pushd ndn-cxx >/dev/null
-./waf -j1 --color=yes configure --enable-shared --disable-static --without-osx-keychain
-./waf -j1 --color=yes build
-sudo ./waf -j1 --color=yes install
+./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
+./waf build --color=yes -j${WAF_JOBS:-1}
+sudo env "PATH=$PATH" ./waf install --color=yes
popd >/dev/null
popd >/dev/null
if has Linux $NODE_LABELS; then
sudo ldconfig
-elif has FreeBSD $NODE_LABELS; then
- sudo ldconfig -a
+elif has FreeBSD10 $NODE_LABELS; then
+ sudo ldconfig -m
fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index b1bd93a..39fa40b 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -13,13 +13,13 @@
* `[OS_TYPE]`: `Linux`
* `[DISTRO_TYPE]`: `Ubuntu`
- * `[DISTRO_VERSION]`: `Ubuntu-14.04`, `Ubuntu-16.04`
+ * `[DISTRO_VERSION]`: `Ubuntu-16.04`, `Ubuntu-18.04`
Possible values for OS X / macOS:
* `[OS_TYPE]`: `OSX`
* `[DISTRO_TYPE]`: `OSX` (can be absent)
- * `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.11`, `OSX-10.12`
+ * `[DISTRO_VERSION]`: `OSX-10.11`, `OSX-10.12`, `OSX-10.13`
- `JOB_NAME`: optional variable to define type of the job. Depending on the defined job type,
the build scripts can perform different tasks.
@@ -29,3 +29,8 @@
* empty: default build process
* `code-coverage` (Linux OS is assumed): debug build with tests and code coverage analysis
* `limited-build`: only a single debug build with tests
+
+- `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
+ e.g., a compiled version of ndn-cxx library. If not set, `/tmp` is used.
+
+- `WAF_JOBS`: number of parallel build jobs used by waf, defaults to 1.
diff --git a/.travis.yml b/.travis.yml
index 508b081..984e8ac 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,28 +1,97 @@
+language: cpp
+dist: xenial
sudo: required
-language: generic
env:
global:
- JOB_NAME=limited-build
+ - WAF_JOBS=2
+
matrix:
include:
+ # Linux/gcc
+ # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages
- os: linux
- dist: trusty
- env:
- - CXX=g++
- - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ env: COMPILER=g++-5
- os: linux
- dist: trusty
- env:
- - CXX=clang++
- - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ env: COMPILER=g++-6
+ - os: linux
+ env: COMPILER=g++-7
+ - os: linux
+ env: COMPILER=g++-8
+
+ # Linux/clang
+ # https://apt.llvm.org/
+ - os: linux
+ env: COMPILER=clang++-3.5
+ - os: linux
+ env: COMPILER=clang++-3.6
+ - os: linux
+ env: COMPILER=clang++-3.7 DISABLE_ASAN=yes
+ - os: linux
+ env: COMPILER=clang++-3.8
+ - os: linux
+ env: COMPILER=clang++-3.9
+ - os: linux
+ env: COMPILER=clang++-4.0
+ - os: linux
+ env: COMPILER=clang++-5.0
+ - os: linux
+ env: COMPILER=clang++-6.0
+ - os: linux
+ env: COMPILER=clang++-7
+
+ # macOS/clang
+ # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
- os: osx
- osx_image: xcode8.2
- env:
- - CXX=clang++
- - NODE_LABELS="OSX OSX-10.12"
-notifications:
- email:
- on_success: always
- on_failure: always
+ osx_image: xcode7.3
+ env: OSX_VERSION=10.11
+ - os: osx
+ osx_image: xcode8.3
+ env: OSX_VERSION=10.12
+ - os: osx
+ osx_image: xcode9.3
+ env: OSX_VERSION=10.13
+
+ allow_failures:
+ - env: COMPILER=g++-6
+ - env: COMPILER=g++-7
+ - env: COMPILER=g++-8
+ - env: COMPILER=clang++-3.5
+ - env: COMPILER=clang++-3.6
+ - env: COMPILER=clang++-3.7 DISABLE_ASAN=yes
+ - env: COMPILER=clang++-3.8
+ - env: COMPILER=clang++-3.9
+ - env: COMPILER=clang++-4.0
+ - env: COMPILER=clang++-5.0
+ - env: COMPILER=clang++-6.0
+ - env: COMPILER=clang++-7
+
+ fast_finish: true
+
+install: |
+ case ${COMPILER} in
+ g++-[6789])
+ travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get -qy install "${COMPILER}"
+ ;;
+ clang++-*)
+ CLANG_VERSION=${COMPILER/clang++}
+ if [[ ${CLANG_VERSION} != "-3."* ]]; then
+ wget -O - "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
+ travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial${CLANG_VERSION/-7} main"
+ fi
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get -qy install "clang${CLANG_VERSION}"
+ ;;
+ esac
+
+before_script:
+ - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi
+ - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi
+ - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi
+ - ${CXX:-c++} --version
+ - python --version
+
script:
- ./.jenkins
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 54db7ea..e690290 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -15,14 +15,14 @@
errmsg = ''
warnmsg = ''
if cxx == 'gcc':
- if ccver < (4, 8, 2):
+ if ccver < (5, 3, 0):
errmsg = ('The version of gcc you are using is too old.\n'
- 'The minimum supported gcc version is 4.8.2.')
+ 'The minimum supported gcc version is 5.3.0.')
conf.flags = GccFlags()
elif cxx == 'clang':
- if ccver < (3, 4, 0):
+ if ccver < (3, 5, 0):
errmsg = ('The version of clang you are using is too old.\n'
- 'The minimum supported clang version is 3.4.0.')
+ 'The minimum supported clang version is 3.5.0.')
conf.flags = ClangFlags()
else:
warnmsg = 'Note: %s compiler is unsupported' % cxx
@@ -39,7 +39,7 @@
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
- # General flags are always applied (e.g., selecting C++11 mode)
+ # General flags are always applied (e.g., selecting C++ language standard)
generalFlags = conf.flags.getGeneralFlags(conf)
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
@@ -128,7 +128,7 @@
"""
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
- flags['CXXFLAGS'] += ['-std=c++11']
+ flags['CXXFLAGS'] += ['-std=c++14']
return flags
def getDebugFlags(self, conf):
@@ -164,16 +164,12 @@
class GccFlags(GccBasicFlags):
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
- if self.getCompilerVersion(conf) < (5, 1, 0):
- flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
- flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
+ flags['CXXFLAGS'] += ['-fdiagnostics-color']
return flags
def getOptimizedFlags(self, conf):
flags = super(GccFlags, self).getOptimizedFlags(conf)
- if self.getCompilerVersion(conf) < (5, 1, 0):
- flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
- flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
+ flags['CXXFLAGS'] += ['-fdiagnostics-color']
return flags
class ClangFlags(GccBasicFlags):
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index eaf4a88..c1d664b 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -9,40 +9,12 @@
- Install the `ndn-cxx library <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_
and its requirements
-Another additional libraries include:
-- ``log4cxx``
-
- On OS X 10.8, 10.9 and 10.10 with MacPorts:
-
- ::
-
- sudo port install log4cxx
-
- On Ubuntu >= 12.04:
-
- ::
-
- sudo apt-get install liblog4cxx10-dev
-
To build manpages and API documentation:
- ``doxygen``
- ``graphviz``
- ``python-sphinx``
- On OS X 10.8 and 10.9 with MacPorts:
-
- ::
-
- sudo port install doxygen graphviz py27-sphinx sphinx_select
- sudo port select sphinx py27-sphinx
-
- On Ubuntu >= 12.04:
-
- ::
-
- sudo apt-get install doxygen graphviz python-sphinx
-
Build
-----
@@ -54,28 +26,6 @@
./waf
sudo ./waf install
-Some platforms, such as OS X with MacPorts and certain Linux distributions (e.g., Fedora)
-require setting the ``PKG_CONFIG_PATH`` before running configure.
-
-For example, on OS X with MacPorts (assuming the default ``/opt/local`` MacPorts path):
-
-::
-
- export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- ./waf configure
- ./waf
- sudo ./waf install
-
-or some Linux distributions:
-
-::
-
- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
- ./waf configure
- ./waf
- sudo ./waf install
-
-
Refer to ``./waf --help`` for more options that can be used during ``configure`` stage and
how to properly configure and run NFD.
diff --git a/wscript b/wscript
index 1b44ea8..20dcad5 100644
--- a/wscript
+++ b/wscript
@@ -157,7 +157,7 @@
else:
# no tags matched
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
- except subprocess.CalledProcessError:
+ except (OSError, subprocess.CalledProcessError):
pass
versionFile = ctx.path.find_node('VERSION')