This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: other/8888: Linking shared libraries with -pthread fails tolink to libpthread
- From: Sebastian Wilhelmi <wilhelmi at ira dot uka dot de>
- To: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: 10 Dec 2002 15:31:02 +0100
- Subject: Re: other/8888: Linking shared libraries with -pthread fails tolink to libpthread
- Organization: Universität Karlsruhe
- References: <20021210141354.6637.qmail@sources.redhat.com>
Hi,
> Synopsis: Linking shared libraries with -pthread fails to link to libpthread
>
> State-Changed-From-To: open->feedback
> State-Changed-By: bangerth
> State-Changed-When: Tue Dec 10 06:13:52 2002
> State-Changed-Why:
> I fail to see the reasoning behind the report: what is wrong
> with passing -lpthread to the linker line? The -pthread
> changes some things when compiling (as far as I understand,
> for example the initialization of static variables), so
> has nothing to do with what libraries are linked. You
> would want to specify this separately. Why is this bad?
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8888
the man page for gcc-3.2 says:
-pthread
Adds support for multithreading with the pthreads library.
This option sets flags for both the preprocessor and linker.
So we consider -pthread in GLib the preferred way to indicate, that a
program or library is multithreaded. We use it both for linking and
compiling programs and libraries. I got the impression, that also gcc
consideres using -pthread superior to using -D_REENTRANT and -lpthread.
Also for non-shared binaries gcc does the right thing now, but not for
shared objects, why is that?
Bye,
Sebastian
P.S.: I have no write access to GNATS, so I could only write this
e-mail, or is there some way to attach that message to the bug report?
--
Sebastian Wilhelmi
mailto:wilhelmi@ira.uka.de
http://goethe.ira.uka.de/~wilhelmi