[llvm-bugs] [Bug 43108] New: Add default include path and link libraries.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 25 04:48:58 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43108

            Bug ID: 43108
           Summary: Add default include path and link libraries.
           Product: parallel STL
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: New
          Assignee: ldionne at apple.com
          Reporter: alexej.h at xiphos.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 22424
  --> https://bugs.llvm.org/attachment.cgi?id=22424&action=edit
Build instructions for the LLVM toolchain.

When using a complete LLVM toolkit with ParallelSTL and TBB backend, you have
to add the include directory (always) and tbb library (when std::execution::par
is used) manually.

Since it is part of the standard library now, the include path should not be
added manually.

The '-ltbb' part is debatable and I totally understand why it can be a bad idea
to do it automatically.

Here is a minimal complete viable example:

  // main.cpp
  #include <algorithm>
  #include <execution>
  #include <iostream>
  #include <mutex>
  #include <vector>
  int main() {
    std::mutex mutex;
    std::vector<int> v = { 0, 1, 2, 3, 4 };
    std::for_each(std::execution::par, v.begin(), v.end(), [&](auto i) {
      std::lock_guard lock(mutex);
      std::cout << i << std::endl;
    });
  }

When compiled with 'clang++ main.cpp', the error is:

  In file included from main.cpp:2:
  In file included from /opt/llvm/bin/../include/c++/v1/algorithm:643:
  /opt/llvm/bin/../include/c++/v1/memory:5594:13: fatal error: '__pstl_memory'
file not found
  #   include <__pstl_memory>
              ^~~~~~~~~~~~~~~
  1 error generated.

When compiled with 'clang++ -I/opt/llvm/include main.cpp', the error is:

  ld.lld: error: undefined symbol:
tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&,
long)
  ...

It only works when compiled with 'clang++ -I/opt/llvm/include main.cpp -ltbb'.

Build instructions for the LLVM toolchain (git commit 918246788) used to test
it in WSL (Ubuntu 18.04.3 LTS) are attached to this bug report.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190825/35cc8cac/attachment.html>


More information about the llvm-bugs mailing list