Search code examples
boostlibtorrentboost-buildb2libtorrent-rasterbar

ERROR: rule "version.boost-build" unknown while building libtorrent using boost build


I am trying to build libtorrent using b2 by following libtorrent building with boost build but I am facing this error when I do b2 install --prefix=PRIFIX:

LDFLAGS =
OS = LINUX
Jamfile:944: in install-paths
ERROR: rule "version.boost-build" unknown in module "Jamfile</home/pavan/projects/torrents/libtorrent_install/libtorrent-2.0.7>".
Jamfile:1063: in install-pkg-config
Jamfile:1094: in load-aux
/home/pavan/boost_install/boost_1_80_0/tools/build/src/build/project.jam:378: in load-jamfile
/home/pavan/boost_install/boost_1_80_0/tools/build/src/build/project.jam:64: in load
/home/pavan/boost_install/boost_1_80_0/tools/build/src/build/project.jam:142: in project.find
/home/pavan/boost_install/boost_1_80_0/tools/build/src/build-system.jam:618: in load
/home/pavan/boost_install/boost_1_80_0/tools/build/src/kernel/modules.jam:294: in import
/home/pavan/boost_install/boost_1_80_0/tools/build/src/kernel/bootstrap.jam:135: in module scope
pavan@pavan-B550-GAMING-X-V2:~/projects/torrents/libtorrent_install/libtorrent-2.0.7$ ls

after going through the line number in Jamfile (944) I can see this:

 local boost-build-version = [ SPLIT_BY_CHARACTERS [ version.boost-build ] : "-" ] ;

I have followed the same steps on another machine I did not see this error, am I missing something ?


Solution

  • There was a change in boost-build in boost-1.80 where this way of accessing its version number was removed.

    It was fixed here (but hasn't been released yet). You can fix it by applying this patch:

    --- a/Jamfile
    +++ b/Jamfile
    @@ -22,6 +22,8 @@ ECHO "CXXFLAGS =" $(CXXFLAGS) ;
     ECHO "LDFLAGS =" $(LDFLAGS) ;
     ECHO "OS =" [ os.name ] ;
     
    +jam-version = [ modules.peek : JAM_VERSION ] ;
    +
     if $(BOOST_ROOT)
     {
        ECHO "building boost from source directory: " $(BOOST_ROOT) ;
    @@ -163,10 +165,11 @@ rule linking ( properties * )
            # which only works on ELF targets with gcc
            result += <linkflags>-Wl,--export-dynamic <linkflags>-rdynamic ;
        }
    -   else
    +   else if [ version.version-less $(jam-version) : 1990 0 ]
        {
    -       # backtraces don't work with visibility=hidden, so we only add that in
    -       # the else-block
    +       # the visibility feature was introduced in boost-1.69. This was close to
    +       # when the verisoning scheme changed from year to (low) version numbers.
    +       # in boost-1.70
            result += <visibility>hidden ;
        }
     
    @@ -941,8 +944,10 @@ rule install-paths ( properties * )
        # package.paths was introduced in boost-1.70 (2018.02)
        # however, boost build's versioning scheme changed in boost-1.71 to version
        # 4.0
    -   local boost-build-version = [ SPLIT_BY_CHARACTERS [ version.boost-build ] : "-" ] ;
    -   if [ version.version-less [ SPLIT_BY_CHARACTERS $(boost-build-version[1]) : "." ] : 2018 03 ]
    +   # so, if versions are 4.0+ we want to use package.paths, but if it's a year,
    +   # say 2018, that means it's old and we use the fallback below. Any version <
    +   # 1990 is considered the 4.0 and later numbering scheme.
    +   if [ version.version-less 1990 0 : $(jam-version) ]
        {
            import option ;
            import property ;