sqlite-http icon indicating copy to clipboard operation
sqlite-http copied to clipboard

Unable to load into SQLite

Open ehonzik opened this issue 1 year ago • 3 comments

Unable to load into SQLite, tried on version 0.1.1 and 0.1.0 - Windows platform. SQLite version 3.45.1

sqlite> .load ./http0 Error: The specified module could not be found.

Module is in same folder as CLI. Any idea?

ehonzik avatar Feb 01 '24 15:02 ehonzik

SQLite version 3.45.0 2024-01-15 17:01:13 (UTF-16 console I/O)
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load fastrand0
sqlite> .load html0
Error: The specified module could not be found.

sqlite> .load http0
Error: The specified module could not be found.

sqlite> .load jsonschema0
sqlite>

Moaneschien avatar Feb 01 '24 18:02 Moaneschien

I think module could not be found is talking about sqlite3.dll. On my machine I run sqlite3.exe with sqlite3.dll in the same directory as http0.dll and I am able to .load http0.

twoxfh avatar Feb 09 '24 00:02 twoxfh

sqlite3.dll, sqlite3.dll, sqlean.exe and the libraries are all in the same directory. fasrand0 loads, html0 does not.

Moaneschien avatar Feb 09 '24 06:02 Moaneschien

The released http0.dll is a 64-bit library and it compiled by mingw64 and therefore requires libwinpthread-1.dll to work. Sometimes there is only a 32-bit version of libwinpthread-1.dll in Windows and Windows tries to mix 32- and 64-bit libraries.

изображение

The solutions are

  1. Build http0.dll with -static C-compiler flags to built-in libwinpthread-1
    go build -o http0.dll -buildmode=c-shared -ldflags="-s -w -extldflags=-static"
    
    -s and -w flags reduce a dll size by half.
  2. Just put 64-bit libwinpthread-1.dll to an app folder.

little-brother avatar Dec 15 '24 13:12 little-brother

2. Just put 64-bit [`libwinpthread-1.dll`](https://github.com/user-attachments/files/18140545/libwinpthread-1.zip) to an app folder.

Worked flawless! Thanks little-brother.

Moaneschien avatar Dec 15 '24 17:12 Moaneschien

@little-brother Works like a charm! Thanks...

ehonzik avatar Dec 16 '24 07:12 ehonzik