Skip to contentSkip to conversation

xlib_libpthread-stubs: needs -pthread when linking statically

PATCH New Arnout Vandecappelle (Essensium/Mind) 2 participants 3 messages Feb 17, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xlib_libpthread-stubs: needs -pthread when linking statically

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

Fixes http://autobuild.buildroot.net/results/392512cb348123d76962df02e38675a80eae41b1

---
My gcc manual only documents the -pthread option for some architectures, but it seems to work for x86, sh and arm as well.

---
 package/x11r7/xlib_libpthread-stubs/xlib_libpthread-stubs.mk |    4 ++++
 1 file changed, 4 insertions(+)
package/x11r7/xlib_libpthread-stubs/xlib_libpthread-stubs.mk +4 -0
index 909253c..40d9a0b 100644
@@ -9,6 +9,10 @@ XLIB_LIBPTHREAD_STUBS_SITE = http://xcb.freedesktop.org/dist/
 
 XLIB_LIBPTHREAD_STUBS_INSTALL_STAGING = YES
 
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+XLIB_LIBPTHREAD_STUBS_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -pthread"
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 xlib_libpthread-stubs: needs -pthread when linking statically

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 8 lines · Arnout Vandecappelle (Essensium/Mind)

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

Fixes http://autobuild.buildroot.net/results/392512cb348123d76962df02e38675a80eae41b1

---
My gcc manual only documents the -pthread option for some architectures, but it seems to work for x86, sh and arm as well.

Thanks. However, I'd like to see if an upstream fix would not be more appropriate for this. If you look at the build log, it shows:

checking for pthread_self... no
checking for pthread_mutex_init... no
checking for pthread_mutex_destroy... no
checking for pthread_mutex_lock... no
checking for pthread_mutex_unlock... no
checking for pthread_cond_init... no
checking for pthread_cond_destroy... no
checking for pthread_condattr_init... no
checking for pthread_condattr_destroy... no
checking for pthread_cond_wait... no
checking for pthread_cond_timedwait... no
checking for pthread_cond_signal... no
checking for pthread_cond_broadcast... no
checking for pthread_equal... no
checking for pthread_exit... no

It is really those tests that are wrong I'd say. They should have detected that the C library provides the pthread functions.

The AC_CHECK_FUNCS test in configure.ac checks those functions, but does not specify that those functions should be tested by linking against -lpthread. Wouldn't an upstreamable configure.ac patch be more appropriate here?

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 xlib_libpthread-stubs: needs -pthread when linking statically

Quoted 32 lines · Thomas Petazzoni

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 8 lines · Arnout Vandecappelle (Essensium/Mind)

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

Fixes http://autobuild.buildroot.net/results/392512cb348123d76962df02e38675a80eae41b1

---
My gcc manual only documents the -pthread option for some architectures, but it seems to work for x86, sh and arm as well.

Thanks. However, I'd like to see if an upstream fix would not be more appropriate for this. If you look at the build log, it shows:

checking for pthread_self... no
checking for pthread_mutex_init... no
checking for pthread_mutex_destroy... no
checking for pthread_mutex_lock... no
checking for pthread_mutex_unlock... no
checking for pthread_cond_init... no
checking for pthread_cond_destroy... no
checking for pthread_condattr_init... no
checking for pthread_condattr_destroy... no
checking for pthread_cond_wait... no
checking for pthread_cond_timedwait... no
checking for pthread_cond_signal... no
checking for pthread_cond_broadcast... no
checking for pthread_equal... no
checking for pthread_exit... no

Quoted 7 lines

It is really those tests that are wrong I'd say. They should have detected that the C library provides the pthread functions.

The AC_CHECK_FUNCS test in configure.ac checks those functions, but does not specify that those functions should be tested by linking against -lpthread. Wouldn't an upstreamable configure.ac patch be more appropriate here?

Linking against -lpthread isn't enough, apparently.

Many packages use the ACX_PTHREAD macro [1]. That is probably a
possibility.

Regards,
Arnout

[1] http://ac-archive.sourceforge.net/ac-archive/acx_pthread.html

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F