diff mbox series

[ovs-dev] configure: Check for more specific function to pull in pthread library.

Message ID 20181115162552.22012-1-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev] configure: Check for more specific function to pull in pthread library. | expand

Commit Message

Ben Pfaff Nov. 15, 2018, 4:25 p.m. UTC
On my laptop, pthread_create() is always available without -lpthread, but
when I use -fsanitize=address, -lpthread is required to pull in other
threading functions such as pthread_rwlock_tryrdlock().  Thus, with
-fsanitize=address I have to manually add -lpthread to link commands one
way or another.  This commit avoids that problem by checking for a
function that is sometimes only available in -lpthread.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yifeng Sun Nov. 19, 2018, 7:40 p.m. UTC | #1
Thanks for the fix.

Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>

On Thu, Nov 15, 2018 at 8:59 AM Ben Pfaff <blp@ovn.org> wrote:

> On my laptop, pthread_create() is always available without -lpthread, but
> when I use -fsanitize=address, -lpthread is required to pull in other
> threading functions such as pthread_rwlock_tryrdlock().  Thus, with
> -fsanitize=address I have to manually add -lpthread to link commands one
> way or another.  This commit avoids that problem by checking for a
> function that is sometimes only available in -lpthread.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index bb726f89e251..3e97a750c812 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -77,7 +77,7 @@ AC_SUBST([LT_AGE])
>  AC_SEARCH_LIBS([pow], [m])
>  AC_SEARCH_LIBS([clock_gettime], [rt])
>  AC_SEARCH_LIBS([timer_create], [rt])
> -AC_SEARCH_LIBS([pthread_create], [pthread])
> +AC_SEARCH_LIBS([pthread_rwlock_tryrdlock], [pthread])
>  AC_FUNC_STRERROR_R
>
>  OVS_CHECK_ESX
> --
> 2.16.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ben Pfaff Nov. 19, 2018, 8:29 p.m. UTC | #2
Thanks, I applied this to master.

On Mon, Nov 19, 2018 at 11:40:23AM -0800, Yifeng Sun wrote:
> Thanks for the fix.
> 
> Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
> Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
> 
> On Thu, Nov 15, 2018 at 8:59 AM Ben Pfaff <blp@ovn.org> wrote:
> 
> > On my laptop, pthread_create() is always available without -lpthread, but
> > when I use -fsanitize=address, -lpthread is required to pull in other
> > threading functions such as pthread_rwlock_tryrdlock().  Thus, with
> > -fsanitize=address I have to manually add -lpthread to link commands one
> > way or another.  This commit avoids that problem by checking for a
> > function that is sometimes only available in -lpthread.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  configure.ac | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index bb726f89e251..3e97a750c812 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -77,7 +77,7 @@ AC_SUBST([LT_AGE])
> >  AC_SEARCH_LIBS([pow], [m])
> >  AC_SEARCH_LIBS([clock_gettime], [rt])
> >  AC_SEARCH_LIBS([timer_create], [rt])
> > -AC_SEARCH_LIBS([pthread_create], [pthread])
> > +AC_SEARCH_LIBS([pthread_rwlock_tryrdlock], [pthread])
> >  AC_FUNC_STRERROR_R
> >
> >  OVS_CHECK_ESX
> > --
> > 2.16.1
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index bb726f89e251..3e97a750c812 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,7 +77,7 @@  AC_SUBST([LT_AGE])
 AC_SEARCH_LIBS([pow], [m])
 AC_SEARCH_LIBS([clock_gettime], [rt])
 AC_SEARCH_LIBS([timer_create], [rt])
-AC_SEARCH_LIBS([pthread_create], [pthread])
+AC_SEARCH_LIBS([pthread_rwlock_tryrdlock], [pthread])
 AC_FUNC_STRERROR_R
 
 OVS_CHECK_ESX