build: require boost >= 1.71.0
Refs: #5276
Change-Id: I6eaae86beb89e00adf3891deb87816a1f176fdd6
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 4aa9e9b..4e09a82 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -128,7 +128,11 @@
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
- return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
+ return {
+ 'CXXFLAGS': [],
+ 'LINKFLAGS': [],
+ 'DEFINES': ['BOOST_ASIO_NO_DEPRECATED', 'BOOST_FILESYSTEM_NO_DEPRECATED'],
+ }
def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
@@ -158,7 +162,6 @@
'-Wpedantic',
'-Wenum-conversion',
'-Wextra-semi',
- '-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
__linkFlags = ['-Wl,-O1']
diff --git a/docs/beginners-guide.rst b/docs/beginners-guide.rst
index e6006a5..0813a10 100644
--- a/docs/beginners-guide.rst
+++ b/docs/beginners-guide.rst
@@ -100,7 +100,7 @@
$ dnf list --installed gcc
$ dnf list --installed gcc-c++
-#. Python version 3.6 or later
+#. Python version 3.8 or later
::
@@ -124,7 +124,7 @@
$ dnf list --installed pkgconf*
-#. Boost libraries version 1.65.1 or later
+#. Boost libraries version 1.71.0 or later
::
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 33ae4a0..af0ad52 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -28,6 +28,7 @@
#include <ndn-cxx/net/face-uri.hpp>
#include <ndn-cxx/util/io.hpp>
+#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/property_tree/info_parser.hpp>
@@ -127,8 +128,8 @@
private:
const std::string m_key;
const ConfParameterCallback m_setterCallback;
- T m_defaultValue;
+ T m_defaultValue;
T m_minValue;
T m_maxValue;
@@ -493,7 +494,7 @@
m_io,
TIME_ALLOWED_FOR_CANONIZATION);
m_io.run();
- m_io.reset();
+ m_io.restart();
if (failedToCanonize) {
return false;
diff --git a/src/conf-file-processor.hpp b/src/conf-file-processor.hpp
index 735a0c1..6cd4d73 100644
--- a/src/conf-file-processor.hpp
+++ b/src/conf-file-processor.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2023, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -25,7 +25,7 @@
#include "common.hpp"
#include "conf-parameter.hpp"
-#include <boost/algorithm/string.hpp>
+#include <boost/asio/io_context.hpp>
#include <boost/property_tree/ptree.hpp>
namespace nlsr {
@@ -118,8 +118,8 @@
std::string m_confFileName;
/*! m_confParam The ConfFileProcessor object to configure as parsing is done. */
ConfParameter& m_confParam;
- /*! m_io For canonization of faceUri. */
- boost::asio::io_service m_io;
+ /*! m_io For canonization of FaceUri. */
+ boost::asio::io_context m_io;
};
} // namespace nlsr
diff --git a/src/main.cpp b/src/main.cpp
index 7fa5062..dfe54a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2023, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -63,13 +63,11 @@
}
}
- boost::asio::io_service ioService;
- ndn::Face face(ioService);
ndn::KeyChain keyChain;
+ ndn::Face face(nullptr, keyChain);
nlsr::ConfParameter confParam(face, keyChain, configFileName);
nlsr::ConfFileProcessor configProcessor(confParam);
-
if (!configProcessor.processConfFile()) {
std::cerr << "Error in configuration file processing" << std::endl;
return 2;
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
index 782f7df..e7c65ec 100644
--- a/tests/io-fixture.hpp
+++ b/tests/io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,7 @@
#include "tests/clock-fixture.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
namespace nlsr::test {
@@ -39,17 +39,13 @@
afterTick() final
{
if (m_io.stopped()) {
-#if BOOST_VERSION >= 106600
m_io.restart();
-#else
- m_io.reset();
-#endif
}
m_io.poll();
}
protected:
- boost::asio::io_service m_io;
+ boost::asio::io_context m_io;
};
} // namespace nlsr::test
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 5105f9c..b055275 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -28,6 +28,7 @@
#include "tests/test-common.hpp"
#include <boost/lexical_cast.hpp>
+#include <boost/mp11/list.hpp>
namespace nlsr {
namespace test {
@@ -97,8 +98,10 @@
uint64_t nameLsaSeqNoBeforeInterest;
};
-typedef boost::mpl::vector<update::NfdRibRegisterCommand,
- update::NfdRibUnregisterCommand> Commands;
+using Commands = boost::mp11::mp_list<
+ update::NfdRibRegisterCommand,
+ update::NfdRibUnregisterCommand
+>;
BOOST_FIXTURE_TEST_SUITE(TestNfdRibCommandProcessor, NfdRibCommandProcessorFixture)
diff --git a/tests/wscript b/tests/wscript
index fe86136..2e680c8 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,6 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
-Copyright (c) 2014-2022, The University of Memphis
+Copyright (c) 2014-2023, The University of Memphis
Regents of the University of California
This file is part of NLSR (Named-data Link State Routing).
@@ -21,12 +21,10 @@
top = '..'
def build(bld):
- bld.objects(target='unit-test-objects',
- source=bld.path.ant_glob('**/*.cpp', excl=['main.cpp']),
- use='nlsr-objects')
-
- bld.program(target='../unit-tests-nlsr',
- name='unit-tests-nlsr',
- source='main.cpp',
- use='unit-test-objects',
- install_path=None)
+ bld.program(
+ target=f'{top}/unit-tests-nlsr',
+ name='unit-tests-nlsr',
+ source=bld.path.ant_glob('**/*.cpp'),
+ use='BOOST_TESTS nlsr-objects',
+ includes=top,
+ install_path=None)
diff --git a/wscript b/wscript
index bcf3261..c5cab7f 100644
--- a/wscript
+++ b/wscript
@@ -19,8 +19,9 @@
NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
"""
+import os
+import subprocess
from waflib import Context, Logs, Utils
-import os, subprocess
VERSION = '0.7.0'
APPNAME = 'nlsr'
@@ -71,16 +72,15 @@
conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'],
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
- boost_libs = ['system', 'iostreams', 'filesystem', 'regex']
- if conf.env.WITH_TESTS:
- boost_libs.append('unit_test_framework')
-
- conf.check_boost(lib=boost_libs, mt=True)
- if conf.env.BOOST_VERSION_NUMBER < 106501:
- conf.fatal('The minimum supported version of Boost is 1.65.1.\n'
+ conf.check_boost(lib='filesystem', mt=True)
+ if conf.env.BOOST_VERSION_NUMBER < 107100:
+ conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
'Please upgrade your distribution or manually install a newer version of Boost.\n'
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
+ if conf.env.WITH_TESTS:
+ conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
+
if conf.options.with_chronosync:
conf.check_cfg(package='ChronoSync', args=['ChronoSync >= 0.5.5', '--cflags', '--libs'],
uselib_store='CHRONOSYNC', pkg_config_path=pkg_config_path)
@@ -104,7 +104,7 @@
conf.load('sanitizers')
conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS)
- conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nlsr.conf' % conf.env.SYSCONFDIR)
+ conf.define('DEFAULT_CONFIG_FILE', f'{conf.env.SYSCONFDIR}/ndn/nlsr.conf')
# The config header will contain all defines that were added using conf.define()
# or conf.define_cond(). Everything that was added directly to conf.env.DEFINES
# will not appear in the config header, but will instead be passed directly to the
@@ -118,6 +118,7 @@
name='version.hpp',
source='src/version.hpp.in',
target='src/version.hpp',
+ install_path=None,
VERSION_STRING=VERSION_BASE,
VERSION_BUILD=VERSION,
VERSION=int(VERSION_SPLIT[0]) * 1000000 +
@@ -129,32 +130,32 @@
bld.objects(
target='nlsr-objects',
- source=bld.path.ant_glob('src/**/*.cpp',
- excl=['src/main.cpp']),
- use='NDN_CXX BOOST CHRONOSYNC PSYNC SVS',
+ source=bld.path.ant_glob('src/**/*.cpp', excl=['src/main.cpp']),
+ use='BOOST NDN_CXX CHRONOSYNC PSYNC SVS',
includes='. src',
export_includes='. src')
bld.program(
- target='bin/nlsr',
name='nlsr',
+ target='bin/nlsr',
source='src/main.cpp',
use='nlsr-objects')
bld.program(
- target='bin/nlsrc',
name='nlsrc',
+ target='bin/nlsrc',
source='tools/nlsrc.cpp',
use='nlsr-objects')
if bld.env.WITH_TESTS:
bld.recurse('tests')
+ # Install sample config
bld.install_as('${SYSCONFDIR}/ndn/nlsr.conf.sample', 'nlsr.conf')
if Utils.unversioned_sys_platform() == 'linux':
bld(features='subst',
- name='nlsr.service',
+ name='systemd-units',
source='systemd/nlsr.service.in',
target='systemd/nlsr.service')
@@ -220,16 +221,16 @@
# first, try to get a version string from git
gotVersionFromGit = False
try:
- cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
- out = subprocess.check_output(cmd, universal_newlines=True).strip()
+ cmd = ['git', 'describe', '--always', '--match', f'{GIT_TAG_PREFIX}*']
+ out = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
if out:
gotVersionFromGit = True
if out.startswith(GIT_TAG_PREFIX):
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
else:
# no tags matched
- Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
- except (OSError, subprocess.CalledProcessError):
+ Context.g_module.VERSION = f'{VERSION_BASE}-commit-{out}'
+ except (OSError, subprocess.SubprocessError):
pass
versionFile = ctx.path.find_node('VERSION.info')
@@ -247,14 +248,14 @@
# already up-to-date
return
except EnvironmentError as e:
- Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
+ Logs.warn(f'{versionFile} exists but is not readable ({e.strerror})')
else:
versionFile = ctx.path.make_node('VERSION.info')
try:
versionFile.write(Context.g_module.VERSION)
except EnvironmentError as e:
- Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
+ Logs.warn(f'{versionFile} is not writable ({e.strerror})')
def dist(ctx):
ctx.algo = 'tar.xz'