帮助使用 boost.log 和 boost.build (bjam) 别名、构建并包含在目标中

发布于 2024-11-11 17:12:43 字数 1236 浏览 2 评论 0原文

我已经从 SVN 存储库(主干,修订版 601)构建了 boost.log,并尝试将其包含在可执行文件中。 该库可以在 VS2008 中使用,但不能在 bjam 中使用。

我尝试将 boost.log 库与其他 boost 库一样命名,但出现错误: “无法找到名为'/boost/log'的文件或目标”

有同样的问题

Boost是从源代码构建的(下面的命令),我对v1.45和v1.46.1 Jamfile.jam(片段)

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
    ;

:用于构建的命令提升是:

bjam 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%

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:

bjam 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%

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墟烟 2024-11-18 17:12:43

Boost Log 库还不是官方的 boost 库。 (我不知道审核过程进行到什么程度,但我在 Boost 的 svn trunk。)因此,它不在提供的 boost.jam 文件中也就不足为奇了(当前主干版本)。

boost.jam 往往有点落后于实际提供的库,所以也许我错了。我不熟悉日志库,但是,如果您想将其添加到 boost.jam 文件中,很可能,您需要将此行(或类似的内容)添加到库列表中

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

:在 boost_std 规则中,库大约位于文件的三分之二处。 (你不能错过它。那里定义了 25 个其他库。)只有当日志库使用与其余 boost 库相同的命名约定时,这才有效。

另一种选择是只编写自己的 lib 规则并自己指向该版本。这大概是

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

(取自 boost log 的依赖项列表安装说明。)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文