Problem compiling on Mac OS X


when i try to compile the libraw 0.16.0-beta1 under Mac OS X 10.6 with gcc 4.2 i get the following error:

'__sync_add_and_fetch' could not be found

Do i need a higher gcc? Did i miss any define?

Would be great, if somebody has an idea :)

Kind regards,


According to gcc 4.1 manual,

According to gcc 4.1 manual, __sync_add_and fetch is builtin for this version, so it should works on 4.2 too.

I have not old Xcode on hands, only Xcode4/Xcode5 (llvm based), but this code compiles and links fine on my FreeBSD with gcc 4.2.1 (in both 32-bit and 64-bit mode):

int main()
 int _exitflag=0;
 if( __sync_add_and_fetch(&_exitflag,0))
        return 1;
 return 0;

May be, you need to specify processor target (-march=core2duo because OS X requires at least core2duo)

-- Alex Tutubalin @LibRaw LLC