Bug 30968

Summary: Cairo won't build on Win32 because there is no ffs function
Product: cairo Reporter: Neil Roberts <nroberts>
Component: win32 backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED DUPLICATE QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: 11285613
Version: 1.10.1   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: win32: Add a workaround for missing ffs on MinGW

Description Neil Roberts 2010-10-18 10:30:59 UTC
Windows doesn't seem to provide an ffs function so I can't get Cairo to build. It looks like ffs is only used when the Intel atomic primitives are available so maybe this isn't affecting everyone.
Comment 1 Neil Roberts 2010-10-18 10:32:01 UTC
Created attachment 39510 [details] [review]
win32: Add a workaround for missing ffs on MinGW

On Windows it seems that msvcrt does not define an ffs function. There
is already a workaround for MSVC in cairo-compiler-private.h but this
does not help when compiling with MinGW. This patch adds an extra
check for when targetting Windows with GCC and makes it use
__builtin_ffs.
Comment 2 Martin Schlemmer 2010-11-01 06:50:34 UTC
I'm not too familiar with Cygwin, but not sure if the condition should be only for GCC and Win32:

#if defined(__GNUC__) && defined(__WIN32__)

Might be better to check for MinGW specifically, and also do a check that we do not have a ffs() implementation:

#if defined(__MINGW32__) && !defined(HAVE_FFS)
Comment 3 Adrian Johnson 2010-11-01 15:28:29 UTC

*** This bug has been marked as a duplicate of bug 30277 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.