[Computer-go] pachi: how to build?

Hideki Kato hideki_katoh at ybb.ne.jp
Fri Apr 15 18:58:34 PDT 2011

Petr Baudis: <20110415190047.GH25968 at machine.or.cz>:
>  Hi!
>On Sat, Apr 16, 2011 at 12:23:53AM +0900, Hideki Kato wrote:
>> Petr Baudis: <20110415133748.GW3258 at machine.or.cz>:
>> <cut>
>> >> Jay:pachi 2 jonathanchetwynd$  make MAC=1
>> >..snip..
>> >> [LINK] zzgo
>> >> Undefined symbols:
>> >>   "___sync_fetch_and_add", referenced from:
>> >>   "___sync_synchronize", referenced from:
>> >>   "___sync_fetch_and_sub", referenced from:
>> >>   "___sync_lock_test_and_set", referenced from:
>> >> ld: symbol(s) not found
>> >> collect2: ld returned 1 exit status
>> >> make: *** [zzgo] Error 1
>> >
>> >  These intrinsics are provided by gcc 4.1 and newer, but your cc does
>> >not appear to provide them. Just out of interest, is that gcc and what
>> >is it's version? (cc --version)
>> That's not the version of gcc issue but the processor.  PowerPC has 
>> another type of atomic operations than x86.
>  Yes, but surely it supports these atomic operations? The point of
>these intrinsics should be to provide processor-indepentent interface
>(originally, they were Intel-specified IA64 intrinsics).
>  (But maybe you are right if you mean that gcc may not have these
>implemented for ppc in the version shipped along MacOS/X - but which
>version of MacOSX are we talking about again anyway?)

Historically, Apple provides much older gcc with their OS and the 
active users have to install recent gcc by theirselves with many 
trubles :(.

>> I'd like to add:
>> (iv) Use atomic operation library (libatomic_ops) 
>> (http://www.hpl.hp.com/research/linux/atomic_ops/download.php4), 
>> which provides much more portability.
>  If we care only about gcc, ideally the __sync_*() primitives should
>work on all supported targets in new enough versions; also, this would
>add another extra dependency. So it's a tradeoff. If someone is willing
>to contribute patches that won't make building Pachi on Linux more
>difficult and will add support for more targets, I'll be very happy. :-)

Ah, recent gcc's intrinsics for atomic operations support powerpc as 
well as x86.  But AFAIK Apple's default gcc is not so new.  Above 
library already supports gcc/linux on many processors and vc/windows 
on x86.

>> >random.c:10: error: thread-local storage not supported for this target
>> I guess you have to make PRNGs (pesudo random number generators) 
>> thread-safe _without_ TLS (thread-local storage) because GCC for 
>> PowerPC does not support TLS.
>  This particular problem we have already solved in our tree, it was
>just the issue with forgotten MAC=1. We have to make the build system
>more friendly for newcomers. :-)

I see, thanks.

Hideki Kato <mailto:hideki_katoh at ybb.ne.jp>

More information about the Computer-go mailing list