From 5f35f64d9aad9d2cc04e317cccf452745cfb4244 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Thu, 10 May 2018 19:36:03 -0400 Subject: [PATCH] build: require gcc >= 5.3 and boost >= 1.58 This effectively drops support for all versions of Ubuntu older than 16.04 Change-Id: If1c96cc697d38a94588f126a89d13ec8e582702d Refs: #4462 --- .jenkins.d/README.md | 4 +- .travis.yml | 93 ++++++++++------------------ .waf-tools/boost-kqueue.py | 23 ------- .waf-tools/default-compiler-flags.py | 16 ++--- .waf-tools/type_traits.py | 19 ------ .waf-tools/websocket.py | 4 +- README-dev.md | 4 +- daemon/face/pcap-helper.cpp | 6 +- daemon/face/tcp-channel.cpp | 8 --- daemon/main.cpp | 2 +- docs/INSTALL.rst | 2 +- tests/check-typeid.hpp | 11 ++-- tests/test-case.t.cpp.sample | 2 +- wscript | 34 +++------- 14 files changed, 63 insertions(+), 165 deletions(-) delete mode 100644 .waf-tools/boost-kqueue.py delete mode 100644 .waf-tools/type_traits.py diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md index 41812aa7..39fa40bd 100644 --- a/.jenkins.d/README.md +++ b/.jenkins.d/README.md @@ -13,13 +13,13 @@ Environment Variables Used in Build Scripts * `[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. diff --git a/.travis.yml b/.travis.yml index c310d6b4..984e8ace 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -dist: trusty +dist: xenial sudo: required env: global: @@ -10,93 +10,35 @@ matrix: include: # Linux/gcc # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages - - os: linux - env: COMPILER=g++-4.8 - - os: linux - env: COMPILER=g++-4.9 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-4.9 - os: linux env: COMPILER=g++-5 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-5 - os: linux env: COMPILER=g++-6 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-6 - os: linux env: COMPILER=g++-7 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-7 - os: linux env: COMPILER=g++-8 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-8 # Linux/clang # https://apt.llvm.org/ - os: linux env: COMPILER=clang++-3.5 - addons: - apt: - packages: clang-3.5 - os: linux env: COMPILER=clang++-3.6 - addons: - apt: - packages: clang-3.6 - os: linux env: COMPILER=clang++-3.7 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-precise-3.7", "ubuntu-toolchain-r-test"] - packages: clang-3.7 - os: linux env: COMPILER=clang++-3.8 - addons: - apt: - sources: ["llvm-toolchain-precise-3.8", "ubuntu-toolchain-r-test"] - packages: clang-3.8 - os: linux - env: COMPILER=clang++-3.9 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-trusty-3.9", "ubuntu-toolchain-r-test"] - packages: clang-3.9 + env: COMPILER=clang++-3.9 - os: linux env: COMPILER=clang++-4.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-4.0", "ubuntu-toolchain-r-test"] - packages: clang-4.0 - os: linux env: COMPILER=clang++-5.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-5.0", "ubuntu-toolchain-r-test"] - packages: clang-5.0 - os: linux env: COMPILER=clang++-6.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-6.0", "ubuntu-toolchain-r-test"] - packages: clang-6.0 - os: linux env: COMPILER=clang++-7 - addons: - apt: - sources: ["llvm-toolchain-trusty", "ubuntu-toolchain-r-test"] - packages: clang-7 # macOS/clang # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version @@ -111,12 +53,41 @@ matrix: 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-14.04"; fi + - 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 diff --git a/.waf-tools/boost-kqueue.py b/.waf-tools/boost-kqueue.py deleted file mode 100644 index d4d5139d..00000000 --- a/.waf-tools/boost-kqueue.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- -# -# Copyright (c) 2014, Regents of the University of California -# -# GPL 3.0 license, see the COPYING.md file for more information - -from waflib import Configure - -BOOST_ASIO_HAS_KQUEUE_CHECK = ''' -#include -#if defined(BOOST_ASIO_HAS_KQUEUE) and BOOST_VERSION == 105600 -#error "Ethernet face support cannot be enabled on this platform with boost 1.56" -#endif -''' - -@Configure.conf -def check_asio_pcap_support(conf): - # https://svn.boost.org/trac/boost/ticket/10367 - if conf.check_cxx(msg='Checking if Ethernet face support can be enabled', - fragment=BOOST_ASIO_HAS_KQUEUE_CHECK, - features='cxx', use='BOOST', mandatory=False): - conf.define('HAVE_ASIO_PCAP_SUPPORT', 1) - conf.env['HAVE_ASIO_PCAP_SUPPORT'] = True diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py index 54db7ea9..e9fdcc61 100644 --- a/.waf-tools/default-compiler-flags.py +++ b/.waf-tools/default-compiler-flags.py @@ -15,14 +15,14 @@ def configure(conf): 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 @@ -164,16 +164,12 @@ class GccBasicFlags(CompilerFlags): 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/.waf-tools/type_traits.py b/.waf-tools/type_traits.py deleted file mode 100644 index fc1ffbf1..00000000 --- a/.waf-tools/type_traits.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- -# -# Copyright (c) 2014, Regents of the University of California -# -# GPL 3.0 license, see the COPYING.md file for more information - -from waflib import Configure - -IS_MOVE_CONSTRUCTIBLE_CHECK = ''' -#include -static_assert(std::is_move_constructible::value, ""); -''' - -def configure(conf): - if conf.check_cxx(msg='Checking for std::is_move_constructible', - fragment=IS_MOVE_CONSTRUCTIBLE_CHECK, - features='cxx', mandatory=False): - conf.define('HAVE_IS_MOVE_CONSTRUCTIBLE', 1) - conf.env['HAVE_IS_MOVE_CONSTRUCTIBLE'] = True diff --git a/.waf-tools/websocket.py b/.waf-tools/websocket.py index c30c48e1..6b481cf4 100644 --- a/.waf-tools/websocket.py +++ b/.waf-tools/websocket.py @@ -62,11 +62,11 @@ def checkWebsocket(self, **kw): if isMandatory: self.end_msg(str(error), color='RED') Logs.warn('If you are using git NFD repository, checkout websocketpp submodule: ') - Logs.warn(' git submodule init && git submodule update') + Logs.warn(' git submodule update --init') Logs.warn('Otherwise, manually download and extract websocketpp library:') Logs.warn(' mkdir websocketpp') Logs.warn(' curl -L https://github.com/zaphoyd/websocketpp/archive/0.7.0.tar.gz > websocket.tar.gz') - Logs.warn(' tar zxf websocket.tar.gz -C websocketpp/ --strip 1') + Logs.warn(' tar xf websocket.tar.gz -C websocketpp/ --strip 1') Logs.warn('Alternatively, WebSocket support can be disabled with --without-websocket') self.fatal('The configuration failed') else: diff --git a/README-dev.md b/README-dev.md index b6838268..c009d012 100644 --- a/README-dev.md +++ b/README-dev.md @@ -60,7 +60,7 @@ The simplest way to run tests, is just to run the compiled binary without any pa # Run NFD RIB management tests ./build/unit-tests-rib -However, [Boost.Test framework](http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/index.html) +However, [Boost.Test framework](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html) is very flexible and allows a number of run-time customization of what tests should be run. For example, it is possible to choose to run only a specific test suite, only a specific test case within a suite, or specific test cases within specific test suites: @@ -93,5 +93,5 @@ or `-p` to show progress bar: There are many more command line options available, information about which can be obtained either from the command line using `--help` -switch, or online on [Boost.Test library](http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/index.html) +switch, or online on [Boost.Test library](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html) website. diff --git a/daemon/face/pcap-helper.cpp b/daemon/face/pcap-helper.cpp index b1e57ebb..072f75ed 100644 --- a/daemon/face/pcap-helper.cpp +++ b/daemon/face/pcap-helper.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2018, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -43,14 +43,12 @@ PcapHelper::PcapHelper(const std::string& interfaceName) if (!m_pcap) BOOST_THROW_EXCEPTION(Error("pcap_create: " + std::string(errbuf))); -#ifdef HAVE_PCAP_SET_IMMEDIATE_MODE // Enable "immediate mode", effectively disabling any read buffering in the kernel. // This corresponds to the BIOCIMMEDIATE ioctl on BSD-like systems (including macOS) // where libpcap uses a BPF device. On Linux this forces libpcap not to use TPACKET_V3, // even if the kernel supports it, thus preventing bug #1511. if (pcap_set_immediate_mode(m_pcap, 1) < 0) BOOST_THROW_EXCEPTION(Error("pcap_set_immediate_mode failed")); -#endif } PcapHelper::~PcapHelper() diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp index 968c6a7d..1e6b410c 100644 --- a/daemon/face/tcp-channel.cpp +++ b/daemon/face/tcp-channel.cpp @@ -191,15 +191,7 @@ TcpChannel::handleConnect(const boost::system::error_code& error, { scheduler::cancel(connectTimeoutEvent); -#if (BOOST_VERSION == 105400) - // To handle regression in Boost 1.54 - // https://svn.boost.org/trac/boost/ticket/8795 - boost::system::error_code anotherErrorCode; - socket->remote_endpoint(anotherErrorCode); - if (error || anotherErrorCode) { -#else if (error) { -#endif if (error != boost::asio::error::operation_aborted) { NFD_LOG_CHAN_DEBUG("Connection to " << remoteEndpoint << " failed: " << error.message()); if (onConnectFailed) diff --git a/daemon/main.cpp b/daemon/main.cpp index 0de725e5..4cff13b7 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -40,7 +40,7 @@ #include #include // boost::thread is used instead of std::thread to guarantee proper cleanup of thread local storage, -// see http://www.boost.org/doc/libs/1_54_0/doc/html/thread/thread_local_storage.html +// see https://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_local_storage.html #include #include diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 8d4f08b2..ff2ad51c 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -23,7 +23,7 @@ We would also appreciate feedback and help packaging NDN releases for other plat Install NFD Using the NDN PPA Repository on Ubuntu Linux -------------------------------------------------------- -NFD binaries and related tools for Ubuntu 14.04 and 16.04 can be installed using PPA +NFD binaries and related tools for Ubuntu 16.04 and 18.04 can be installed using PPA packages from named-data repository. First, you will need to add ``named-data/ppa`` repository to binary package sources and update list of available packages. diff --git a/tests/check-typeid.hpp b/tests/check-typeid.hpp index 58d9fb62..5e792893 100644 --- a/tests/check-typeid.hpp +++ b/tests/check-typeid.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2018, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -31,17 +31,14 @@ #define NFD_TESTS_CHECK_TYPEID_HPP #include "boost-test.hpp" + +#include #include /** \def NFD_TYPEID_NAME(x) * \return type name of typeid(x) as std::string */ -#if BOOST_VERSION >= 105600 -#include #define NFD_TYPEID_NAME(x) (::boost::core::demangle(typeid(x).name())) -#else -#define NFD_TYPEID_NAME(x) (::std::string(typeid(x).name())) -#endif /** (implementation detail) */ diff --git a/tests/test-case.t.cpp.sample b/tests/test-case.t.cpp.sample index bfff4442..bfc8219d 100644 --- a/tests/test-case.t.cpp.sample +++ b/tests/test-case.t.cpp.sample @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(Test1) int i = 0; // For reference of available Boost.Test macros, see - // http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/utf/testing-tools/reference.html + // https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/utf/testing-tools/reference.html BOOST_CHECK_EQUAL(i, 0); BOOST_CHECK_GT(++i, 0); diff --git a/wscript b/wscript index d9836ab1..d4da8c4b 100644 --- a/wscript +++ b/wscript @@ -34,8 +34,8 @@ GIT_TAG_PREFIX = 'NFD-' def options(opt): opt.load(['compiler_cxx', 'gnu_dirs']) - opt.load(['default-compiler-flags', 'compiler-features', 'type_traits', - 'coverage', 'pch', 'sanitizers', 'boost', 'boost-kqueue', + opt.load(['default-compiler-flags', 'compiler-features', + 'coverage', 'pch', 'sanitizers', 'boost', 'dependency-checker', 'unix-socket', 'websocket', 'doxygen', 'sphinx_build'], tooldir=['.waf-tools']) @@ -83,8 +83,8 @@ int main() def configure(conf): conf.load(['compiler_cxx', 'gnu_dirs', - 'default-compiler-flags', 'compiler-features', 'type_traits', - 'pch', 'boost', 'boost-kqueue', 'dependency-checker', 'websocket', + 'default-compiler-flags', 'compiler-features', + 'pch', 'boost', 'dependency-checker', 'websocket', 'doxygen', 'sphinx_build']) conf.find_program('bash', var='BASH') @@ -116,32 +116,18 @@ def configure(conf): boost_libs += ' unit_test_framework' conf.check_boost(lib=boost_libs, mt=True) - if conf.env.BOOST_VERSION_NUMBER < 105400: - conf.fatal('Minimum required Boost version is 1.54.0\n' + if conf.env.BOOST_VERSION_NUMBER < 105800: + conf.fatal('Minimum required Boost version is 1.58.0\n' 'Please upgrade your distribution or manually install a newer version of Boost' ' (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)') - if conf.env.CXX_NAME == 'clang' and conf.env.BOOST_VERSION_NUMBER < 105800: - conf.define('BOOST_ASIO_HAS_STD_ARRAY', 1) # Workaround for https://redmine.named-data.net/issues/3360#note-14 - conf.define('BOOST_ASIO_HAS_STD_CHRONO', 1) # Solution documented at https://redmine.named-data.net/issues/3588#note-10 - conf.load('unix-socket') conf.checkWebsocket(mandatory=True) if not conf.options.without_libpcap: - conf.check_asio_pcap_support() - if conf.env.HAVE_ASIO_PCAP_SUPPORT: - conf.checkDependency(name='libpcap', lib='pcap', mandatory=True, - errmsg='not found, but required for Ethernet face support. ' - 'Specify --without-libpcap to disable Ethernet face support.') - else: - Logs.warn('Warning: Ethernet face is not supported on this platform with Boost libraries version 1.56. ' - 'See https://redmine.named-data.net/issues/1877 for more details') - if conf.env.HAVE_LIBPCAP: - conf.check_cxx(msg='Checking if libpcap supports pcap_set_immediate_mode', mandatory=False, - define_name='HAVE_PCAP_SET_IMMEDIATE_MODE', use='LIBPCAP', - fragment='''#include - int main() { pcap_t* p; pcap_set_immediate_mode(p, 1); }''') + conf.checkDependency(name='libpcap', lib='pcap', mandatory=True, + errmsg='not found, but required for Ethernet face support. ' + 'Specify --without-libpcap to disable Ethernet face support.') conf.check_compiler_flags() @@ -303,7 +289,7 @@ def version(ctx): 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')