[llvm-bugs] [Bug 40796] New: -pthread should pass -lpthread to the linker

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 20 21:25:19 PST 2019


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

            Bug ID: 40796
           Summary: -pthread should pass -lpthread to the linker
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mh+llvm at glandium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Apparently something changed in clang 9, that made -pthread not do anything
during linkage, per
https://gn.googlesource.com/gn/+/082fbe397d5217dc21b01c63c7f20eb6b77a3093%5E%21/#F0
:

     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:

https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options

-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.

-- 
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/20190221/e155d8f6/attachment.html>


More information about the llvm-bugs mailing list