开发者

Help with boost.log and boost.build (bjam) alias, building and including in target

开发者 https://www.devze.com 2023-03-09 05:17 出处:网络
I have built boost.log from SVN repo (trunk, rev 601), and am trying to include it in an executable. The lib is usable from VS2008, but not bjam.

I have built boost.log from SVN repo (trunk, rev 601), and am trying to include it in an executable. The lib is usable from VS2008, but not bjam.

I attempt to alias the boost.log lib as with other boost libs but I get an error: "unable to find file or target named '/boost/log'"

Boost is build from source (command below), I have the same issue with v1.45 and v1.46.1

Jamfile.jam (snippet):

alias libboostpo    : /boost//program_options   : <link>static <threading>multi ;
alias libboostfs    : /boost//filesystem        : <link>static <threading>multi ; 
alias libboostlog    : /boost//log              : <link>static <threading>multi ; 

alias libfoundation : /path-foundation//foundation : <link>static <threading>multi ;
alias libtestcommon : /path-testcommon//testcommon : <link>static <threading>multi ;

exe foundationtest
    : libfoundation libtestcommon
      libboostpo libboostfs
      libboostlog 
      libgtest_win libggmock_win 
      [ glob-tree *.cpp *.rc ]
    : <toolset>msvc
    ;

The command used to build boost is:

bj开发者_如何学JAVAam install variant=debug,release link=static,shared -j8 --prefix=%OutputPath% -s ZLIB_SOURCE=%PathToCOTS%\zlib --without-python --without-mpi --without-wave --without-test --without-graph --without-math --toolset=msvc >> %logFile%


The Boost Log library is not an official boost library yet. (I don't know how far along it is in the review process, but I don't see it in Boost's svn trunk.) So it's not surprising that it's not in the provided boost.jam file (current trunk version).

That boost.jam tends to be a bit behind what libraries are actually provided though, so maybe I'm wrong. I'm not familiar with the log library, but, if you wanted to add it to your boost.jam file, most likely, you'll need to add this line (or something similar) to the list of libraries:

    lib log
        : filesystem
          system
          date_time
          thread
          regex
        :
        :
        : <link>shared:<define>BOOST_LOG_DYN_LINK ;

The list of libraries is roughly two-thirds down the file in the boost_std rule. (You can't miss it. There are 25 other libraries defined there.) This will only work if the log library uses the same naming convention as the rest of the boost libraries.

The other option is to just write your own lib rule and point to that version yourself. That would be roughly

lib libboostlog
    : /boost//headers
      /boost//filesystem
      /boost//system
      /boost//date_time
      /boost//thread
      /boost//regex
    : <name>boost_log
      <link>static
      <threading>multi ;

(List of dependencies taken from the boost log installation directions.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号