[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-threads
Subject:    Re: Segfault from libthr.so.
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2014-09-28 8:32:46
Message-ID: 20140928083246.GA26076 () kib ! kiev ! ua
[Download RAW message or body]

On Sun, Sep 28, 2014 at 12:49:21AM +0300, Raphael Kubo da Costa wrote:
> Konstantin Belousov <kostikbel@gmail.com> writes:
> 
> >> In my app, i dont directly start any thread, lower libs do. So it
> >> doesnt seem logical to add -lpthread before declaring the deps. So
> >> should i just remove this m4 macro that seems to be use on quite some
> >> projects, so it works on BSD ?
> >>
> >> What is the best way to do it, in your opinion ?
> >
> > Just put -lpthread last in the command line (automake variable) for linker.
> > This should work portable on all systems I know.
> 
> Alternatively, you could pass -pthread instead of -lpthread: the
> compiler should then take care of passing -lpthread in the right
> position -- it's what we use in the ports tree, for example.

As far as you checked that compiler accepts this flag and does what you
think the compiler should do.  I believe that -pthread is only supported
by (some configurations of) gcc and compilers which try to sincerely
copy the gcc behaviour, i.e. clang.  AFAIR, native Unix compilers,
e.g. SunPro, and possibly even icc, do not support the -pthread.

In other words, -lpthread is more portable, which does not matter for
ports, where only gcc and clang are target compilers, but important
for generic autoconfigured source.
_______________________________________________
freebsd-threads@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic