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: unassignedb...@nondot.org
          Reporter: mh+l...@glandium.org
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to