English 中文(简体)
如何在Linux上安装来自源头的三溴代二苯并使其发挥作用
原标题:How to install TBB from source on Linux and make it work

我想知道如何从源头安装四溴代二苯,并使它在Linux系统上发挥作用。在使用时,我遇到了一些问题,如果通过软件包经理安装四溴代二苯,这些问题就不会出现。

在三溴代二苯网页上,有关于如何做到这一点的一些指南,例如设置 LD_Libriary_PATH CPATH 变量,或获取 tbvars.sh 文件。即使如此,当我试图编纂一个示例 g/code>时,也没有找到 tbb

所以,我的问题是,有没有一种简单的方法 来设置一切(调和源代码,我应该设置什么变量...) 来使用三溴代二苯?

谢谢

NOTE: 询问这个问题时的图书馆版本号为 2 (如果我记得正确的话)。 我亲自测试了4.1 版本的解决方案, 但我认为对于当前版本 < code>4.2 (更新3) 来说,它也应该有效,因为建筑方法保持不变。

最佳回答

我已提出解决办法,我将把解决办法张贴在这里,以便它能帮助其他人处理这个议题。

  1. 下载最新的稳定源代码并解除压缩, 即

  2. 在内部键入 make 。 它应该开始汇编 tbb 库和内存分配器 。

  3. 信头在

  4. 内部 将是两个新文件夹,一个是发布版本,另一个是调试版本。 这些文件夹的名称类似 >architecture_ldVersion_g++Version_cernelVersion

  5. 我建议设置一些变量, 例如在您的 文件中设置变量, 例如 :

TBB_INSTALL_DIR = $HOME/tbbsrc
TBB_INCLUDE = $TBB_INSTALL_DIR/include
TBB_LIBRARY_RELEASE = $TBB_INSTALL_DIR/build/RELEASE_FOLDER
TBB_LIBRARY_DEBUG = $TBB_INSTALL_DIR/build/DEBUG_FOLDER
  1. Let s try a simple example:
// main.cpp
#include "tbb/task_scheduler_init.h"

int main(int argc, char* argv[]) {
    // tbb::task_scheduler_init init(tbb::task_scheduler_init::automatic);
    // implicit tbb::task_sheduler_init::automatic
    tbb::task_scheduler_init init;
    return 0;
}
  1. To compile, for example, with the release version:
g++ main.cpp -I$TBB_INCLUDE -Wl,-rpath,$TBB_LIBRARY_RELEASE -L$TBB_LIBRARY_RELEASE -ltbb

注:使用 -Wl,-rpath,$TBB_Libriary_RELEASE ,我们告诉动态链接到哪里查找 libtbb.so

  1. And that should work fine!

问候您了!

苹果叮当5.1: [感谢狼人提供信息]

类型为 make , 类型为 make , 类型为 make 编译器=clan make 编译器=clan stdlib=libc_/code>

问题回答

https://github.com/wjakob/tbb 似乎是前进的道路。

git clone https://github.com/wjakob/tbb.git
cd tbb/build
cmake ..
make -j
sudo make install




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?