<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add default include path and link libraries."
   href="https://bugs.llvm.org/show_bug.cgi?id=43108">43108</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add default include path and link libraries.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>parallel STL
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>New
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>ldionne@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alexej.h@xiphos.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22424" name="attach_22424" title="Build instructions for the LLVM toolchain.">attachment 22424</a> <a href="attachment.cgi?id=22424&action=edit" title="Build instructions for the LLVM toolchain.">[details]</a></span>
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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>