简体   繁体   English

在Debian 8.3 ARM上构建Boost单元测试框架

[英]Building Boost unit test framework on Debian 8.3 ARM

I'm trying to port a larger project to an embedded Linux system (Debian 8.3 ARM). 我正在尝试将较大的项目移植到嵌入式Linux系统(Debian 8.3 ARM)。 The project requires Boost libraries newer than the system's Synaptic (1.55 vs. 1.58), so I'll need to build Boost from source. 该项目需要比系统Synaptic更新的Boost库(1.55与1.58),因此我需要从源代码构建Boost。 Usually I pick the most recent version, which was 1.60 when I downloaded things two weeks ago (current is 1.61). 通常,我选择的是最新版本,即两周前下载内容时的最新版本为1.60(当前为1.61)。

The project contains test cases requiring boost_unit_test_framework . 该项目包含需要boost_unit_test_framework From the Boost docs I take it the calls (from the unzipped source directory) should be 从Boost文档中,我认为调用(来自未压缩的源目录)应为

./bootstrap.sh --prefix=/home/tinyt/b160_clang \
--with-libraries=system,thread,<more lbraries>,\
boost_unit_test_framework,test_exec_monitor
./b2 install toolset=clang

and that ought to give me boost 1.60 in ~/b160_clang (line breaks are not part of the command but inserted here for readability). 这应该使我在~/b160_clang提高1.60(换行符不是命令的一部分,而是在此处插入以提高可读性)。 The problem is that b2 doesn't recognize boost_unit_test_framework or unit_test_framework as libraries and therefore doesn't build boost. 问题在于b2无法将boost_unit_test_frameworkunit_test_framework识别为库,因此无法构建boost。 If I just omit the library, my subset of boost libraries builds, but of course CMake fails because its boost_unit_test_framework requirement is not met. 如果我只是省略该库, boost_unit_test_framework构建我的Boost库子集,但是CMake当然会失败,因为它的boost_unit_test_framework要求未得到满足。

Are there any other libraries that I ought to include? 我还应该包括其他库吗? Does the sequence of libraries matter? 库的顺序重要吗? Should I link to ar somewhere along the way? 我是否应该一路链接到ar?

The CMake generally seems to be OK, my build environment for the project is a x86 Debian 8.3 machine where things work fine. CMake通常看起来还可以,我在该项目的构建环境是x86 Debian 8.3机器,一切正常。 The difference is that there is enough room for a full install here. 区别在于这里有足够的空间来进行完整安装。

Running clang 3.5 and CMake 3.0.2, same as the functional desktop system. 运行clang 3.5和CMake 3.0.2,与功能桌面系统相同。 Most likely there is not enough space on the embedded target system to build the entire boost library AND have free space for my project app. 嵌入式目标系统上很可能没有足够的空间来构建整个Boost库,并且没有足够的空间供我的项目应用程序使用。

Am I missing further dependencies of boost_unit_test_framework ? 我是否缺少boost_unit_test_framework其他依赖boost_unit_test_framework Is there a catch in how to specify the library for installation? 如何指定要安装的库是否有问题? Is the unit test framework header-only so I can just copy the headers manually? 单元测试框架是仅标头的,所以我可以手动复制标头吗?

Any suggestions appreciated. 任何建议表示赞赏。 Thanks! 谢谢!

Edit: 编辑:

I've just tried running bjam --prefix=/... --with-<...> for all the libraries I want to build with. 我刚刚尝试为要构建的所有库运行bjam --prefix=/... --with-<...> The output was the same as before: 输出与以前相同:

error: wrong library name 'boost_unit_test_framework' in the --with-<library> option.

The same is true if I omit the prefix boost_ . 如果省略前缀boost_也是如此。

You're using incorrect name to specify the library. 您使用错误的名称指定库。

You may run 可以跑

bjam --show-libraries

to obtain a list of names of the libraries that require compilation. 获取需要编译的库的名称列表。

For example, with boost 1.58, I get the following (trimmed) output: 例如,使用boost 1.58,我得到以下(修剪)输出:

...updated 1 target...
The following libraries require building:
    - atomic
    - chrono
    - container
    - context
    - coroutine
    - date_time
    - exception
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - log
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - timer
    - wave

Inspecting that, I can see there is a library named test . 检查一下,我可以看到有一个名为test的库。 That's the one you're looking for. 那就是您要寻找的那个。 Hence, your command line to perform the build should contain: 因此,执行构建的命令行应包含:

--with-libraries=system,thread,<more libraries>,test

Have a look at boost bcp. 看看boost bcp。 Using bcp you can specify what parts of boost you actually want and only "build" those. 使用bcp,您可以指定所需的增强部分,而仅“构建”那些部分。 Bcp lets you wrap those parts in a separate namespace, which might be handy, depending on your use case. Bcp允许您将这些部分包装在单独的名称空间中,这可能很方便,具体取决于您的用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM