From: Victor Leschuk Date: Wed, 14 Oct 2015 11:24:03 GMT Subject: RE: thread-utils: build with NO_PTHREADS fails Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE5D0FDAB9ED@mail.accesssoftek.com> In-Reply-To: Hello Junio, sorry that was my fault, I was building it wrong way (defined NO_PTHREADS in CFLAGS variable, not as separate make variable). Sorry for the false alarm. -- Best Regards, Victor ________________________________________ From: Junio C Hamano [jch2355@gmail.com] On Behalf Of Junio C Hamano [gitster@pobox.com] Sent: Monday, October 12, 2015 10:55 AM To: Victor Leschuk Cc: git@vger.kernel.org; vleschuk@gmail.com Subject: Re: thread-utils: build with NO_PTHREADS fails Junio C Hamano writes: > Victor Leschuk writes: > >> I think that no one tried it for a long time but I needed a >> single-threaded git version for debug purpose. I tried to build >> with -DNO_PTHREADS and thread-utils.c failed to compile. >> >> In brief the situation is the following: >> >> in header file we have something like that: >> >> >> #ifndef NO_PTHREAD >> extern int online_cpus(void); >> >> #else >> #define online_cpus() 1 >> #endif // NO_PTHREAD >> >> and in *.c file: >> >> >> int online_cpus(void) >> { >> // ... >> } > > Yeah, that is obviously incorrect. > ... Well, no, I spoke too early. I do not see there is much wrong here. There is this bit in the Makefile: ifdef NO_PTHREADS BASIC_CFLAGS += -DNO_PTHREADS else BASIC_CFLAGS += $(PTHREAD_CFLAGS) EXTLIBS += $(PTHREAD_LIBS) LIB_OBJS += thread-utils.o endif The source file thread-utils.c is not compiled to thread-utils.o if you say NO_PTHREADS, and the resulting libgit.a does not of course have it.