<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 - -pthread should pass -lpthread to the linker"
href="https://bugs.llvm.org/show_bug.cgi?id=40796">40796</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-pthread should pass -lpthread to the linker
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mh+llvm@glandium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Apparently something changed in clang 9, that made -pthread not do anything
during linkage, per
<a href="https://gn.googlesource.com/gn/+/082fbe397d5217dc21b01c63c7f20eb6b77a3093%5E%21/#F0">https://gn.googlesource.com/gn/+/082fbe397d5217dc21b01c63c7f20eb6b77a3093%5E%21/#F0</a>
:
clang-9: warning: argument unused during compilation: '-pthread'
[-Wunused-command-line-argument]
ld.lld: error: undefined symbol: pthread_create
>>> referenced by worker_pool.cc
>>> util/worker_pool.o:(WorkerPool::WorkerPool(unsigned
long)) in archive gn_lib.a
However, -pthread *is* meant to add -lpthread during linkage, per GCC
documentation:
<a href="https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options">https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options</a>
-pthread
Link with the POSIX threads library. This option is supported on GNU/Linux
targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets.
On some targets this option also sets flags for the preprocessor, so it should
be used consistently for both compilation and linking.</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>