V2 Link failure: works on simulator, not on iPhone


I’ve just completed the switchover to CBL 2.
My app is now working perfectly in the simulator. However I just tried compiling for my devices, and I’m getting a weird error:

Error MT5216: Native linking failed for '/Users/Paul/Project/obj/iPhone/Debug/device-builds/iphone10.6-12.1.3/mtouch-cache/arm64/libCouchbase.Lite.Support.iOS.dll.dylib'. Please file a bug report at http://bugzilla.xamarin.com (MT5216) (Project)

I’m compiling on a Mac using Visual Studio, targeting an iPhone. Everything is on the latest version (I’m a compulsive updater).

Has anyone seen this before? A search on google has shown some linking options that I could change, but that hasn’t helped. There doesn’t seem to be any mention of it on this forum.

Many thanks.

That error is probably the last in a line of other errors that would be relevant here. My guess is that somehow it is failing to link with LiteCore.framework which is included in the nuget package. I have not seen this error myself though. Did you add both Couchbase.Lite and the support package to your project? If so it is important that they are the same version (it’s better to just add Couchbase.Lite since it will pull down support as a dependency).

Actually I am getting it now too. I am starting to suspect some issue with Xamarin’s toolset. I can’t retrieve any update information for Visual Studio, and I have messages like this in my build window:

Your mono runtime and class libraries are out of sync.
The out of sync library is: /Users/borrrden/Development/couchbase-lite-net-ee/couchbase-lite-net/src/Couchbase.Lite.Tests.iOS/obj/iPhone/Debug/device-builds/iphone8.2-11.0/mtouch-cache/3-Build/Xamarin.iOS.dll

When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you’re sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.

I know this looked familiar… I never did get an answer from Xamarin last time (I assume an update must have fixed it or I would have remembered something else) https://forums.xamarin.com/discussion/139054/what-do-i-have-to-do-to-use-a-native-reference-from-a-nuget-package?

EDIT AH HA, I finally retraced my steps -> https://github.com/xamarin/xamarin-macios/issues/4823

That was it! Thank you.
TLDR: (for others) turn incremental builds off.