Running Spatialite 4.3.0a with SQLite on Windows 8.1 or later

2,158 views
Skip to first unread message

Marcel Gangwisch

unread,
Dec 16, 2015, 8:06:02 AM12/16/15
to SpatiaLite Users
Hey *,

we would like to use spatialite in a visual c# .NET 4.6.1 x64 application.
This works pretty well on our Windows 7 machine but fails on all machines with windows 8.1 or later.

The error occurs then we are going to load mod_spatialite with the error message: "no such function: spatialite_version"

We also checked the dependecies of mod_spatialite under windows 8.1 with the dependency walker, showing us, that there are some missing dependencies:
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL

These dependencies are not missing on our win7 environment.

We found the following thread refering to the same problem but without a solution:
http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/32-bit-application-fails-to-start-after-81-upgrade/b825723e-e2a2-4c8f-bd1f-10446a5d7059?auth=1

Maybe you got an idea how to solve this problem?

Best regards and have a nice day :-)
Marcel

a.fu...@lqt.it

unread,
Dec 16, 2015, 9:37:40 AM12/16/15
to spatiali...@googlegroups.com
On Wed, 16 Dec 2015 05:06:02 -0800 (PST), Marcel Gangwisch wrote:
> Hey *,
>
> we would like to use spatialite in a visual c# .NET 4.6.1 x64
> application.
> This works pretty well on our Windows 7 machine but fails on all
> machines with windows 8.1 or later.
>
> The error occurs then we are going to load mod_spatialite with the
> error message: "no such function: spatialite_version"
>

Hi Marcel,

this simply is a direct consequence of mod_spatialite failing
to be correctly load, as definitely confirmed by what follows:

> We also checked the dependecies of mod_spatialite under windows 8.1
> with the dependency walker, showing us, that there are some missing
> dependencies:
>
>> API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
>> API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
>> API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
>
> These dependencies are not missing on our win7 environment.
>
> Maybe you got an idea how to solve this problem?
>

I read this into the post from answers.microsoft.com [1]

---------------
I had problems with this API dll's missing with several 64 bit
aplications such as Magix video professional editor 2015 and
Magix Samplitude 2015 along with some programs from Native.
The solution for me was;
Visual C++ Redistributable Packages for Visual Studio 2013

Download link:
http://www.microsoft.com/en-us/download/details.aspx?id=40784

I reinstalled (repaired) these 2 files and all programs worked
vcredist_x64.exe
vcredist_x86-exe
---------------


and I've found a further post on Stack Exchange [2] confirming
the same solution
----------------
Ty for your comments, i found the problem, i forgot to install the
C++ 2010 Redistributable as x86 Version
----------------

it looks like you have to necessarily install the MSVC Redistributable
package downloaded from www.microsoft.com
(it's not fully clear to me of which exact version)

bye Sandro

[1]
http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/32-bit-application-fails-to-start-after-81-upgrade/b825723e-e2a2-4c8f-bd1f-10446a5d7059
[2]
http://stackoverflow.com/questions/24335787/c-cli-dll-fails-under-win-8-1
Message has been deleted

Marcel Gangwisch

unread,
Dec 16, 2015, 10:31:53 AM12/16/15
to SpatiaLite Users
Hi Sandro,

thanks for your reply!

We have the following Redistributable Packages installed:
Microsoft Visual C++ (2005, 2008, 2010, 2012, 2013, 2015) Redistributable (x86 and x64)

Unfortunately our problem persists.

I attached our small test example to this reply
https://drive.google.com/file/d/0B6kiRKysjm-dX2dDb3dESTBTaDg/view?usp=sharing

Thanks for any ideas!

Best regards and have a nice evening :-)
- Marcel

Pac

unread,
Dec 17, 2015, 11:59:40 AM12/17/15
to SpatiaLite Users
Hi Marcel,

Your application uses System.Data.Sqlite 1.0.99, and as said in http://system.data.sqlite.org/index.html/doc/trunk/www/news.wiki: "Add preliminary support for the .NET Framework 4.6.1"

