Skip to content

Commit

Permalink
Don't pass -pthread to the linker on OS X.
Browse files Browse the repository at this point in the history
The -pthread option is noop with GCC on Darwin, because the necessary
runtime is included in libSystem; GCC silently accepts it for
cross-platform compatibility.

Unfortunately, Clang does not and issues a warning:
clang: warning: argument unused during compilation: '-pthread'

This is arguably a bug in Clang -- see
http://llvm.org/bugs/show_bug.cgi?id=7798. But since the bug was filed
almost three years ago and nobody got around to fixing it yet, it seems
prudent to just tweak the gnu-osx toolset accordingly. Fortunately, gcc
still works just fine without -pthread, so the fix is simple enough.
  • Loading branch information
vslavik committed Jun 26, 2013
1 parent 45b8dba commit 1246576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bkl/plugins/gnu.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _linker_flags(self, toolset, target):
cmd += target.type.get_link_options(target)
if toolset.extra_link_flags:
cmd.append(LiteralExpr(toolset.extra_link_flags))
if target["multithreading"]:
if toolset.pthread_ld_flags and target["multithreading"]:
cmd.append(LiteralExpr(toolset.pthread_ld_flags))
return cmd

Expand Down Expand Up @@ -436,6 +436,7 @@ class OSXGnuToolset(GnuToolset):

pic_flags = None
soname_flags = None
pthread_ld_flags = None

def on_footer(self, file, module):
for t in module.targets.itervalues():
Expand Down

0 comments on commit 1246576

Please sign in to comment.