sparklemotion / sqlite3-ruby

Ruby bindings for the SQLite3 embedded database
https://github.com/sparklemotion/sqlite3-ruby/
BSD 3-Clause "New" or "Revised" License
768 stars 201 forks source link

gem install not working: backup.h #20

Closed lawrencepit closed 13 years ago

lawrencepit commented 13 years ago

Using latest sqlite3 3.7.3 version + latest of sqlite3-ruby from git:

$ sqlite3 --version
3.7.3

$ ruby setup.rb setup
---> lib
---> lib/sqlite3
<--- lib/sqlite3
<--- lib
---> ext
---> ext/sqlite3
make 
gcc -I. -I. -I/Users/admin/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/i686-darwin10.4.0 -I/Users/admin/project/sqlite3-ruby/ext/sqlite3 -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_NEXT_STMT -DHAVE_SQLITE3_BACKUP_INIT -DHAVE_SQLITE3_COLUMN_DATABASE_NAME -DHAVE_SQLITE3_ENABLE_LOAD_EXTENSION -DHAVE_SQLITE3_LOAD_EXTENSION -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -g -O2  -pipe -fno-common   -c backup.c
In file included from ./sqlite3_ruby.h:42,
                 from backup.c:1:
./backup.h:7: error: expected specifier-qualifier-list before ‘sqlite3_backup’
backup.c: In function ‘initialize’:
backup.c:61: error: ‘sqlite3_backup’ undeclared (first use in this function)
backup.c:61: error: (Each undeclared identifier is reported only once
backup.c:61: error: for each function it appears in.)
backup.c:61: error: ‘pBackup’ undeclared (first use in this function)
backup.c:75: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c: In function ‘step’:
backup.c:99: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c:100: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c: In function ‘finish’:
backup.c:113: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c:114: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c:115: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c: In function ‘remaining’:
backup.c:131: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c:132: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c: In function ‘pagecount’:
backup.c:147: error: ‘sqlite3BackupRuby’ has no member named ‘p’
backup.c:148: error: ‘sqlite3BackupRuby’ has no member named ‘p’
make: *** [backup.o] Error 1
'system make ' failed 
tenderlove commented 13 years ago

Does rake compile result in the same problem?

Where do you have sqlite3 installed?

Can you find the mkmf log file and put the file somewhere I can see?

Thanks!

lawrencepit commented 13 years ago

Please see:

https://gist.github.com/721470

and the file: ./ext/sqlite3/mkmf.log

https://gist.github.com/721475

Thnx!

tenderlove commented 13 years ago

I've installed rvm, ree, and still I can't seem to reproduce this. Unfortunately that means I need to ask more questions. :-(

How did you install sqlite3? If you install sqlite3 via macports, are you able to compile and run?

lawrencepit commented 13 years ago

Good question :)

I downloaded http://www.sqlite.org/sqlite-amalgamation-3.7.3.tar.gz, unzipped/untarred into ~/Downloads/sqlite-3.7.3, and cd into it.

The README of this gem mentions to install SQLite3, enabling option SQLITE_ENABLE_COLUMN_METADATA. I didn't think www.sqlite.org/compile.html was too clear about this, so after more searches I decided on adding this to sqlite-3.7.3/sqlite3.c at the top of the file:

#define SQLITE_ENABLE_COLUMN_METADATA

Then I did the ./configure ; make ; sudo make install magic.

For a complete transcript see: https://gist.github.com/723002

Thnx!

flippingbits commented 13 years ago

I'm facing the same issue after updating to sqlite3-ruby 1.3.2. Everything works fine with 1.3.1.

My setup: Ubuntu 10.04 Latest sqlite3 package.

tenderlove commented 13 years ago

@lawrencepit can you try with the macports version, or with the version available here:

http://sqlite.org/sqlite-3.7.3.tar.gz

lawrencepit commented 13 years ago

Installing that version gives me the same result.

I tried the macports:

 $ port variants sqlite3
 sqlite3 has the variants:
    universal: Build for multiple architectures
 $ sudo port install sqlite3 +universal
 --->  Computing dependencies for sqlite3
 --->  Fetching sqlite3
 --->  Attempting to fetch sqlite-3.6.22.tar.gz from http://aarnet.au.distfiles.macports.org/pub/macports/mpdistfiles/sqlite3
 ^C

But broke that off as it fetches 3.6.22 instead of 3.7.3.

Btw, in a different project I'm using sqlite3-ruby (1.3.1) (with sqlite3 3.7.3), and that works fine.

tenderlove commented 13 years ago

@lawrencepit, can you try the non amalgamation version? The one I link to?

lawrencepit commented 13 years ago

Just to make sure I could still install the 1.3.1 version on my machine with sqlite3 3.7.3 now installed, from scratch:

https://gist.github.com/726290

lawrencepit commented 13 years ago

I did try the non amalgamation version, but it gives me the same result. (see previous comment, that is with that non amalgamation version installed)

tenderlove commented 13 years ago

Version 3.6.22 is fine. You can use that version as well. Have you updated macports recently? Macports will install a 3.7.3:

[apatterson@ypcmc08885 ~]$ port list sqlite3
sqlite3                        @3.7.3          databases/sqlite3
[apatterson@ypcmc08885 ~]$ 
zenspider commented 13 years ago

Why is this issue titled "gem install not working" when you're clearly not using rubygems to install this? Installing the gem is really easy, esp on a mac. See this: http://www.youtube.com/watch?v=_DniiNL3Gog

tenderlove commented 13 years ago

I am having a hard time figuring out how to help. Here is a video of me developing with sqlite3, from git, using the built-in sqlite3 and the sqlite3 from macports:

http://www.youtube.com/watch?v=f33rtH1CVdw

lawrencepit commented 13 years ago

@zenspider: see the link I gave earlier: https://gist.github.com/726290

lawrencepit commented 13 years ago

Got it working now!

I usually don't use macports, 3.6.22 didn't install via macports, so tried sudo port selfupdate followed by sudo port install sqlite3. Didn't install either: https://gist.github.com/726421

Then did a full sudo port upgrade outdated, failed at the sqlite3 step. Did sudo port clean sqlite3 and retried port upgrade outdated. Macports then finished successfully: https://gist.github.com/726459

After which I was able to run rake compile and do gem install sqlite-ruby3 successfully.

I'm still mystified about what happened here. I do notice the line :

--->  Deactivating sqlite3 @3.6.1_0

Perhaps this occurs when sqlite3 v3.6.1 is still lying around? (which might be what @flippingbits has on his ubuntu system?)

Anyhow, thanks a lot for your help and patience with this !!