robertohuertasm / SQLite4Unity3d

SQLite made easy for Unity3d
MIT License
1.27k stars 265 forks source link

DllNotFoundException: sqlite3 #115

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi. I am getting this error while trying to run Unity win10 build on other machine with Unity 2021.1.2f.1 (I've tried 2020.3 and 2019.4 - bug persists and I also tried building very original version cloned from this repository - just an example). Please take a look, thank you. Also I am not sure, but why does it use my original file paths from the PC I've built the build? In this line f.e.: (Filename: C:/chosen-stream/Unity/projects/Sqlite-Test-2019/Assets/Scripts/DataService.cs Line: 23)

Mono path[0] = 'C:/0-2019/Sqlite-Test-2019_Data/Managed'
Mono config path = 'C:/0-2019/MonoBleedingEdge/etc'
PlayerConnection initialized from C:/0-2019/Sqlite-Test-2019_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55054
Multi-casting "[IP] 10.0.2.15 [Port] 55054 [Flags] 2 [Guid] 1958314273 [EditorId] 2875230922 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-RKDL3DK) [Debug] 0 [PackageName] WindowsPlayer [ProjectName] Sqlite-Test-2019" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55054]
PlayerConnection already initialized - listening to [0.0.0.0:55054]
Initialize engine version: 2019.4.5f1 (81610f64359c)
[Subsystems] Discovering subsystems at path C:/0-2019/Sqlite-Test-2019_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: Microsoft Basic Render Driver (ID=0x8c)
    Vendor:   
    VRAM:     1023 MB
Begin MonoManager ReloadAssembly
- Completed reload, in  0.147 seconds
Dedicated video D3D11 device creation failed (error: 0x887a0004). This device is used specifically for video decoding, we will use software video decoding instead.<RI> Initializing input.

XInput1_3.dll not found. Trying XInput9_1_0.dll instead...
<RI> Input initialized.

<RI> Initialized touch support.

UnloadTime: 0.633000 ms
Database not in Persistent path
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DataService:.ctor(String) (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\DataService.cs:23)
CreateDBScript:StartSync() (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:16)
CreateDBScript:Start() (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:11)

(Filename: C:/chosen-stream/Unity/projects/Sqlite-Test-2019/Assets/Scripts/DataService.cs Line: 23)

Database written
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DataService:.ctor(String) (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\DataService.cs:57)
CreateDBScript:StartSync() (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:16)
CreateDBScript:Start() (at C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:11)

(Filename: C:/chosen-stream/Unity/projects/Sqlite-Test-2019/Assets/Scripts/DataService.cs Line: 57)

Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
DllNotFoundException: sqlite3
  at (wrapper managed-to-native) SQLite4Unity3d.SQLite3.Open(byte[],intptr&,int,intptr)
  at SQLite4Unity3d.SQLiteConnection..ctor (System.String databasePath, SQLite4Unity3d.SQLiteOpenFlags openFlags, System.Boolean storeDateTimeAsTicks) [0x0006a] in C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\SQLite.cs:237 
  at DataService..ctor (System.String DatabaseName) [0x00059] in C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\DataService.cs:62 
  at CreateDBScript.StartSync () [0x00001] in C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:16 
  at CreateDBScript.Start () [0x00001] in C:\chosen-stream\Unity\projects\Sqlite-Test-2019\Assets\Scripts\CreateDBScript.cs:11 

(Filename: C:/chosen-stream/Unity/projects/Sqlite-Test-2019/Assets/Scripts/SQLite.cs Line: 237)

Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/sqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3.dll
Fallback handler could not load library C:/0-2019/Sqlite-Test-2019_Data/Mono/libsqlite3

And this is quite strange, because the dll itself is indeed within the build files: image

albrrt commented 2 years ago

Same problem here. Curiously for me this doesn't happen on my development machine. It only happens if I run the build on other Windows 10 PCs. Not sure if perhaps it could be somehow related this? https://forum.unity.com/threads/fallback-handler-could-not-load-library-unity-4-2-osx-10-8-4-standalone.191966/#post-1496078

Interestingly this error also doesn't happen if I build for x86 but only if I build for x86_64 architecture.

markgrossnickle commented 2 years ago

I marked this to watch months ago and never figured it out myself. But I believe the reason it works on our development machines is because we have sqlite3 installed somewhere or and made available in our path somewhere. Client machines wouldn't have that and thus they don't work.

We ended up migrating to MySQL for another reason and thus I didn't have to figure this out. But would love the option for sqlite on future projects.

albrrt commented 2 years ago

I replaced the sqlite3.dll from Plugins / SQLite / x64 with the latest pre-compiled binary (64-bit DLL) from https://www.sqlite.org/download.html and it fixed the problem.

LexQzim commented 1 year ago

I replaced the sqlite3.dll from Plugins / SQLite / x64 with the latest pre-compiled binary (64-bit DLL) from https://www.sqlite.org/download.html and it fixed the problem.

Perfect. This works for me aswell. Thank you very much :)

Ojayyy commented 1 year ago

I replaced the sqlite3.dll from Plugins / SQLite / x64 with the latest pre-compiled binary (64-bit DLL) from https://www.sqlite.org/download.html and it fixed the problem.

Solved my problem. Windows standalone build with Mapbox on Windows Server 2019. Thx!