Not very sure about what means "preliminary", but, since System.Data.Sqlite 1.0.98, .NET Framework 4.6 is fully supported: so you could try to change your framework version to 4.6. Also, there's no download for that framework version, so you should use the right package for your application's framework.

Finally, as said in http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki, the precompiled packages (like the ine your applciation uses) need the installation of the proper VC++ Runtime and framework (as told next to the download link). The static packages does not, because the runtime is included to cover very specific use cases.

Bye,
Paco.

Marcel Gangwisch

unread,
Jan 5, 2016, 9:30:45 AM1/5/16
to SpatiaLite Users
Hey *,

also after changing the framework to 4.6 the problem still persists.

The current test example includes the most recent spatialite version 4.4.0-RC0 (which contains SQLite 3.9.2)  and System.Data.SQLite Version 1.0.99 (3.9.2).
The same error also occurs with spatialite version 4.3.0.

According to the dependency walker the missing dependencies are still the same. The test example is still running on Win 7 x64.

Maybe you got another idea how to solve this issue?

ro...@tackettproxy.com

unread,
Mar 14, 2016, 5:22:50 PM3/14/16
to SpatiaLite Users
Marcel -

Did you find a solution to this? I've run into this just today on my Windows 10 workstation. I've installed every version of MSVC redistributables I can find to download (2010, 2012, 2013, 2015) and the issue still occurs. There's something more than MSVC missing.

I have the same issue whether spatialite 4.2, 4.3 or 4.4.

Marcel Gangwisch

unread,
Mar 16, 2016, 5:36:24 AM3/16/16
to SpatiaLite Users
Hey,

no I have not found a solution yet.. I did not figure out which dependency is still missing...
Which sqlite version did you use?

If you have a look here: http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/32-bit-application-fails-to-start-after-81-upgrade/b825723e-e2a2-4c8f-bd1f-10446a5d7059?auth=1
See answer by Jari S. (11.12.2013):
Finally Microsoft support replied (and I quote): "Missing/Moved Stub dll files are part of the design of the operating system and is not certain to change in future."

This is really unsatisfactory!

Best regards,
Marcel

Jorge Rocha Gualtieri

unread,
Apr 4, 2016, 11:11:36 AM4/4/16
to SpatiaLite Users
I'm having problems to run spatialite inside .NET Application x64 under Win10. 
When I try to load mod_spatialite I'm getting the following error:

Unhandled Exception: SQLite.SQLiteException: A dynamic link library (DLL) initialization routine failed.


I've tried some different scenarios to try to figure out where the problem is without lucky so far. Important to notice that the problem is only happening when running under x64.


.NET Framework
----
- v 4.5.2
- v 4.6.1

