Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install sqlite3 for Ruby2.0.0 on Windows 7 #82

Closed
yuumi3 opened this issue Feb 26, 2013 · 26 comments
Closed

Unable to install sqlite3 for Ruby2.0.0 on Windows 7 #82

yuumi3 opened this issue Feb 26, 2013 · 26 comments

Comments

@yuumi3
Copy link

@yuumi3 yuumi3 commented Feb 26, 2013

C:\Ruby200\DevKit>gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include

          ….

        --without-sqlite3-lib=${sqlite3-dir}/
        --enable-local
        --disable-local


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1
.3.7 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out

and

C:\Ruby200\DevKit>gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.0
  - RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby200/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: C:/Ruby200/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby200/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby200/lib/ruby/gems/2.0.0
     - C:/Users/yy/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Feb 26, 2013

@yuumi3 looks like you don't have the sqlite3 headers and libs that are required to install sqlite3 gem from source.

The pre-compiled binary for x86-mingw32 do not include binaries for Ruby 2.0, so I guess you installed with --platform=ruby.

You should obtain the headers and libraries for sqlite3 and use build arguments:

gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=C:/path/to/sqlite3

Where C:/path/to/sqlite3 is where the headers (include) and libs (lib) for sqlite3 are extracted.

Hope that helps.

@luislavena luislavena closed this Feb 26, 2013
@yuumi3

This comment has been minimized.

Copy link
Author

@yuumi3 yuumi3 commented Feb 26, 2013

Thanks luislavena,

I built sqlite3 library by mingw32.

bash-3.1$ ls -l c:/sqlite3/lib
total 4347
-rw-r--r-- 1 yy Administrators 4313628 Feb 26 21:49 libsqlite3.a
-rw-r--r-- 1 yy Administrators  135652 Feb 26 21:49 libsqlite3.dll.a
-rw-r--r-- 1 yy Administrators     788 Feb 26 21:49 libsqlite3.la
drwxr-xr-x 2 yy Administrators       0 Feb 26 21:50 pkgconfig
bash-3.1$ ls -l c:/sqlite3/include
total 360
-rw-r--r-- 1 yy Administrators 343763 Feb 26 21:50 sqlite3.h
-rw-r--r-- 1 yy Administrators  24158 Feb 26 21:50 sqlite3ext.h

and tried gem install, but failed again. Do you have any suggestions ?

C:\Users\yy>gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=c:/sqlite3
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-sqlite3-dir=c:/sqlite3'
This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.
    C:/Ruby200/bin/ruby.exe extconf.rb --with-sqlite3-dir=c:/sqlite3
checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Feb 26, 2013

I built sqlite3 library by mingw32.

Have you used the same compiler of DevKit?

and tried gem install, but failed again.

What are the contents of mkmf.log ?

Please provide those.

@yuumi3

This comment has been minimized.

Copy link
Author

@yuumi3 yuumi3 commented Feb 26, 2013

Lavena thanks! I succeeded to install.

mkmf.log of "gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=c:/sqlite3" is

find_library: checking for sqlite3_libversion_number()... -------------------- -lsqlite3

"gcc -o conftest.exe -IC:/Ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/Ruby200/include/ruby-2.0.0/ruby/backward -IC:/Ruby200/include/ruby-2.0.0 -I. -IC:/sqlite3/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  
-L. -LC:/Ruby200/lib -LC:/sqlite3/ -L.      -lmsvcrt-ruby200 -lsqlite3  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:9:57: error: 'sqlite3_libversion_number' undeclared (first use in this function)
conftest.c:9:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:9:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:

-L option is wrong.

then I tried "gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:/sql
ite3/include --with-sqlite3-lib=c:/sqlite3/liby" , it's OK !

Thanks.

@jamespedid

This comment has been minimized.

Copy link

@jamespedid jamespedid commented Mar 2, 2013

I'm having the same issues here, and I'm confused on how to run the operation:

I have downloaded the source files, and placed them into the following directory:
C:\sqlite3\include
--sqlite3.h
--sqlite3ext.h
C:\sqlite3\liby
--shell.c
--sqlite3.c

And then I ran the following into the command line:
gem install sqlite3 -- --with-sqlite3-include=C:\sqlite3\include --with-sqlite3-lib=C:\sqlite3\liby

But the installation is still failing. Here's the copy of the mkmf.log file:

find_header: checking for sqlite3.h... -------------------- yes

"gcc -o conftest.exe -IC:/Ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/Ruby200/include/ruby-2.0.0/ruby/backward -IC:/Ruby200/include/ruby-2.0.0 -I. -IC:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby200/lib -LC:\sqlite3\liby -L. -lmsvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(void) {return 0;}
/
end */

"gcc -E -IC:/Ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/Ruby200/include/ruby-2.0.0/ruby/backward -IC:/Ruby200/include/ruby-2.0.0 -I. -IC:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -o conftest.i"
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/
end */


find_library: checking for sqlite3_libversion_number()... -------------------- -lsqlite3

"gcc -o conftest.exe -IC:/Ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/Ruby200/include/ruby-2.0.0/ruby/backward -IC:/Ruby200/include/ruby-2.0.0 -I. -IC:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby200/lib -LC:\sqlite3\liby -L. -lmsvcrt-ruby200 -lsqlite3 -lshell32 -lws2_32 -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:9:57: error: 'sqlite3_libversion_number' undeclared (first use in this function)
conftest.c:9:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /top/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { void ((volatile p)()); p = (void (()()))sqlite3_libversion_number; return 0; }
/
end */

"gcc -o conftest.exe -IC:/Ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/Ruby200/include/ruby-2.0.0/ruby/backward -IC:/Ruby200/include/ruby-2.0.0 -I. -IC:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby200/lib -LC:\sqlite3\liby -L. -lmsvcrt-ruby200 -lsqlite3 -lshell32 -lws2_32 -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:9:1: warning: implicit declaration of function 'sqlite3_libversion_number'
c:/ruby200/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lsqlite3
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /top/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { sqlite3_libversion_number(); return 0; }
/
end */


end of mkmf.log

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Mar 2, 2013

I'm having the same issues here, and I'm confused on how to run the operation:

I have downloaded the source files, and placed them into the following directory:

Actually you need to compile sqlite3, not place the sources.

sqlite3-ruby gem needs the headers and libraries. You need the result of the compilation of sqlite3 to point during gem installation and not sqlite3 sources.

See sqlite3 installation instructions, you will require to get familiar to compile code. Use DevKit to build sqlite3.

@CrisLi

This comment has been minimized.

Copy link

@CrisLi CrisLi commented Mar 25, 2013

I have downloaded the sqlite3.dll and sqlite3.def. Put them into C:\Windows\System32
And put the c and h files into the following directory.

D:\sqlite3\include
--sqlite3.h
--sqlite3ext.h
D:\sqlite3\liby
--shell.c
--sqlite3.c

then I run gem install sqlite3 --platform=ruby -- --with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby

I still got the errors.

Building native extensions with: '--with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby'
This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    D:/Ruby200/bin/ruby.exe extconf.rb --with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby
checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Then I checked the mkmf.log file.

find_header: checking for sqlite3.h... -------------------- yes

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L.      -lmsvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(void) {return 0;}
/* end */

"gcc -E -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/* end */

--------------------

find_library: checking for sqlite3_libversion_number()... -------------------- -lsqlite3

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L.      -lmsvcrt-ruby200 -lsqlite3  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:9:57: error: 'sqlite3_libversion_number' undeclared (first use in this function)
conftest.c:9:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: 
6: /*top*/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { void ((*volatile p)()); p = (void ((*)()))sqlite3_libversion_number; return 0; }
/* end */

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L.      -lmsvcrt-ruby200 -lsqlite3  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:9:1: warning: implicit declaration of function 'sqlite3_libversion_number'
d:/ruby200/devkit/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lsqlite3
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: 
6: /*top*/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { sqlite3_libversion_number(); return 0; }
/* end */

--------------------

Did I missing some thing? I think I don't need to compile the h file since I have downloaded dll file from sqlite3 website.

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Mar 25, 2013

Please see rubyinstaller list for sqlite3 package ready to be used.

Also, don't place files in system32 folder.

Sorry for top posting. Sent from mobile.
On Mar 25, 2013 3:15 AM, "evil850209" notifications@github.com wrote:

I have downloaded the sqlite3.dll and sqlite3.def. Put them into
C:\Windows\System32
And put the c and h files into the following directory.

D:\sqlite3\include
--sqlite3.h
--sqlite3ext.h
D:\sqlite3\liby
--shell.c
--sqlite3.c

then I run gem install sqlite3 --platform=ruby --
--with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby

I still got the errors.

Building native extensions with: '--with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby'
This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

D:/Ruby200/bin/ruby.exe extconf.rb --with-sqlite3-include=D:\sqlite3\include --with-sqlite3-lib=D:\sqlite3\liby

checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Then I checked the mkmf.log file.

find_header: checking for sqlite3.h... -------------------- yes

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L. -lmsvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(void) {return 0;}
/
end */

"gcc -E -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -o conftest.i"
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/
end */


find_library: checking for sqlite3_libversion_number()... -------------------- -lsqlite3

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L. -lmsvcrt-ruby200 -lsqlite3 -lshell32 -lws2_32 -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:9:57: error: 'sqlite3_libversion_number' undeclared (first use in this function)
conftest.c:9:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /top/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { void ((volatile p)()); p = (void (()()))sqlite3_libversion_number; return 0; }
/
end */

"gcc -o conftest.exe -ID:/Ruby200/include/ruby-2.0.0/i386-mingw32 -ID:/Ruby200/include/ruby-2.0.0/ruby/backward -ID:/Ruby200/include/ruby-2.0.0 -I. -ID:\sqlite3\include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LD:/Ruby200/lib -LD:\sqlite3\liby -L. -lmsvcrt-ruby200 -lsqlite3 -lshell32 -lws2_32 -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:9:1: warning: implicit declaration of function 'sqlite3_libversion_number'
d:/ruby200/devkit/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lsqlite3
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /top/
7: int main(void) {return 0;}
8: extern int t(void);
9: int t(void) { sqlite3_libversion_number(); return 0; }
/
end */


Did I missing some thing? I think I don't need to compile the h file since
I have downloaded dll file from sqlite3 website.


Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-15379243
.

@paulwis

This comment has been minimized.

Copy link

@paulwis paulwis commented Mar 25, 2013

I've figured out how to install the sqlite3 gem in windows. You must compile sqlite3 manually to a ".a" library file using msys from the rubyinstall devkit.

Download the sqlite3 autoconf from sqlite's site.

Compile the source code with .configure, make, and make install.

Go into the .libs directory, copy and paste the libsqlite3.a to your sqlite3 directory.

Then do gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=[sqlite3 directory].

I ended up extracting everything to my sqlite3 directory to make sure I had everything -- the .exe shell, the .dll, the source, all of it.

@VorontsovIE

This comment has been minimized.

Copy link

@VorontsovIE VorontsovIE commented Apr 14, 2013

It looks there is one more problem. On my system both sqlite3 and mysql2 successfully compiled with --platform ruby but sqlite_native.so (and similar file in mysql and also in bcrypt-ruby) wasn't copied from ext folder to lib folder. So libraries couldn't locate sqlite/sqlite_native though it was successfully compiled.
When I copied them manually all worked fine.
I'm not sure that this is an issue of sqlite3 because mysql2 and bcrypt-ruby gems had the same problem. But this info can help someone to economy their time when they see strange error.

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Apr 14, 2013

That seems to be a problem of rubygems 2.0.0

Upgrade to 2.0.3 and reinstall the gems should be able to solve that.

Sorry for top posting. Sent from mobile.
On Apr 14, 2013 6:17 PM, "Ilya Vorontsov" notifications@github.com wrote:

It looks there is one more problem. On my system both sqlite3 and mysql2
successfully compiled with --platform ruby but sqlite_native.so (and
similar file in mysql and also in bcrypt-ruby) wasn't copied from ext
folder to lib folder. So libraries couldn't locate sqlite/sqlite_native
though it was successfully compiled.
When I copied them manually all worked fine.
I'm not sure that this is an issue of sqlite2 because mysql2 and
bcrypt-ruby gems had the same problem. But this info can help someone to
economy their time when they see strange error.


Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-16360742
.

@jupeal

This comment has been minimized.

Copy link

@jupeal jupeal commented May 9, 2013

To: luislavena:

I just cannot update Rubygems from V2.0.0 to 2.0.3

C:\Setup\Gem>ver

Microsoft Windows [版本 6.1.7601]

C:\Setup\Gem>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

C:\Setup\Gem>sqlite3 --version
3.7.16.2 2013-04-12 11:52:43 \cbea02d93865ce0e06789db95fd9168ebac970c7

C:\Setup\Gem>gem -v
2.0.0

C:\Setup\Gem>gem update --system
Updating rubygems-update
ERROR: While executing gem ... (NoMethodError)
undefined method `satisfied_by?' for #<Gem::Version "2.0.3">

C:\Setup\Gem>gem -v
2.0.0

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented May 9, 2013

@jupeal if you can't use gem update --system to install, please use manual steps, as described in the rubygems website:

http://rubygems.org/pages/download

@jupeal

This comment has been minimized.

Copy link

@jupeal jupeal commented May 9, 2013

@luislavena:
Thanks, but after install directly, I still get V2.0.0?

C:\Setup\Gem>gem install rubygems-update
Successfully installed rubygems-update-2.0.3
Parsing documentation for rubygems-update-2.0.3
Done installing documentation for rubygems-update (0 sec).
1 gem installed

C:\Setup\Gem>gem -v
2.0.0

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented May 9, 2013

@jupeal seems you're messing the instructions. If you install rubygems-update as gem, you need to run update_rubygems command.

If you download the packages, you need to run ruby setup.rb, as linked before.

@jupeal

This comment has been minimized.

Copy link

@jupeal jupeal commented May 9, 2013

@luislavena

C:\Setup\Gem>update_rubygems
RubyGems 2.0.3 installed
Parsing documentation for rubygems-2.0.3
Installing ri documentation for rubygems-2.0.3

C:\Setup\Gem>gem -v
2.0.3

C:\Setup\Gem>gem install -l sqlite3-1.3.7.gem
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-1.3.7.gem:
ERROR: Failed to build gem native extension.

C:/PF/Ruby200/bin/ruby.exe extconf.rb

checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/PF/Ruby200/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/
--enable-local
--disable-local

Gem files will remain installed in C:/PF/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite
3-1.3.7 for inspection.
Results logged to C:/PF/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlit
e3/gem_make.out

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented May 9, 2013

@jupeal please re-read the above comments, you're not providing the location where it will find sqlite headers and libraries needed for compilation.

See other example here:

#82 (comment)

@jupeal

This comment has been minimized.

Copy link

@jupeal jupeal commented May 9, 2013

@luislavena

C:\Setup\Gem>7z l ..\SQLite\sqlite-dll-win32-x86-3071602.zip

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Listing archive: ..\SQLite\sqlite-dll-win32-x86-3071602.zip

Path = ..\SQLite\sqlite-dll-win32-x86-3071602.zip
Type = zip
Physical Size = 311059

Date Time Attr Size Compressed Name


2013-04-12 20:23:28 ..... 4369 1100 sqlite3.def
2013-04-12 20:23:29 ..... 612664 309637 sqlite3.dll


                            617033       310737  2 files, 0 folders

C:\Setup\Gem>7z e ..\SQLite\sqlite-dll-win32-x86-3071602.zip -o\PF\Ruby\lib

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Processing archive: ..\SQLite\sqlite-dll-win32-x86-3071602.zip

Extracting sqlite3.def
Extracting sqlite3.dll

Everything is Ok

Files: 2
Size: 617033
Compressed: 311059

C:\Setup\Gem>7z l ..\SQLite\sqlite-amalgamation-3071602.zip

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Listing archive: ..\SQLite\sqlite-amalgamation-3071602.zip

Path = ..\SQLite\sqlite-amalgamation-3071602.zip
Type = zip
Physical Size = 1404682

Date Time Attr Size Compressed Name


2013-04-12 20:21:39 D.... 0 0 sqlite-amalgamation-3071602

2013-04-12 20:21:39 ..... 98709 24905 sqlite-amalgamation-3071602
\shell.c
2013-04-12 20:21:39 ..... 4889312 1281673 sqlite-amalgamation-3071602
\sqlite3.c
2013-04-12 20:21:39 ..... 25656 4557 sqlite-amalgamation-3071602
\sqlite3ext.h
2013-04-12 20:21:39 ..... 344640 92531 sqlite-amalgamation-3071602
\sqlite3.h


                           5358317      1403666  4 files, 1 folders

C:\Setup\Gem>7z e -o\PF\Ruby200\include\ruby-2.0.0\i386-mingw32 ..\SQLite\sqlite
-amalgamation-3071602.zip

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Processing archive: ..\SQLite\sqlite-amalgamation-3071602.zip

Extracting sqlite-amalgamation-3071602
Extracting sqlite-amalgamation-3071602\shell.c
Extracting sqlite-amalgamation-3071602\sqlite3.c
Extracting sqlite-amalgamation-3071602\sqlite3ext.h
Extracting sqlite-amalgamation-3071602\sqlite3.h

Everything is Ok

Folders: 1
Files: 4
Size: 5358317
Compressed: 1404682

C:\Setup\Gem>gem install -l sqlite3-1.3.7.gem
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.7
Parsing documentation for sqlite3-1.3.7
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/sqlite3_native
.so, skipping
Done installing documentation for sqlite3 (0 sec).
1 gem installed

C:\Setup\Gem>tst.rb
C:/PF/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require' : 127: 找不到指定的程序。 - C:/PF/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3 .7/lib/sqlite3/sqlite3_native.so (LoadError) from C:/PF/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45 :inrequire'
from C:/PF/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb
:6:in rescue in <top (required)>' from C:/PF/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb :2:in<top (required)>'
from C:/PF/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:11
0:in require' from C:/PF/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:11 0:inrescue in require'
from C:/PF/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35
:in require' from C:/R/tst.rb:23:in

'

Note: the error statement is:
require 'sqlite3'

C:\Setup\Gem>dir C:\PF\Ruby200\lib\ruby\gems\2.0.0\gems\sqlite3-1.3.7\lib\sqlite
3\sqlite3_native.so
驱动器 C 中的卷是 Windows7_OS
卷的序列号是 BC32-9039

C:\PF\Ruby200\lib\ruby\gems\2.0.0\gems\sqlite3-1.3.7\lib\sqlite3 的目录

2013-05-09 11:24 33,792 sqlite3_native.so
1 个文件 33,792 字节
0 个目录 172,031,561,728 可用字节

To be compare:

C:\Setup\Gem>dir C:\PF\Ruby193\lib\ruby\gems\1.9.1\gems\sqlite3-1.3.6-x86-mingw3
2\lib\sqlite3\1.9\sqlite3_native.so
驱动器 C 中的卷是 Windows7_OS
卷的序列号是 BC32-9039

C:\PF\Ruby193\lib\ruby\gems\1.9.1\gems\sqlite3-1.3.6-x86-mingw32\lib\sqlite3\1.
9 的目录

2012-07-24 08:36 580,608 sqlite3_native.so
1 个文件 580,608 字节
0 个目录 172,026,019,840 可用字节

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented May 9, 2013

And here (mentioned in #86), where to find the knapsack package for sqlite3

https://groups.google.com/d/msg/rubyinstaller/gedIaMryCFQ/99NlyvecwmAJ

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented May 9, 2013

@jupeal please stop, step back for a second and think what are you doing (and read the responses first)

  • You have the x86-mingw32 gem installed, for compilation to work, you need to remove and always do --platform=ruby during installation
  • You need to obtain a sqlite3 package that provides both headers and libs to link against it, the dll is not enough
  • To use the amargamation package you need to know what you're doing and know about compiling stuff, you're pointing it to the wrong place
  • For sqlite3 to work (after proper use of sqlite3 headers/libs and the compilation of the gem), sqlite3.dll needs to be placed somewhere in the PATH.

Please, please see the post at RubyInstaller group that I've linked before:

https://groups.google.com/forum/#!msg/rubyinstaller/gedIaMryCFQ/99NlyvecwmAJ

@jupeal

This comment has been minimized.

Copy link

@jupeal jupeal commented May 9, 2013

@luislavena

I cannot reach https://groups.google.com , but I found http://code.activestate.com/lists/ruby-talk/39791/
After follow the instructions, I still get the same error.

So I delete source files I copy into \PF\Ruby200\include\ruby-2.0.0\i386-mingw32 , and delete dll files I copy into \PF\Ruby200\lib

Then I follow the instructions again, the sqlite3 now work.

mkdir \knapsack
chdir \knapsack
download http://packages.openknapsack.org/sqlite/sqlite-3.7.15.2-x86-windows.tar.lzma
bsdtar --lzma -xf \setup\sqlite\sqlite-3.7.15.2-x86-windows.tar.lzma
gem install -l \setup\gem\sqlite3-1.3.7.gem --platform=ruby -- --with-opt-dir=C:/Knapsack
Building native extensions with: '--with-opt-dir=C:/Knapsack'
This could take a while...
Successfully installed sqlite3-1.3.7
Parsing documentation for sqlite3-1.3.7
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/sqlite3_native
.so, skipping
1 gem installed

C:\knapsack>irb
DL is deprecated, please use Fiddle
irb(main):001:0> require 'sqlite3'
=> true
irb(main):002:0> SQLite3::SQLITE_VERSION
=> "3.7.15.2"
irb(main):003:0> exit

Great! Many thanks to you all!

@DantaliaN00

This comment has been minimized.

Copy link

@DantaliaN00 DantaliaN00 commented May 29, 2013

solved with

http://www.sqlite.org/download.html
dl -> sqlite-amalgamation
-> sqlite-dll-win32-x86

and extract same:

-include
--sqlite3.h
--sqlite3ext.h
-lib
--shell.c
--sqlite3.c
-sqlite3.def
-sqlite3.dll

and install gem

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll

it works for me

@thomstabk

This comment has been minimized.

Copy link

@thomstabk thomstabk commented Jun 22, 2013

@DantaliaN00 that worked for me too!
Rails localhost is up and running after much trial and error.

The one trick I may mention is to update your gems, uninstall all versions of sqlite and reinstall the sqlite3 gem.

Thanks all!

@dlamichhane

This comment has been minimized.

Copy link

@dlamichhane dlamichhane commented Jun 30, 2013

I hope this links provides the solution in detail.
http://rubyonwindowsguides.github.io/book/ch02-05.html

@ALiiEN

This comment has been minimized.

Copy link

@ALiiEN ALiiEN commented Dec 9, 2015

I'm getting this problem.

$ gem install sqlite3 --platform=ruby -- --with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_t
o_dll
Building native extensions with: '--with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll'
This could take a while...
C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39: warning: Tempfile#unlink or delete called on open file; ignoring
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

C:/jruby-9.0.0.0/bin/jruby.exe -r ./siteconf20151208-24888-1kbf9cg.rb extconf.rb --with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll

NotImplementedError: C extensions are not supported
at C:/jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:940
(root) at C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
at extconf.rb:3

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.0.0.0/lib/ruby/gems/shared/gems/sqlite3-1.3.11 for inspection.
Results logged to C:/jruby-9.0.0.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.2.0/sqlite3-1.3.11/gem_make.out

@luislavena

This comment has been minimized.

Copy link
Member

@luislavena luislavena commented Dec 9, 2015

Hello,

JRuby does not support Center extensions, which is being informed in the
error message:

NotImplementedError: C extensions are not supported

sqlite3-ruby links to libsqlite3 using a V extension.

You need to use instead jdbc-sqlite or similar. I don't know JRuby and the
Java ecosystem to provide you further guidance.

Sorry for top posting, sent from mobile.
On Dec 9, 2015 01:56, "Frank Seager" notifications@github.com wrote:

Im getting this proglem.

$ gem install sqlite3 --platform=ruby --
--with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib
--with-sqlite3-dir=path_t
o_dll
Building native extensions with: '--with-sqlite3-include=path_to_include
--with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll'
This could take a while...
C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39:
warning: Tempfile#unlink or delete called on open file; ignoring
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

C:/jruby-9.0.0.0/bin/jruby.exe -r ./siteconf20151208-24888-1kbf9cg.rb extconf.rb --with-sqlite3-include=path_to_include --with-sqlite3-lib=path_to_lib --with-sqlite3-dir=path_to_dll

NotImplementedError: C extensions are not supported
at C:/jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:940
(root) at
C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
at extconf.rb:3

extconf failed, exit code 1

Gem files will remain installed in
C:/jruby-9.0.0.0/lib/ruby/gems/shared/gems/sqlite3-1.3.11 for inspection.
Results logged to
C:/jruby-9.0.0.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.2.0/sqlite3-1.3.11/gem_make.out


Reply to this email directly or view it on GitHub
#82 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.