difference between "g++ -pthread" and "g++ -lpthread"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 I'm hunting some race condition in my plugins which produce a segfault in libc or libavahi (still searching the right
packages with debug symbols, race condition may be related to having to dbus-mainloops in dbus2vdr and avahi4vdr, but I
don't know yet).
 While investigating this I found something about the option "-pthread" of g++.

 According to g++'s manpage this will set the right options for the preprocessor and compiler so the program can use the
pthreads lib. Especially it will set -D_REENTRANT and -lpthread etc.

 vdr seems only to use -lpthread and no other pthread-specific options.

 I'm not an expert on this topic, so I would like to know if someone can shed some light on this.
 Makefile may than be patched with:

==========
--- a/Makefile
+++ b/Makefile
@@ -14,12 +14,12 @@
 CFLAGS   ?= -g -O3 -Wall

 CXX      ?= g++
-CXXFLAGS ?= -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -pthread

 CDEFINES  = -D_GNU_SOURCE
 CDEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

-LIBS      = -ljpeg -lpthread -ldl -lcap -lrt $(shell pkg-config --libs freetype2 fontconfig)
+LIBS      = -ljpeg -ldl -lcap -lrt $(shell pkg-config --libs freetype2 fontconfig)
 INCLUDES ?= $(shell pkg-config --cflags freetype2 fontconfig)

 # Directories:
==========

 Recompiled vdr and plugins do run as before (haven't solved my segfault).

 What do you think?

Lars.

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr




[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux