I am trying to use the SQLiteSupport module that ships with UE4, but I cannot get it to work. As far as I can tell, the module is currently completely broken.
There are two apparent issues, both of which are detailed here: 4.7 SQLiteSupport - Bug? - C++ - Unreal Engine Forums
There seems to be a problem in the way the private header file SQLiteSupportPrivatePCH.h is included by the public header file SQLiteDatabaseConnection.h. The module does not recognize a path and by default a project will fail to compile when SQLiteSupport is added as a dependency. There are some workarounds for this (see the thread), but it feels like a hack. Still, this isn’t a roadblock so much as problem 2…
Even when the project compiles, it will still fail in the linker with a message like
LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\Epic Games\4.7\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-SQLiteSupport.lib'
I have no idea what causes these problems, but they are reproducable, and I am not the only one with the issue. Another user in the thread linked above is reporting the same behavior.
I observe the bug in every pre-compiled launcher versions of the engine from 4.6.2 all the way to 4.7.2, as well as when compiling the engine from source. I am using Microsoft’s Visual Studio compiler version “18.00.31101”. I also notice that in the build log from building the UE4 project, there is no output relating to building the SQLiteSupport module, and no DLL is generated for this module.
yes, you’re right about no 1. It was a GitHub PR and we’ve missed it. SQLiteDatabaseConnection.h is a public interface and it shouldn’t have SQLiteSupportPrivatePCH.h inclusion. The right approach is to replace it with SQLiteSupport.h. This will be fixed in next release.
Unfortunatelly I cannot reproduce your second error. Have you included SQLiteSupport to Public/PrivateDependencyModuleNames in YourModule.Build.cs file?
Thank you Jarek for your answer.
I can reproduce the second error. Actually I had to do nothing more than use the SQLiteSupport module for it to happen.
I´ve included SQLiteSupport to Public/PrivateDependencyModuleNames in MyModule.Build.cs file.
We only get the error when compiling after making changes. Once you get the error you can compile again and it will compile just fine. Anyway the lib file is never generated.
Thanks for looking into this, Jarek.
I have included SQLiteSupport to both my public and private dependency lists, but still the issue persists.
When you attempted to reproduce the bug, did you do so on a version of the engine that was already built? I have never been able to get the module to work, but I am also a very new user of the engine. According to Storngrir in the forum post, things seemed to be working as recently as version 4.7.0 (breaking after the 4.7.1 hotfix). Since the SQLiteSupport module code hasn’t changed in 3 months, and since we are not seeing any lib files or DLLs get created, it seems likely that the bug may be in the build system, in which case it is feasible that you wouldn’t be able to reproduce it with an already installed version of UE4.
Could you maybe try downloading a clean install from the launcher and then trying to reproduce once more? Also, if you check in the engine’s Binaries directory, do you see a DLL for this module?
Also getting that second issue. Not sure why it looks like the library file is not there. Is it meant to be there by default? Is there some way it’s meant to be created?
Have you included the SQLite code as per the instructions in ThirdParty\sqlite\README.txt?
SQLite database support requires the 'amalgamated' source code for sqlite, obtainable at http://www.sqlite.org/download.html.
Extract the contents (*.cpp, *.h) into Engine/Source/ThirdParty/sqlite/sqlite and build it using VisualStudio.
(obviously if you aren’t on Windows you’d just need to build the library using whatever alternative dev environment you are using.)
I have indeed, it threw a different error before I did that, which very helpfully pointed to that readme file.
I placed the source in the indicated location, then built the sln project (The on next to the readme) in the appropriate configuration.
It created the .lib files in the lib directory, which solved the initial error I was getting, but now I get the error above:
error LNK1181: cannot open input file 'C:\Program Files\Epic Games\4.7\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-SQLiteSupport.lib'
Presumably because that file does indeed not exist.
Great, I’m pleased to see that the warning is functional.
Just to double check, did you actually build the library or just include the source in the indicated location?
I want to add a quick note here. I didn’t mention it in my original post because I wasn’t sure if it was a bug or not.
The readme file and visual studio sln file for building sqlite should be present in the directory Engine/Source/ThirdParty/sqlite. However, when UE4 is downloaded from the launcher, this directory isn’t created. The entire directory doesn’t exist at all.
When I first started trying to use this module, I had a similar experience to Ineni, where I got a build error pointing me to that readme file. However, I had a very hard time finding it (eventually doing so by looking through the source on Github). If it is intentionally left out of the downloaded version (perhaps because you cannot include the sqlite source? But still, why not include the readme and sln?) then a message to this effect in the error message could be helpful for future users. If the sqlite directory IS supposed to be there - then perhaps this is related to the present bug.
That’s a good point sirrus, I also had to copy the sqlite folder from the github version, it would make sense that they’d be related. Although I can’t get it working from the source version either…
I actually think that LibraryPath is getting set correctly - at least insofar as I believe it is actually looking in Program Files\Unreal Engine\4.7\Engine\Source\ThirdParty\sqlite\libs, because the error message pointing the the readme correctly appears when sqlite has not been compiled, and correctly vanishes when it has.
Oh, hang on, I misread that.
If it isn’t finding the SQLiteSupport lib now, can you do a search and see if the file exists elsewhere?
Yeah, sorry, I misread. I edited my previous comment - can you try looking for the UE4Editor-SQLiteSupport lib and seeing if it is being built but in the wrong location?
So it looks like building of UE4Editor-SQLiteSupport is failing, because no output file is being produced.
Very strange that it is failing without giving an error in the build log though.
I’ve searched the entire directory structure, in both the downloaded engine, and a version of the engine compiled from source. The lib is nowhere to be found.
It doesn’t appear to exist anywhere.
When I compiled the engine from source, I looked through the build log for any mention of that lib, and found nothing. It looks like maybe the building of SQLiteSupport isn’t failing, but rather it is never attempted at all.
Yeah, you are right I think. Unfortunately I’m running out of ideas at this point and I do suspect it is to do with the hypothesis below, that is to say that the missing folder is connected to the library not being built at all. Strange, because I thought #including the right header and referencing the module in the build script is all you need to trigger compilation of a module…
I agree, I don’t think your build script is to blame. I checked to make sure that the UE4Editor-Database lib was getting compiled (it was), and compared that build script to the one you wrote, as well as a couple others. Although my knowledge of the build system is extremely limited (maybe slightly less so, after all this debugging!) I don’t see anything out of the ordinary.
Since Storngrir claims this was working prior to 4.7.1, I tried digging through the commit history between the initial 4.7 release and the 4.7.1 hotfix, looking for any bugs that might have been introduced into the build system, but I wasn’t able to find anything (admittedly, I didn’t dig as deep as I could have). I still don’t understand how the build system locates the build.cs files to use, but possibly that system is missing your module?