Sqlite database option is difficult/broken out of the box on Windows.

393 views
Skip to first unread message

Eric Biesterfeld

unread,
Jan 18, 2016, 8:05:11 PM1/18/16
to phoenix-talk
Please place a warning somewhere that sqlite does not work on windows. A day's sordid story below:

I started to write this out as an issue, but it may or may not be a "documentation bug." I'd like to gather enough information to make this simpler.

The motivation for using Sqlite is that it is much easier to give example code that has an sqlite database than asking for someone to install and configure postgres. However, I've run into some problems getting an example running on windows.

The first error was an inability to find "cl.exe".
C:\work\hello_phoenix>mix ecto.build                                  
==> esqlite (compile)                                                                                                  
Compiling c_src/esqlite3_nif.c                                                                                         
'cl.exe' is not recognized as an internal or external command, operable program or batch file.                                                                                        
ERROR: compile failed while processing C:/work/hello_phoenix/deps/esqlite: rebar_abort                                                                                                        
** (Mix) Could not compile dependency :esqlite, "escript.exe "c:/Users/eric/.mix/rebar" compile skip_deps=true deps_dir=C:/work/hello_phoenix/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile esqlite", update it with "mix deps.update esqlite" or clean it with "mix deps.clean esqlite"                                            

Now Later, I find that rebar can point to GCC instead: see http://stackoverflow.com/questions/15043040/compiling-project-with-nifs-with-rebar-cl-exe-not-found?rq=1 -- this is likely a more stable option, but I don't know the opinons of the core team, and it's not immediately obvious how to point to gcc from mix. However, I went the Visual Studio route. After installing Visual Studio and downloading the universal installer -- I believe that's the package that finally installed cl.exe -- and placing C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin in the path:

mix ecto.build                                   ==> esqlite (compile)                                                                                                  
Compiling c_src/esqlite3_nif.c                                                                                        
 Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86                                                    
Copyright (C) Microsoft Corporation.  All rights reserved.                                                                                                                                                                                     
cl : Command line warning D9024 : unrecognized source file type 'Files/erl7.2/lib/erl_interface-3.8.1/include', object file assumed                                                                                                            
cl : Command line warning D9027 : source file 'Files/erl7.2/lib/erl_interface-3.8.1/include' ignored                   
cl : Command line warning D9024 : unrecognized source file type 'Files/erl7.2/erts-7.2/include', object file assumed   
cl : Command line warning D9027 : source file 'Files/erl7.2/erts-7.2/include' ignored                                  
esqlite3_nif.c                                                                                                         
c_src/esqlite3_nif.c(21): fatal error C1083: Cannot open include file: 'erl_nif.h': No such file or directory          
ERROR: compile failed while processing C:/work/hello_phoenix/deps/esqlite: rebar_abort                                                                                                        
** (Mix) Could not compile dependency :esqlite, "escript.exe "c:/Users/eric/.mix/rebar" compile skip_deps=true deps_dir="C:/work/hello_phoenix/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile esqlite", update it with "mix deps.update esqlite" or clean it with "mix deps.clean esqlite"                                                                      

More investigation finds this: http://stackoverflow.com/questions/7132598/erl-nif-h-not-found - however, the "source file ignored" leads me to believe it can't find erl_nif.h due to a space between Program and Files. I reinstall erlang and elixir and get past that message to:
 esqlite3_nif.c                                                                                                       
  c:\erl7.2\erts-7.2\include\erl_nif.h(68): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory                                                                                                                   
ERROR: compile failed while processingC:/work/hello_phoenix/deps/esqlite: rebar_abort   
...

And this is where I throw my hands up in frustration. Then, I see this on the esqlite page: https://github.com/mmzeeman/esqlite/issues/29

Considering it's a path issue, I don't know if it would or wouldn't work if I get through the next obstacle. Has anyone else had success? I could also pair with someone to solve this if windows machines aren't available.

mair.spi...@gmail.com

unread,
Feb 14, 2016, 3:54:09 AM2/14/16
to phoenix-talk
I have the same problem and no idea how to solve it since i'm fairly a beginner in the erlang / elixir world. Any help would be appreciated.

Steve Domin

unread,
Feb 19, 2016, 7:28:25 PM2/19/16
to phoenix-talk
There is a new comment on https://github.com/mmzeeman/esqlite/issues/29 that may help solve your issue. I can't test it since I don't have a Windows machine at hands but it's probably worth a try.

--
You received this message because you are subscribed to the Google Groups "phoenix-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-talk...@googlegroups.com.
To post to this group, send email to phoeni...@googlegroups.com.
Visit this group at https://groups.google.com/group/phoenix-talk.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/8ac3143a-ed99-4194-af8d-e02c6b141288%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

nauman...@gmail.com

unread,
Apr 12, 2016, 10:35:05 AM4/12/16
to phoenix-talk
I had to uninstall and reinstall ErLang in a path without spaces, and that worked for me.
Reply all
Reply to author
Forward
0 new messages