Skip to content

Mac OS X - EntryPointNotFoundException: sqlite3_close_v2 #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Nov 24, 2015 · 7 comments
Closed

Mac OS X - EntryPointNotFoundException: sqlite3_close_v2 #3870

ghost opened this issue Nov 24, 2015 · 7 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Nov 24, 2015

Mac OS X - EntryPointNotFoundException: sqlite3_close_v2

When using yeoman's "Web Application" template (which uses SQLite), trying to access the database by logging in, for example, throws an EntryPointNotFoundException.

Functional impact

The following exception is thrown on database access:

Unhandled Exception:
System.EntryPointNotFoundException: sqlite3_close_v2
at (wrapper managed-to-native) Microsoft.Data.Sqlite.Interop.NativeMethods:sqlite3_close_v2 (intptr)
at Microsoft.Data.Sqlite.Interop.Sqlite3Handle.ReleaseHandle () [0x00000] in :0
at System.Runtime.InteropServices.SafeHandle.Dispose (Boolean disposing) [0x00000] in :0
at System.Runtime.InteropServices.SafeHandle.Finalize () [0x00000] in :0

Minimal repro steps

mono-1.0.0-rc1-final runtime must be used to observe the issue (it works in coreclr).

  1. Create a new "Web Application" using yeoman;
  2. Follow the instructions at http://wildermuth.com/2015/11/18/Upgrading_ASP_NET_5_Beta_8_to_RC1 to upgrade from beta8 to rc1 if necessary;
  3. dnu restore (using Mono);
  4. dnx ef migrations add Init (using Coreclr, does not work with Mono);
  5. dnx ef database update (using Coreclr, does not work with Mono);
  6. dnx web (using Mono);
  7. Try to log in;
  8. The request fails;

Expected result

Database accesses should succeed.

Further technical details

  • Operating system: Mac OS X El Capitan;
  • sqlite3 --version returns 3.8.10.2;
  • EntityFramework.Commands and EntityFramework.SQlite versions are 7.0.0-rc1-final;
  • Runtime used: mono-1.0.0-rc1-final;
@natemcmaster
Copy link
Contributor

This error means Mono did not load the native library correctly. Mono's handling of P/Invoke is different than CoreCLR. Which version of Mono are you running? mono --version

@ghost
Copy link
Author

ghost commented Nov 25, 2015

My version of Mono is 4.0.5.

@natemcmaster
Copy link
Contributor

Can you try making this simple test project: https://gist.github.com/natemcmaster/c50687b8e2812cbe6903?
Download and run dnx restore and dnx run. You should see
image

If this fails, run MONO_LOG_LEVEL=debug dnx run > debug-3879.log and post a link to the log dump here.

@natemcmaster
Copy link
Contributor

@jflr one more possibility: you are using x86 mono. What is the full output of mono --version? Look for the line that says Architecture: ___. libsqlite3 on osx is only for amd64. ...but even that should work.

@ghost
Copy link
Author

ghost commented Nov 25, 2015

@natemcmaster I have an x86 build of Mono. That could in fact be the issue. I'll try with amd64 Mono.

@ghost
Copy link
Author

ghost commented Nov 25, 2015

@natemcmaster I've tried running the small program you've sent me, and it worked. What is interesting though is that my version of libsqlite3 is 3.7.13. However, based on the info at http://www.sqlite.org/changes.html, sqlite3_close_v2 was only added in 3.7.14. I believe that explains the EntryPointNotFoundException.

As far as I know, I should still be using the version of libsqlite3 provided with Mac OS X, though maybe you can check your version to confirm.

@natemcmaster
Copy link
Contributor

This makes sense now.
OSX default library /usr/lib/libsqlite3.dylib is only x64 (Picked up by Mono x64 and CoreCLR)
Mono x86 uses /Library/Frameworks/Mono.framework/Libraries/libsqlite3.dylib which is 3.7.13

In rc1 we required 3.7.15. In rc2, this should work back to 3.7.9 (see aspnet/Microsoft.Data.Sqlite#171)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants