Efcore: Xamarin Forms iOS build error MT5214: Native linking failed, undefined symbol: _sqlite3_key_v2.

Created on 10 Oct 2019  ·  17Comments  ·  Source: dotnet/efcore

Describe the bug
After updating Microsoft.Data.Sqlite to version 3.0.0 I get following build errors for Xamarin Forms iOS project:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT5214: Native linking failed, undefined symbol: _sqlite3_key_v2. This symbol was referenced by the managed member SQLitePCL.SQLite3Provider_internal/NativeMethods.sqlite3_key_v2. Please verify that all the necessary frameworks have been referenced and native libraries linked.
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT5214: Native linking failed, undefined symbol: _sqlite3_rekey_v2. This symbol was referenced by the managed member SQLitePCL.SQLite3Provider_internal/NativeMethods.sqlite3_rekey_v2. Please verify that all the necessary frameworks have been referenced and native libraries linked.

To Reproduce

Build Xamarin Forms iOS project.

Additional context

Microsoft.Data.Sqlite version: 3.0.0
Target framework: .NET Standard 2.0

Development environment:

Windows 10 1903
Build: 18362.418

Microsoft Visual Studio Enterprise 2017
Version 15.9.16
VisualStudio.15.Release/15.9.16+28307.858
Microsoft .NET Framework
Version 4.8.03752

Xamarin Forms version: 4.2.0.848062
Xcode version: 10(10E125)

area-adonet-sqlite closed-external customer-reported

Most helpful comment

"@bricelam will update the SQLite package"

Which I assume will be after I ship 2.0.2 (non-pre).

Which should be next week. I just wanted to verify a couple more things first.

All 17 comments

@ericsink Any ideas on this error?

This could happen if there are old pre-2.0 versions of the SQLitePCLRaw packages still involved.

I think this could also happen if bundle_green is used instead of bundle_e_sqlite3, but that issue will be fixed in 2.0.2.

This should not happen with SQLitePCLRaw 2.0.1, and if it does, that's a new bug.

I don't remember if 2.0.0 had this bug or not, and I'm not in a place to definitively check right now.

Bottom line: Update SQLitePCLRaw to 2.0.1, make sure no pre-2.0 packages are still around, and see what happens.

@ericsink Thanks!
@dmsi-leo Please let us know if you are still hitting this problem after folowing Eric's advice.

@ajcvickers I use SQLitePCLRaw 2.0.1, and still have the same issue with Xamarin.iOS.

I'll dig into this more closely. In the meantime, could you post the exact list of packages+versions you are using?

Wait, never mind. I think I found the problem. And it's my fault. Fix pending.

Thanks for quick response.

Should we now wait for official Microsoft.Data.Sqlite Nuget package update that would include fixed SQLitePCLRaw or try manually install rebuilt package?

As soon as possible, let's say sometime in the next few days, I will release a new version of SQLitePCLRaw which contains this fix. You should be able to simply update SQLitePCLRaw to that version.

I would give it a try as soon new version is available.

Thanks a lot Eric!

I just pushed up version 2.0.2-pre20191018090318 to nuget.org, which contains a fix for this problem.

Thanks @ericsink for your quick response, as always.

@bricelam will update the SQLite package as needed to ensure the updated dependency is pulled in.

"@bricelam will update the SQLite package"

Which I assume will be after I ship 2.0.2 (non-pre).

Which should be next week. I just wanted to verify a couple more things first.

@ericsink Gentle ping. You still intend to release 2.0.2 fairly soon, right? (We're just making sure our ducks are in a line for our 3.1.0 release)

Ouch! Thanks for the nag. I actually forgot that I left 2.0.2 in a -pre state.

I'll get on that ASAP.

@bricelam

OK, 2.0.2 has been pushed up to nuget.org. Sorry I dropped the ball on this. How embarrassing.

There were no changes since the last -pre.

I re-reviewed all the relevant issues, re-read all the diffs since 2.0.1, and re-ran all the tests. It all looks solid. Let me know if you encounter any problems.

Thanks! Submitted PR #18706 to update.

Was this page helpful?
0 / 5 - 0 ratings