[Openmcl-devel] ffigen4 failing on Mac OS 10.10 (with either SDK)

Christopher Wicklein chrisw at wicklein.org
Thu Nov 20 08:21:35 PST 2014


My high-level goal is to manage OmniFocus via Scripting Bridge.  Starting from the outline at https://lists.clozure.com/pipermail/openmcl-devel/2008-October/004375.html and http://trac.clozure.com/ccl/wiki/BuildFFIGEN, I’ve done as follows:

(1) Install CCL from the App Store (1.10-store-r16266)

(2) Build what I understand to be the latest ffigen (branches/ffigen-apple-gcc-5646/ffigen4.)  As an aside, to build ffigen, I incorporated two patches into my personal build process.  I’m working around what I remember as multiple definitions of the “inline” functions when building ffigen4 with the standard clang-600.0.54.  I’ve omitted the Makefile patch which is used to add my patch to the list of existing patches.  Here’s the patch to toplev.h:

--- toplev.h	2007-10-24 12:15:57.000000000 -0500
+++ toplev.h.1	2014-11-19 15:47:43.000000000 -0600
@@ -158,7 +158,7 @@
 extern int floor_log2                  (unsigned HOST_WIDE_INT);
 /* Inline versions of the above for speed.  */
-#if GCC_VERSION >= 3004
+#if 0 /* GCC_VERSION >= 3004 */
 #  define CLZ_HWI __builtin_clzl
 #  define CTZ_HWI __builtin_ctzl

(3) Build OmniFocus.h:

sdef /Applications/OmniFocus.app | sdp -fh --basename OmniFocus
mv OmniFocus.h /tmp/

(4) Create /Applications/Clozure CL.app/Contents/Resources/ccl/darwin-x86-headers64/omnifocus/C and put populate.sh there.

rm -rf System Developer usr
CFLAGS="-m64 -fobjc-abi-version=2 -fblocks -isysroot $SDK -mmacosx-version-min=10.9"; export CFLAGS
/opt/ffigen/bin/h-to-ffi.sh /tmp/OmniFocus.h

Depending on whether I set SDK to "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk” or SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk”, I get two different failure cases.  The 10.9 case involves ffigen segfaulting.  The 10.10 case involves a recent change adding the type “instancetype" to Objective-C where I think the previous type was simply “id” confusing the compiler.


In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:55,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10,
                 from /tmp/OmniFocus.h:5:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProcessInfo.h:169: internal compiler error: Segmentation fault: 11


/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/objc/NSObject.h:64: error: expected ‘)’ before ‘instancetype’
Need to create info for type:
 <real_type 0xd7c4d0 NSTimeInterval sizes-gimplified DF
    size <integer_cst 0x41b04930 type <integer_type 0x41b13070 bit_size_type> constant invariant 64>
    unit size <integer_cst 0x41b04960 type <integer_type 0x41b13000 long unsigned int> constant invariant 8>
    align 64 symtab 1808 alias set -1 precision 64>
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSDate.h:23: confused by earlier errors, bailing out



Christopher Wicklein <chrisw at wicklein.org>

More information about the Openmcl-devel mailing list