elixir-sqlite / exqlite

An SQLite3 driver for Elixir
https://hexdocs.pm/exqlite
MIT License
208 stars 47 forks source link

Can I use precompiled binaries on windows? #268

Closed spapas closed 11 months ago

spapas commented 11 months ago

Hello friends, I see in the releases page that there's a precompiled binary (?) for windows. However, when I try to install {:exqlite, "~> 0.16"}, I get:

could not compile dependency :exqlite, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile exqlite --force", update it with "mix deps.update exqlite" or clean it with "mix deps.clean exqlite"
==> hellosqlite3
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

meaning it tries to compile it and doesn't use the precompiled binaries. I tried passing config :exqlite, make_force_build: false to my config.exs but nothing changed. What am I doing wrong?

warmwaffles commented 11 months ago

@cocoa-xu would you happen to know why the precompiled binary is not being picked up in the Windows environment?

cocoa-xu commented 11 months ago

Hi @spapas, it should pickup the precompiled library without using nmake; I wonder if there were more relevant error messages before could not compile dependency :exqlite. And if it fails to pickup the precompiled library, it should fallback to compile from source, and based on your error message, it appears that nmake is not found on your system, and there are 2 possible reasons that I can think of for now:

  1. make, ships with Visual Studio, is not installed
  2. you're not in the Visual Studio developer command prompt

So, for the first case, if you haven't installed any version of Visual Studio, you'll need to download and install one (community version is okay).

But if you already have Visual Studio installed, you need to be in the Visual Studio developer command prompt. Basically, it will update the PATH environment variable so that nmake can be found. Reference link: https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170

cocoa-xu commented 11 months ago

Oh, one more reason is that maybe you're using OTP 26 on Windows, and the precompiled version isn't available yet.

spapas commented 11 months ago

@cocoa-xu thank you for the tips. Yes, I am using otp-26.

Any idea when the precompiled binaries for otp-26 will be available?

Thank you

cocoa-xu commented 11 months ago

@spapas It should be there once adding OTP 26 to the precompile.yml and then releasing a minor update. :)

/cc @warmwaffles

spapas commented 11 months ago

Excellent thank you very much!

warmwaffles commented 11 months ago

Fix has been released under v0.16.1

spapas commented 11 months ago

Hello, unfortunately I still get the same behavior; the pre-compiled binaries aren't used.

Here's my elixir/erlang version:

Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.15.6) - press Ctrl+C to exit (type h() ENTER for help)

Also here's the exqlite package:

* exqlite (Hex package) (mix)
  locked at 0.16.1 (exqlite) 4d40bbb6

However I still see the same when compiling:

C:\progr\elixir>mix deps.compile exqlite
==> exqlite
could not compile dependency :exqlite, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile exqlite --force", update it with "mix deps.update exqlite" or clean it with "mix deps.clean exqlite"

** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.
cocoa-xu commented 11 months ago

Hello, unfortunately I still get the same behavior; the pre-compiled binaries aren't used.

Ahh, I missed this line in mix.exs. It should be changed to

Enum.member?(["2.16", "2.17"], nif_version)
warmwaffles commented 11 months ago

bah okay I'm on it

warmwaffles commented 11 months ago

Okay this time, I hope @spapas. Fix released with v0.16.2.

spapas commented 11 months ago

@warmwaffles yes! Finally it works:

==> exqlite
Downloading precompiled NIF to c:/Users/serafeim/AppData/Local/Cache/exqlite-nif-2.17-x86_64-windows-msvc-0.16.2.tar.gz

Thank you!

warmwaffles commented 11 months ago

No problem @spapas, please open more tickets if you run into any windows specific issues. I don't use windows regularly and do not have a dev environment set up for it. Feedback on that experience is greatly appreciated.