All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: "Zoltán Füzesi" <zfuzesi@eaglet.hu>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: threaded-grep cause msys build failure
Date: Fri, 29 Jan 2010 13:03:55 +0100	[thread overview]
Message-ID: <4B62CEAB.5050608@viscovery.net> (raw)
In-Reply-To: <9ab80d151001290227u386616c5o6c825ff10d37f9fd@mail.gmail.com>

Zoltán Füzesi schrieb:
> Building git in msys environment fails:
> ...
>     LINK git.exe
> builtin-grep.o: In function `wait_all':
> D:\devel\msysgit\git/builtin-grep.c:260: undefined reference to
> `pthread_cond_broadcast'

Use this. I'll try to find a better solution over the weekend.

diff --git a/Makefile b/Makefile
index c591d70..bbee373 100644
--- a/Makefile
+++ b/Makefile
@@ -183,6 +183,9 @@ all::
 # Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
 # parallel delta searching when packing objects.
 #
+# Define THREADED_GREP if you have pthreads and wish to exploit a
+# parallelized grep.
+#
 # Define INTERNAL_QSORT to use Git's implementation of qsort(), which
 # is a simplified version of the merge sort used in glibc. This is
 # recommended if Git triggers O(n^2) behavior in your platform's qsort().
@@ -723,11 +726,13 @@ ifeq ($(uname_S),Linux)
 	NO_STRLCPY = YesPlease
 	NO_MKSTEMPS = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 endif
 ifeq ($(uname_S),GNU/kFreeBSD)
 	NO_STRLCPY = YesPlease
 	NO_MKSTEMPS = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 endif
 ifeq ($(uname_S),UnixWare)
 	CC = cc
@@ -782,6 +787,7 @@ ifeq ($(uname_S),Darwin)
 	endif
 	NO_MEMMEM = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 	USE_ST_TIMESPEC = YesPlease
 endif
 ifeq ($(uname_S),SunOS)
@@ -795,6 +801,7 @@ ifeq ($(uname_S),SunOS)
 	NO_MKSTEMPS = YesPlease
 	NO_REGEX = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 	ifeq ($(uname_R),5.7)
 		NEEDS_RESOLV = YesPlease
 		NO_IPV6 = YesPlease
@@ -851,6 +858,7 @@ ifeq ($(uname_S),FreeBSD)
 	DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 	USE_ST_TIMESPEC = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 	ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
 		PTHREAD_LIBS = -pthread
 		NO_UINTMAX_T = YesPlease
@@ -865,6 +873,7 @@ ifeq ($(uname_S),OpenBSD)
 	BASIC_CFLAGS += -I/usr/local/include
 	BASIC_LDFLAGS += -L/usr/local/lib
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 endif
 ifeq ($(uname_S),NetBSD)
 	ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
@@ -873,6 +882,7 @@ ifeq ($(uname_S),NetBSD)
 	BASIC_CFLAGS += -I/usr/pkg/include
 	BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 	USE_ST_TIMESPEC = YesPlease
 	NO_MKSTEMPS = YesPlease
 endif
@@ -889,6 +899,7 @@ ifeq ($(uname_S),AIX)
 	BASIC_CFLAGS += -D_LARGE_FILES
 	ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
 		THREADED_DELTA_SEARCH = YesPlease
+		THREADED_GREP = YesPlease
 	else
 		NO_PTHREADS = YesPlease
 	endif
@@ -916,6 +927,7 @@ ifeq ($(uname_S),IRIX)
 	SHELL_PATH = /usr/gnu/bin/bash
 	NEEDS_LIBGEN = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 endif
 ifeq ($(uname_S),IRIX64)
 	NO_SETENV=YesPlease
@@ -935,6 +947,7 @@ ifeq ($(uname_S),IRIX64)
 	SHELL_PATH=/usr/gnu/bin/bash
 	NEEDS_LIBGEN = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
+	THREADED_GREP = YesPlease
 endif
 ifeq ($(uname_S),HP-UX)
 	NO_IPV6=YesPlease
@@ -1334,6 +1347,7 @@ endif

 ifdef NO_PTHREADS
 	THREADED_DELTA_SEARCH =
+	THREADED_GREP =
 	BASIC_CFLAGS += -DNO_PTHREADS
 else
 	EXTLIBS += $(PTHREAD_LIBS)
@@ -1341,6 +1355,11 @@ endif

 ifdef THREADED_DELTA_SEARCH
 	BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
+endif
+ifdef THREADED_GREP
+	BASIC_CFLAGS += -DTHREADED_GREP
+endif
+ifneq (,$(THREADED_GREP)$(THREADED_DELTA_SEARCH))
 	LIB_OBJS += thread-utils.o
 endif
 ifdef DIR_HAS_BSD_GROUP_SEMANTICS
diff --git a/builtin-grep.c b/builtin-grep.c
index 9bd467c..911d0da 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -16,7 +16,7 @@
 #include "quote.h"
 #include "dir.h"

-#ifndef NO_PTHREADS
+#ifdef THREADED_GREP
 #include "thread-utils.h"
 #include <pthread.h>
 #endif
@@ -28,7 +28,7 @@ static char const * const grep_usage[] = {

 static int use_threads = 1;

-#ifndef NO_PTHREADS
+#ifdef THREADED_GREP
 #define THREADS 8
 static pthread_t threads[THREADS];

@@ -274,7 +274,7 @@ static int wait_all(void)

 	return hit;
 }
-#else /* !NO_PTHREADS */
+#else /* THREADED_GREP */
 #define read_sha1_lock()
 #define read_sha1_unlock()

@@ -439,7 +439,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1,

 	name = strbuf_detach(&pathbuf, NULL);

-#ifndef NO_PTHREADS
+#ifdef THREADED_GREP
 	if (use_threads) {
 		grep_sha1_async(opt, name, sha1);
 		return 0;
@@ -501,7 +501,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
 		strbuf_addstr(&buf, filename);
 	name = strbuf_detach(&buf, NULL);

-#ifndef NO_PTHREADS
+#ifdef THREADED_GREP
 	if (use_threads) {
 		grep_file_async(opt, name, filename);
 		return 0;
@@ -902,7 +902,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	if ((opt.regflags != REG_NEWLINE) && opt.fixed)
 		die("cannot mix --fixed-strings and regexp");

-#ifndef NO_PTHREADS
+#ifdef THREADED_GREP
 	if (online_cpus() == 1 || !grep_threads_ok(&opt))
 		use_threads = 0;

-- 
1.7.0.rc0.1096.g3300c.dirty

  reply	other threads:[~2010-01-29 12:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 10:27 threaded-grep cause msys build failure Zoltán Füzesi
2010-01-29 12:03 ` Johannes Sixt [this message]
2010-01-29 19:26   ` [RFC/PATCH] MSVC: Windows-native implementation of pthread_cond_broadcast Zoltán Füzesi
2010-01-29 20:02     ` Johannes Sixt
2010-01-29 22:16       ` [PATCH] Windows: a minimal pthread_cond_broadcast Johannes Sixt
2010-01-29 23:54         ` [PATCH] Implement pthread_cond_broadcast on Windows Johannes Sixt
2010-01-30  2:28           ` Johannes Schindelin
2010-01-30  9:30             ` Johannes Sixt
2010-01-30 10:50               ` Johannes Schindelin
2010-01-29 20:13     ` [RFC/PATCH] MSVC: Windows-native implementation of pthread_cond_broadcast Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B62CEAB.5050608@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=zfuzesi@eaglet.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.