SQLite lib
----
- System.Data.SQLite Version 1.0.99 [SQLite 3.9.2] (https://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki)
- sqlite-net with libsqlite3-0 delivered with mod_spatialite-4.3.0a-win-amd64 (https://github.com/praeclarum/sqlite-net

mod_spatialite
----
- mod_spatialite-4.3.0a-win-amd64
- mod_spatialite-4.4.0-RC0-win-amd64


I've also tried to get more info using WinDBG. The problem seems to be during the initialization of libstdc++_64-6.dll because of an Access violation - code c0000005.
Below is call stack when the error occurs, I don't know if method names associated with libstdc++_64-6.dll are correct since I don't have the PDB file.

 # RetAddr           : Args to Child                                                           : Call Site
00 00000000`6a5d9c29 : 00000203`b5b80000 0000007d`50000061 0000007d`069fd718 00000000`6a647a00 : libstdc___64_6!_cxa_demangle+0x12610
01 00000000`6a5da052 : 00000000`6a648014 00000000`6a647a00 00000000`6a648014 00000000`00000000 : libstdc___64_6!_cxa_demangle+0xc3a9
02 00000000`6a6475ce : 00000000`00000000 00000000`6a5c117a 00000000`6a6894e0 00007ffd`dd0bb7b0 : libstdc___64_6!_cxa_demangle+0xc7d2
03 00000000`6a5cdf75 : 00000000`00000001 00000000`00000001 00000000`6a5c13e0 00000000`6a648014 : libstdc___64_6!atomic_flag_test_and_set_explicit+0x26e
04 00000000`6a5c137a : 00000000`00000001 00007ffd`dd9a52c8 00000000`00000001 00000000`6a5dc090 : libstdc___64_6!_cxa_demangle+0x6f5
05 00007ffd`dd9a52c8 : 00000000`00000000 00000000`00000001 0000007d`069fdb74 00007ffd`dda021a6 : libstdc___64_6+0x137a
06 00007ffd`dda020ca : 00000203`b5b948a0 00000000`6a5c0000 00000000`00000001 00000203`b5b94f30 : ntdll!LdrpCallInitRoutine+0x4c
07 00007ffd`dda01f0f : 00000203`b5b949f0 00000203`b5b94900 0000007d`069fd9b0 00000000`6a5c13e0 : ntdll!LdrpInitializeNode+0x162
08 00007ffd`dda01f2d : 00000000`00000000 00000203`b5b942d0 0000007d`069fd9f0 00000000`00000020 : ntdll!LdrpInitializeGraphRecurse+0x73
09 00007ffd`dda01f2d : 00000203`b5b91400 00000203`b5b94150 0000007d`069fda30 00000000`69a813e0 : ntdll!LdrpInitializeGraphRecurse+0x91
0a 00007ffd`dda01f2d : 0000007d`069fdc00 00000203`b59d4e70 0000007d`069fda70 00000203`00000000 : ntdll!LdrpInitializeGraphRecurse+0x91
0b 00007ffd`dd99bb85 : 00000000`00000000 00000000`00000000 0000007d`069fdac0 0000007d`069fdb74 : ntdll!LdrpInitializeGraphRecurse+0x91
0c 00007ffd`dd9a1ed4 : 0000007d`069fdb74 00000000`00000000 00000000`00000000 0000007d`069fdb80 : ntdll!LdrpPrepareModuleForExecution+0xc5
0d 00007ffd`dd9a19fe : 0000007d`069fdb80 0000007d`069fdd10 00000000`00000000 00000000`00000001 : ntdll!LdrpLoadDllInternal+0x1a8
0e 00007ffd`dd9a0c44 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000001 : ntdll!LdrpLoadDll+0xf2
0f 00007ffd`da82c77f : 00000203`b5b84e18 00007ffd`0000000f 0000000f`00000001 00000203`b5b84e18 : ntdll!LdrLoadDll+0x114
10 00000000`663908e9 : 00000203`00000000 00000203`b75258e8 00000203`b57efb25 00000000`00000000 : KERNELBASE!LoadLibraryExW+0x16f
11 00000000`66384952 : 00000000`66448f40 00000203`cfbdf588 00000203`b59d4e70 00000000`00000001 : sqlite3!sqlite3_win32_set_directory+0x3cba
12 00000000`663eee51 : 00000000`66448f40 00000203`cfbdf588 00000203`b57efb25 0000007d`069fe0c8 : sqlite3!sqlite3_db_status+0x312f
13 00000000`663ef331 : 00000203`b5b847a8 00000203`cfbdf588 00000000`00000000 0000007d`069fdfb0 : sqlite3!sqlite3_exec+0x4b9
14 00000000`663e6fa0 : 00000203`b5b847a8 00000203`cfbdf588 00000000`00000000 0000007d`069fdfb0 : sqlite3!sqlite3_load_extension+0x46
15 00000000`663bc0fa : 00000203`cfbdf408 00000000`00000001 00000203`cfbdf438 00000203`b5b94140 : sqlite3!sqlite3_strglob+0x11d0
16 00000000`663b7f69 : 00000203`cfbe0798 00000000`663851b6 00000203`b5b81db8 0000007d`069fea30 : sqlite3!sqlite3_value_numeric_type+0x1eb8
17 00000000`663b811e : 00000203`cfbe0798 00000203`b75258e8 00140203`b5913950 00000000`00000000 : sqlite3!sqlite3_result_error_nomem+0x2e9
18 00007ffd`5c184244 : 00000203`cfbe0798 00000203`b75258e8 0000007d`069feba0 00000203`b75258e8 : sqlite3!sqlite3_step+0xd2
19 00007ffd`5c1837a8 : 00000203`cfbe0798 00007ffd`5c1e1420 00000203`cfbdfab0 00000203`b5b87101 : 0x00007ffd`5c184244
1a 00007ffd`5c182de6 : 00000203`b75258e8 00000203`b7525360 00000203`b59269b8 00000000`00000000 : 0x00007ffd`5c1837a8
1b 00007ffd`5c181657 : 00000203`b7525640 00000203`b7525360 00000203`b7525868 00007ffd`ba8a8bc0 : 0x00007ffd`5c182de6
1c 00007ffd`bb7c3bd3 : 00000203`b7524508 00007ffd`5c0640c0 00000000`00000000 00000000`00000000 : 0x00007ffd`5c181657
1d 00007ffd`bb7c3a95 : 0000007d`069ff038 00007ffd`bb8fe619 00000000`00000000 00000000`00000000 : clr!CallDescrWorkerInternal+0x83
1e 00007ffd`bb7c44c6 : 00000000`00000001 0000007d`069fefb0 0000007d`069fef80 0000007d`069feef8 : clr!CallDescrWorkerWithHandler+0x4e
1f 00007ffd`bb8bb710 : 0000007d`069fee80 00000000`00000000 00000000`00000000 00000000`00000001 : clr!MethodDescCallSite::CallTargetWorker+0xf8
20 00007ffd`bb8bb8aa : 00000000`00000001 00000000`00000000 00000203`00000000 00000203`b7524508 : clr!RunMain+0x1e7
21 00007ffd`bb8bb7a0 : 00000000`00000000 00000203`b7521628 00000000`00000000 00000203`b59cda80 : clr!Assembly::ExecuteMainMethod+0xb6
22 00007ffd`bb8bba13 : 0000007d`069ff9f8 00000203`b57e0000 00000000`00000000 00000000`00000000 : clr!SystemDomain::ExecuteMainMethod+0x5ea
23 00007ffd`bb8bb9ea : 00000203`b57e0000 00000000`00000000 00000000`00000000 00007ffd`bd254a38 : clr!ExecuteEXE+0x3f
24 00007ffd`bb8cdea0 : ffffffff`ffffffff 00000000`00000000 0000007d`06464000 00000000`00000000 : clr!_CorExeMainInternal+0xb2
25 00007ffd`bd1f802d : 00000000`00000000 00000000`00000091 00000000`00000000 0000007d`069ffab8 : clr!CorExeMain+0x14
26 00007ffd`bd291184 : 00007ffd`bd2910a0 00007ffd`bb8cde8c 00000000`00000000 00007ffd`bd1f7fd0 : mscoreei!CorExeMain+0xe0
27 00007ffd`bd2910ab : 00007ffd`bd1f0000 00007ffd`bd2910a0 00000000`00000000 00000000`00000000 : MSCOREE!ShellShim__CorExeMain+0xb8
28 00007ffd`dd0b8102 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : MSCOREE!CorExeMain_Exported+0xb
29 00007ffd`dd9ec5b4 : 00007ffd`dd0b80e0 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x22
2a 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x34














Jorge Rocha Gualtieri

unread,
Apr 4, 2016, 1:16:12 PM4/4/16
to SpatiaLite Users
I've managed it to work!

The problem is with libstdc++_64-6 shipped with mod_spatialite.

To get it running I've downloaded mingw-w64 (x86_64-5.3.0-win32-seh-rt_v4-rev0) and then, picked libstdc++-6.dll and libgcc_s_seh-1.dll from there. 
Since mod_spatialite.dll is looking from libstdc++_64-6.dll instead of libstdc++-6.dll you have to rename it. 
As the the new libstdc++-6.dll is looking for libgcc_s_seh-1.dll instead of libgcc_s_seh_64-1.dll, you can delete the old libgcc_s_seh_64-1.dll and there is no need to rename it.

Now it's running .NET Framework v 4.6.1, System.Data.SQLite Version 1.0.99 [SQLite 3.9.2] and mod_spatialite-4.3.0a-win-amd64.

Does anyone know the best approach to have it fixed into shipped binaries?

Regards
Jorge Rocha Gualtieri

a.fu...@lqt.it

unread,
Apr 6, 2016, 11:36:50 AM4/6/16
to spatiali...@googlegroups.com
On Mon, 4 Apr 2016 10:16:12 -0700 (PDT), Jorge Rocha Gualtieri wrote:
> I've managed it to work!
>
> The problem is with libstdc++_64-6 shipped with mod_spatialite.
>
> To get it running I've downloaded mingw-w64
> (x86_64-5.3.0-win32-seh-rt_v4-rev0) and then, picked libstdc++-6.dll
> and libgcc_s_seh-1.dll from there. 
> Since mod_spatialite.dll is looking from libstdc++_64-6.dll instead
> of libstdc++-6.dll you have to rename it. 
> As the the new libstdc++-6.dll is looking for libgcc_s_seh-1.dll
> instead of libgcc_s_seh_64-1.dll, you can delete the old
> libgcc_s_seh_64-1.dll and there is no need to rename it.
>
> Now it's running .NET Framework v 4.6.1, System.Data.SQLite Version
> 1.0.99 [SQLite 3.9.2] and mod_spatialite-4.3.0a-win-amd64.
>
>

Hi Georges,

all this seems to be really reasonable; current versions of SpatiLite
binaries for Windows were built using MinGW/MSYS toolchains as
available
at the very beginning of year 2015, before Win10 introduced several
unexpected breakages in the well established platform API/ABI as
supported by both WinXP and Win7.
it sounds rather realistic that more recent MinGW/MSYS versions have
been subsequently patched and are now able to correctly support Win10
as well.


> Does anyone know the best approach to have it fixed into shipped
> binaries?
>

just replacing/updating a strongly critical run time DLL (after
manually adjusting its name) could possibly work, but it's a
potentially unsafe and may be dangerous operation; it doesn't
seems to be an acceptable sound and robust solution to be
adopted for distributing pre-packages binaries.

a more satisfying solution surely is the one to rebuild from
scratch all spatialite binaries (and all related dependences)
using the latest versions of MinGW/MSYS.
it's a damn hard task, incredibly boring and requiring a rather
long time, but it will possibly be done before releasing the
next spatialite's version.

bye Sandro

Michael Donkhin

unread,
Apr 7, 2016, 5:23:54 AM4/7/16
to SpatiaLite Users
Hi Sandro,
In case I'd like to perform this task myself (compiling the libraries), where could I find the guidelines for this?

a.fu...@lqt.it

unread,
Apr 7, 2016, 5:36:48 AM4/7/16
to spatiali...@googlegroups.com
Hi Michael,

you can read the MinGW how-to guide from here:

http://www.gaia-gis.it/gaia-sins/mingw_how_to.html
http://www.gaia-gis.it/gaia-sins/mingw64_how_to.html

please notice:
the instructions about the 32 bit compiler are already
updated (I've finished yesterday to build and test all
Win32 binaries built using the latest gcc 4.9.3).
I'm currently attempting to build for Win64 using the
TDM gcc 5.1.0-2, and consequently the documentation
about the latest 64 bit compiler will surely be highly
unstable (and may be inconsistent, wrong and misleading)
during the next 12 hours.

bye Sandro

Jorge Rocha Gualtieri

unread,
Apr 7, 2016, 9:53:33 AM4/7/16
to spatiali...@googlegroups.com
Hi 

Sandro,

I totally agree with you that my approach is far from being safe and shouldn't be used into the official binaries  :) 
I don't know how official binaries are generated. Do you build them? There is a build server? Can I build them?

Michael/Sandro,

If you there is anything that I can do to help, just let me know.


Regards
JRG





--
You received this message because you are subscribed to a topic in the Google Groups "SpatiaLite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spatialite-users/u2QZpQL_6ek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.
Visit this group at https://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.

Michael Donkhin

unread,
Apr 11, 2016, 6:27:19 AM4/11/16
to SpatiaLite Users
Hi Jorge,

What distribution of MinGW did you use and where did you take the binaries from?

Thanks,
Michael

Jorge Rocha Gualtieri

unread,
Apr 11, 2016, 10:16:27 AM4/11/16
to spatiali...@googlegroups.com
Hi Michael,


I've used MinGW x86_64-5.3.0-win32-seh-rt_v4-rev0 downloaded from https://sourceforge.net/projects/mingw-w64/

Regards,
JRG

Eric Sanderson

unread,
May 17, 2016, 10:22:12 PM5/17/16
to SpatiaLite Users
Just wanted to note I'm getting this error with the latest Spatialite 4.4.0RC0.

I'm trying to load the mod_spatialite.dll from a C:\spatialite directory in Ipython's jupyter. I'ved added it to the env. path.

What's odd is I can load the extension inside of the sqlite.exe, so I'm unsure what mod_spatialite.dll might be looking for.

Eric


On Wednesday, December 16, 2015 at 7:06:02 AM UTC-6, Marcel Gangwisch wrote:

Jorge Rocha Gualtieri

unread,
May 19, 2016, 9:01:41 AM5/19/16
to spatiali...@googlegroups.com
Eric,

You may use Sysinternals ProcMon to tell if the right DLL is being loaded. 

Regards
JRG


--

Eric Sanderson

unread,
May 27, 2016, 7:58:02 AM5/27/16
to SpatiaLite Users
It's pointed right at the DLL. I haven't looked at it, but a brief searching brings up several windows 10 issues.

Eric Sanderson

unread,
May 27, 2016, 8:07:01 AM5/27/16
to SpatiaLite Users
conn.load_extension('C:\spatialite\mod_spatialite')
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
<ipython-input-11-a8fa0e09c72b> in <module>()
----> 1 conn.load_extension('C:\spatialite\mod_spatialite')

OperationalError: A dynamic link library (DLL) initialization routine failed.

As I mentioned, it loads in sqlite, which is 3.9.2.

sqlite3.sqlite_version = 3.8.11

I didn't have any of these issues on windows 7.

Eric

Pac

unread,
Feb 28, 2017, 11:26:57 AM2/28/17
to SpatiaLite Users
Hi Jorge,

A BIG THANK YOU for your hint. After a week or so seeing my old x64 SpatiaLite code not working with .Net 4.5.1, your comment was all that was needed.
In my case, I've used the new DLLs included in x86_64-6.3.0-release-win32-seh-rt_v5-rev1.7z, and so far so good.
I'll comment on this thread if any error arises from using those DLLs, as Sandro warned previously.

Bye,
Paco

Donny Velazquez

unread,
Mar 28, 2017, 10:18:02 AM3/28/17
to SpatiaLite Users
So is this fixed?
Still having the issue.

a.fu...@lqt.it

unread,
Mar 28, 2017, 1:48:05 PM3/28/17
to spatiali...@googlegroups.com
On Tue, 28 Mar 2017 07:18:02 -0700 (PDT), Donny Velazquez wrote:
> So is this fixed?
> Still having the issue.
>

Hi Donny,

just by chance I've spent this afternoon playing with
my new laptop (bought this morning and extracted out
from its sealed box at noon); I've just configured the
preinstalled Win10 Pro 64 bit and I'm assuming it could
legitimately represent a "typical" Win10.

Then I've simply downloaded from www.gaia-gis.it all
the following binary packages for Windows:

http://www.gaia-gis.it/gaia-sins/windows-bin-x86/mod_spatialite-4.3.0a-win-x86.7z
http://www.gaia-gis.it/gaia-sins/windows-bin-x86/spatialite_gui-4.3.0a-win-x86.7z
http://www.gaia-gis.it/gaia-sins/windows-bin-amd64/mod_spatialite-4.3.0a-win-amd64.7z
http://www.gaia-gis.it/gaia-sins/windows-bin-amd64/spatialite_gui-4.3.0a-win-amd64.7z

all them immediately started without any problem.

--------

Conclusion: as it previously emerged, Microsoft
introduced several API/ABI changes affecting the
C/C++ runtime when releasing Win8; such changes
will surely break the historical compatibility
with earlier versions of Windows (XP, Win7).
Anyway Microsoft released at the same time an
additional package (Visual C++ 2015 Redistributable)
that, if properly installed, will fully restore
any required runtime support for executing XP / Win7
binaries on Win8 / Win10.

I've checked all installed program on my Win10,
(control panel / programs) and I've found:
1. Microsoft Visual C++ 2005 Redistributable
(version: 8.0.59193)
2. Microsoft Visual C++ 2015 Redistributable(x64)
(version: 14.0.23918.0)
3. Microsoft Visual C++ 2015 Redistributable(x86)
(version: 14.0.23918.0)

If the above packages are not installed on your PC
you can easily get them from here:

https://www.microsoft.com/en-us/download/details.aspx?id=18471
https://www.microsoft.com/en-us/download/details.aspx?id=3387
https://www.microsoft.com/en-us/download/details.aspx?id=53587

bye Sandro

Donny Velazquez

unread,
Mar 31, 2017, 4:57:27 PM3/31/17
to SpatiaLite Users
I have Microsoft Visual C++ Redistributable for 2008 (x86, x64), 2010 (x86, x64), 2012 (x86, x64), 2013 (x86, x64), 2017 (x86, x64).
And I have VS2015 installed. 

Still doesn't work.

dominik.f...@gmail.com

unread,
Apr 4, 2017, 4:22:34 AM4/4/17
to SpatiaLite Users
Dear all,

trying the latest binaries with all required runtime redistributables installed and applying the libstdc++_64-6.dll replacement (including libgcc_s_dw2-1.dll of course) as suggested here: http://blog.jrg.com.br/2016/04/25/Fixing-spatialite-loading-problem/, I now get an "not authorized" error from SQLite as soon as I try to load mod_spatialite.

My code is as follows

String inputFile = "SomeDatabase.db";
dbConnection = "Data Source=" + inputFile;
CreateDataBase(inputFile);
connection = new SQLiteConnection(dbConnection);
connection.Open();
connection.SetConfigurationOption(SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, true);
connection.EnableExtensions(true);

SQLiteCommand version = new SQLiteCommand("SELECT sqlite_version();");  // this works fine
Console.WriteLine("SQLITE-Version: " + ExecuteScalar(version).ToString());  // returns "SQLITE-Version: 3.15.2"

SQLiteCommand loadSpatialite = new SQLiteCommand("SELECT load_extension('mod_spatialite');");
ExecuteNonQuery(loadSpatialite);  // crashes throwing a "not authorized"  message


ExecuteNonQuery() and ExecuteScalar() are consisting basically of the SQLiteCommand inside a try/catch block and setting the connection before executing)

Best,
Dominik



mj10777

unread,
Apr 4, 2017, 4:34:34 AM4/4/17
to SpatiaLite Users


On Tuesday, 4 April 2017 10:22:34 UTC+2, Dominik Fröhlich wrote:
Dear all,

trying the latest binaries with all required runtime redistributables installed and applying the libstdc++_64-6.dll replacement (including libgcc_s_dw2-1.dll of course) as suggested here: http://blog.jrg.com.br/2016/04/25/Fixing-spatialite-loading-problem/, I now get an "not authorized" error from SQLite

Sometimes sqlite is compiled without extension support (to avoid malware)
You test this with (as you have done):
sqlite_enable_load_extension()

If it does not work, then you must try to compile sqlite yourself and use that version.

- 3.18 is the latest version and in that page they offer binaries for different windows versions

Mark
Message has been deleted

Dominik Fröhlich

unread,
Apr 4, 2017, 7:00:04 AM4/4/17
to SpatiaLite Users
Dear Mark,

unfortunately I'm on visual C#, where I need to deal with "system.data.sqlite".

I didn't write that before (my mistake), but i already compiled both, spatialite (including the newest version of sqlite (at that time 3.17.0)) and system.data.sqlite. My binaries unfortunately cause the same error as the pre-compiled ones. I'm just using those to stay consistent with sandro, who claimed being successful in loading spatialite on win10.

Do you by any chance know where to set extension support prior to compile system.data.sqlite? Just to make sure…?

Best,
Dominik

EDIT: I can load mod_spatialite from the console (both, the .exe obtained from the sqlite compilation, as well as the one shipped with the spatialite binaries). Only from within C# it doesn't work. Seems like the issue is caused by system.data.spatialite.

Donny Velazquez

unread,
Apr 4, 2017, 9:40:37 AM4/4/17
to SpatiaLite Users
I am also using C# and the "system.data.sqlite" library. I can't get it to work without doing the hack.

Duncan

unread,
Apr 4, 2017, 8:58:17 PM4/4/17
to SpatiaLite Users
Hi

I'm not sure if this is related, but I have used System.Data.SQLite in my app and while it is happy to load Spatialite using the LoadExtension method, it returns not authorized when attempting to load it with the SQL statement.

I also noted that the LoadExtension method worked with or without the EnableExtensions method being called first

I found the same problem with the sqlite-net wrapper, but as this one does not implement a loadExtension method, I was unable to load Spatialite at all, which is a bummer.
I had a look at implementing it myself, but was not smart enough with C (any assistance would be appreciated)

This occurs on Windows 7 or 10, but loading with SQL works fine in the SQLite shell.

Cheers

Duncan

Dominik Fröhlich

unread,
Apr 5, 2017, 11:11:43 AM4/5/17
to SpatiaLite Users
Dear all,

I just found out, that the hack described at http://blog.jrg.com.br/2016/04/25/Fixing-spatialite-loading-problem/ only works with the dlls from the second most recent version of mingw64 (mingw-w64-bin_x86_64-linux_20131228.tar.bz2 from https://netassist.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_x86_64-linux_20131228.tar.bz2). Any attempt to do the same with the most recent version available at sourcefourge (https://sourceforge.net/projects/mingw-w64/files/latest/download) failed on my system.

However, I can definitely confirm, that I can load mod_spatialite with

MyConnection.LoadExtension("mod_spatilite");

no matter if

MyConnection.SetConfigurationOption(SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, true);
MyConnection.EnableExtensions(true);

are set to true or false.
At the same time,

SQLiteCommand loadSpatialite = new SQLiteCommand("SELECT load_extension('mod_spatialite');");

does never work (but did in older versions).

Best,
Dominik

Duncan

unread,
Apr 9, 2017, 11:02:14 PM4/9/17
to SpatiaLite Users
Thanks for confirming that Dominik. I wasn't able to confirm it working in older versions, I tried 3.8.11.1 (didn't work) and 3.7.13 which had problems with the wrapper I was using (sqlite-net), but I thought it was working before
I guess there's something in the compile options preventing it loading on Windows, although it does work in the shell

Cheers

Duncan
Reply all
Reply to author
Forward
0 new messages