[Solved] Xamarin.Mac: error MM5109 in release build related to IKImageBrowserDataSource

intvsteveintvsteve USMember ✭✭
edited May 2017 in Xamarin.Mac

With some extremely valuable help, some time back I moved a solution that has 9 projects - over half of which were using MonoMac - to Xamarin.Mac. "Real Life" got in the way for a bit, so now, almost 8 months later, I picked it back up.

The debug build of the application builds and seems to run just fine. However, the release build fails. Here's the important part:

            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:42620:64: error: no type or protocol named 'IKImageBrowserDataSource'
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:91: error: unknown class name 'IKImageBrowserItem'; did you mean 'IKImageBrowserView'?
            /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserCell.h:19:8: note: 'IKImageBrowserView' declared here
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:91: error: type argument 'IKImageBrowserView' must be a pointer (requires a '*')
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:82: error: type arguments cannot be applied to non-parameterized class 'NSObject'

    MMP: error MM5109: Native linking failed with error code 1.  Check build log for details.

The class that implements IKImageBrowserDataSource is in a separate assembly, and is a private implementation class nested within a public class. I've tried moving the class out as a separate public entity, but it does not seem to make a difference.

Still need to work through the other two posts I found about this error to see if there's a common way to fix this. Looking at the mml-cache directories, it would seem the trouble lies with the registrar.m / registrar.h somewhere?

Also: I have not yet tried to load and build in Visual Studio for Mac - this is using the most recent Xamarin Studio Community and latest updates to Xcode, macOS Sierra, et. al.

Thanks!

Posts

  • intvsteveintvsteve USMember ✭✭
    edited May 2017

    @ChrisHamons to the rescue again! Looking over the release notes, it seems that they have a slight error.

    I got my build to work by adding this to 'Additional map arguments':

    --registrar=dynamic
    

    The release notes mention using --registrar=default but I suspect that, since the default for release builds changed to static that it would not help if you needed to change the behavior. ;)

    Chris' blog post does tell you to use --registrar=dynamic :)

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    Good catch. I've updated the release notes (will take a bit to refresh in production).

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    Could you please consider filing a bug with the relevant C# attached? In theory "it should just work" :)

  • intvsteveintvsteve USMember ✭✭

    I'll pull changes over to GitHub, then file.

  • intvsteveintvsteve USMember ✭✭
    edited June 2017

    UPDATE:
    A new wrinkle here...

    It turns out that what I had were a pair of "dead code" classes. One subclassed IKImageBrowserDataSource, the other subclassed IKImageBrowserItem. Most likely these are from an abandoned feature -- or one that was somewhat-pseudo-coded and never finished. (The classes throw NotImplemented for all their methods.)

    Neither of these types were ever instantiated anywhere in the program!

    Once I excluded the code for these types from the release build, it succeeded, even with --registrar=static.

    This was with Xamarin Studio using xbuild. I could reproduce the linker error in VS.Mac, too -- so I fully expect the same result when building there, too.

    The moral of the story is: Don't have classes you don't use?

    Reported: https://bugzilla.xamarin.com/show_bug.cgi?id=57030

  • ThomasFlemmingThomasFlemming DEMember ✭✭

    Thanks for this, just run into the same issue.
    Adding --registrar=dynamic keeps me going on :)

Sign In or Register to comment.