Skip to contentSkip to conversation

tests: Use -pthread in CFLAGS instead of -lpthread

PATCH In review Tomasz Figa 2 participants 2 messages Jan 27, 2017 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Use -pthread in CFLAGS instead of -lpthread

-lpthread is not always a valid flag to pull pthread support, especially on Android it will fail to link due to a missing libpthread.so. The more generic way to build-in pthread support is to use the -pthread CFLAG, so let's use it instead.

---
 tests/exynos/Makefile.am   | 4 ++--
 tests/modetest/Makefile.am | 4 ++--
 tests/nouveau/Makefile.am  | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)
tests/exynos/Makefile.am +2 -2
index 357d6b8c..b6361727 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	-pthread \
 	$(WARN_CFLAGS)\
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)/libkms/ \
@@ -34,8 +35,7 @@ exynos_fimg2d_perf_LDADD = \
 
 exynos_fimg2d_event_LDADD = \
 	$(top_builddir)/libdrm.la \
-	$(top_builddir)/exynos/libdrm_exynos.la \
-	-lpthread
+	$(top_builddir)/exynos/libdrm_exynos.la
 
 exynos_fimg2d_test_LDADD = \
 	$(top_builddir)/libdrm.la \
tests/modetest/Makefile.am +2 -2
index 9686ccb9..4b296c83 100644
@@ -3,6 +3,7 @@ include Makefile.sources
 AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))
 
 AM_CFLAGS += \
+	-pthread \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
 	-I$(top_srcdir)
@@ -20,5 +21,4 @@ modetest_SOURCES = $(MODETEST_FILES)
 modetest_LDADD = \
 	$(top_builddir)/libdrm.la \
 	$(top_builddir)/tests/util/libutil.la \
-	$(CAIRO_LIBS) \
-	-lpthread
+	$(CAIRO_LIBS)
tests/nouveau/Makefile.am +2 -1
index c4f6e299..593acef0 100644
@@ -1,4 +1,5 @@
 AM_CPPFLAGS = \
+	-pthread \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/nouveau \
 	-I$(top_srcdir)
@@ -8,7 +9,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
 LDADD = \
 	../../nouveau/libdrm_nouveau.la \
 	../../libdrm.la \
-	-ldl -lpthread
+	-ldl
 
 TESTS = threaded
 
Signature · 6 lines
2.11.0.483.g087da7b7c-goog

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 5 lines · Tomasz Figa

-lpthread is not always a valid flag to pull pthread support, especially on Android it will fail to link due to a missing libpthread.so. The more generic way to build-in pthread support is to use the -pthread CFLAG, so let's use it instead.

Afaict this might cause an issue on BSD/Solaris platforms, but afaict neither of which builds the code in question.
With that said I'll land this shortly.

Whist looking through Solaris repos, there's a lot of patches/workarounds many of which should be fine to land - be that on Mesa and/or libdrm side.
Randy, Niveditha can I interest you in sending patches upstream as soon as you [others in the team] spot issues ? Even if you think that they're hacks/will be rejected/etc. Please ?
Adding note for each patch why it's not in is a very good idea ;-)

Note - if you need GNU_MAKE, extra defines, etc. workarounds that's a giveaway that something on our end is broken. Please report and/or send us patches.

Thanks !
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel