Skip to content

Commit

Permalink
build: require boost >= 1.71.0
Browse files Browse the repository at this point in the history
Refs: #5276
Change-Id: I6eaae86beb89e00adf3891deb87816a1f176fdd6
  • Loading branch information
Pesa committed Nov 13, 2023
1 parent 2ecb059 commit 5849ee7
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 54 deletions.
7 changes: 5 additions & 2 deletions .waf-tools/default-compiler-flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ def getCompilerVersion(self, conf):

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"""
Expand Down Expand Up @@ -158,7 +162,6 @@ def getGeneralFlags(self, conf):
'-Wpedantic',
'-Wenum-conversion',
'-Wextra-semi',
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
__linkFlags = ['-Wl,-O1']
Expand Down
4 changes: 2 additions & 2 deletions docs/beginners-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ should be run as root:
$ dnf list --installed gcc
$ dnf list --installed gcc-c++

#. Python version 3.6 or later
#. Python version 3.8 or later

::

Expand All @@ -124,7 +124,7 @@ should be run as root:

$ dnf list --installed pkgconf*

#. Boost libraries version 1.65.1 or later
#. Boost libraries version 1.71.0 or later

::

Expand Down
5 changes: 3 additions & 2 deletions src/conf-file-processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -127,8 +128,8 @@ class ConfigurationVariable
private:
const std::string m_key;
const ConfParameterCallback m_setterCallback;
T m_defaultValue;

T m_defaultValue;
T m_minValue;
T m_maxValue;

Expand Down Expand Up @@ -493,7 +494,7 @@ ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
m_io,
TIME_ALLOWED_FOR_CANONIZATION);
m_io.run();
m_io.reset();
m_io.restart();

if (failedToCanonize) {
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/conf-file-processor.hpp
Original file line number Diff line number Diff line change
@@ -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.
*
Expand All @@ -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 {
Expand Down Expand Up @@ -118,8 +118,8 @@ class ConfFileProcessor
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
Expand Down
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -63,13 +63,11 @@ main(int argc, char** argv)
}
}

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;
Expand Down
10 changes: 3 additions & 7 deletions tests/io-fixture.hpp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -28,7 +28,7 @@

#include "tests/clock-fixture.hpp"

#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>

namespace nlsr::test {

Expand All @@ -39,17 +39,13 @@ class IoFixture : public ClockFixture
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
Expand Down
7 changes: 5 additions & 2 deletions tests/update/test-nfd-rib-command-processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "tests/test-common.hpp"

#include <boost/lexical_cast.hpp>
#include <boost/mp11/list.hpp>

namespace nlsr {
namespace test {
Expand Down Expand Up @@ -97,8 +98,10 @@ class NfdRibCommandProcessorFixture : public IoKeyChainFixture
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)

Expand Down
18 changes: 8 additions & 10 deletions tests/wscript
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -21,12 +21,10 @@ NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
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)
43 changes: 22 additions & 21 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ You should have received a copy of the GNU General Public License along with
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'
Expand Down Expand Up @@ -71,16 +72,15 @@ def configure(conf):
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)
Expand All @@ -104,7 +104,7 @@ def configure(conf):
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
Expand All @@ -118,6 +118,7 @@ def build(bld):
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 +
Expand All @@ -129,32 +130,32 @@ def build(bld):

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')

Expand Down Expand Up @@ -220,16 +221,16 @@ def version(ctx):
# 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')
Expand All @@ -247,14 +248,14 @@ def version(ctx):
# 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'
Expand Down

0 comments on commit 5849ee7

Please sign in to comment.