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

Christopher Wicklein chrisw at wicklein.org
Fri Nov 21 16:21:02 PST 2014


I’ve resolved these problems as follows:

(1) Grab the 10.8 SDK from an earlier Xcode release and install it along side the 10.9 and 10.10 SDKs (earlier Xcode releases are still available for download from Apple.)

(2) Specify the 10.8 SDK in populate.sh.

(3) The resulting ffigen pukes on its math.h, so I defined “__header_always_inline” as nothing, ifdef’d out a bunch of (mostly) legacy BSD inline function declarations, and I was finally able to process OmniFocus.h (after removing a duplicate declaration of the property “container” in one of its classes.)  Every SDK (10.8, 10.9, and 10.10) resulted in some kind of problem for ffigen, but the problems associated with 10.8 were the easiest to address.  Ugly, but it worked.

For the benefit of anyone who is reading this after a Google search, it turns out that the bundle name for OmniFocus2 (from the App Store) is "com.omnigroup.OmniFocus2.MacAppStore” — not simply “”com.omnigroup.OmniFocus2” as most sources suggest.

? (objc:load-framework "ScriptingBridge" :omnifocus)
NIL
? (defvar *omnifocus-app* (make-instance 'ns:s-b-application :with-bundle-identifier #@"com.omnigroup.OmniFocus2.MacAppStore"))
*OMNIFOCUS-APP*
? *omnifocus-app*
#<OMNI-FOCUS-APPLICATION <OmniFocusApplication @0x608000a46cf0: application "OmniFocus" (17071)> (#x608000A46CF0)>
? (#/buildNumber *omnifocus-app*)
#<NS-MUTABLE-STRING "87.15" (#x608000624340)>

----
Christopher Wicklein <chrisw at wicklein.org>



> On Nov 20, 2014, at 10:21 AM, Christopher Wicklein <chrisw at wicklein.org> wrote:
> 
> Greetings,
> 
> 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 */
> # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
> #  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.
> 
> #!/bin/bash
> rm -rf System Developer usr
> SDK="$SDK"
> 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.
> 
> 10.9:
> 
> 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
> 
> 10.10:
> 
> /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
> 
> Thoughts?
> 
> Thanks,
> Chris
> 
> ----
> Christopher Wicklein <chrisw at wicklein.org>
> 
> 
> 




More information about the Openmcl-devel mailing list