Closed voltagex closed 1 year ago
Does it open for a file instead of just :memory
?
Can you specify v0.11.9
as the version and try? Perhaps the latest changed with v0.12.0
caused an issue.
@warmwaffles unfortunately, no change with 0.11.9 and a database filename:
iex(1)> {:ok, conn} = Exqlite.Sqlite3.open(":memory:")
** (UndefinedFunctionError) function Exqlite.Sqlite3NIF.open/2 is undefined (module Exqlite.Sqlite3NIF is not available)
(exqlite 0.11.9) Exqlite.Sqlite3NIF.open(':memory:', 6)
iex:1: (file)
iex(1)>
11:15:07.663 [warning] The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
{:load_failed,
'Failed to load NIF library c:/git/test-elixir/playground/_build/dev/lib/exqlite/priv/sqlite3_nif: \'Unspecified error\''}}
iex(1)> {:ok, conn} = Exqlite.Sqlite3.open("test.db")
** (UndefinedFunctionError) function Exqlite.Sqlite3NIF.open/2 is undefined (module Exqlite.Sqlite3NIF is not available)
(exqlite 0.11.9) Exqlite.Sqlite3NIF.open('test.db', 6)
iex:1: (file)
11:15:14.219 [warning] The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
{:load_failed,
'Failed to load NIF library c:/git/test-elixir/playground/_build/dev/lib/exqlite/priv/sqlite3_nif: \'Unspecified error\''}}
iex(1)> {:ok, conn} = Exqlite.Sqlite3.open("test.db")
11:15:41.770 [warning] The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
{:load_failed,
'Failed to load NIF library c:/git/test-elixir/playground/_build/dev/lib/exqlite/priv/sqlite3_nif: \'Unspecified error\''}}
** (UndefinedFunctionError) function Exqlite.Sqlite3NIF.open/2 is undefined (module Exqlite.Sqlite3NIF is not available)
(exqlite 0.11.9) Exqlite.Sqlite3NIF.open('test.db', 6)
iex:1: (file)
iex(1)>
Found a problem, sqlite3_nif.dll
is 32 bit, while erl.exe
is 64 bit.
That's strange, even when using the settings for a 64 bit compiler, a 32 bit DLL is generated.
Fixed via the instructions at https://github.com/riverrun/comeonin/issues/75 - a 64 bit NIF was needed.
@voltagex would you mind making a PR to the readme for special setup for windows? I think that would be beneficial to the next person.
@voltagex would you mind making a PR to the readme for special setup for windows? I think that would be beneficial to the next person.
I can, but I'm still confused as to how the Makefile can call x64 host tools and produce an x86 DLL. Do you know anyone who would have more of an insight into the way NIFs work?
To be honest, this is the first time I've touched Erlang / Elixir.
I am also wondering if there's a way to get a better error message (the underlying error should have been something along the lines of "bad image format")
There is a line in your compiler output that is really easy to miss
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x86
I wonder what your $CC
is set to. I wish I knew how to build stuff more in Windows.
You're right! Oops!
It seemed like even when opening "developer command prompt" for x64, I was getting the wrong compiler. The MSVC toolchain doesn't really use "$CC", but there is an equivalent vcvarsall.bat which sets the environment variables (mentioned by the other issue I linked)
Yea normally when I am compiling stuff in windows, it's usually with CMake and it handles all that hoop jumping for me.
Using Windows 10, exqite appears to build correctly, but I get
sqlite3_nif: Unspecified error
when trying to run{:ok, conn} = Exqlite.Sqlite3.open(":memory:")