[DataMapper] Re: Error installing dm-sqlite-adapter: sqlite3.h missing | OS X 10.8.2 (Mountain Lion)

2013-01-31 Thread Abe Voelker
The gem needs the SQLite development headers in order to compile native 
code.  Having the sqlite3 binary installed (which sqlite3) is irrelevant to 
the problem.

I'm not overly familiar with Mac but I think you need to install 
homebrewhttp://mxcl.github.com/homebrew/and then execute brew 
install sqlite which should install what you need.  You'll need to have 
Xcode https://developer.apple.com/xcode/ installed before you try 
installing homebrew.

Good luck!

On Wednesday, January 30, 2013 2:41:25 PM UTC-6, Naii wrote:

 Hi there,


 *1. THE SITUATION*

 I try to create my first Sinatra (Ruby) app. Therefore I want to use the 
 dm-sqlite-adapter gem,
 which shall now be installed after data_mapper was installed before.


 *2. THE PROBLEM*

 So I did run:

 sudo gem install dm-sqlite-adapter


 in the terminal and got the following output:

 Building native extensions.  This could take a while...

 ERROR:  Error installing dm-sqlite-adapter:

 ERROR: Failed to build gem native extension.


 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
 extconf.rb

 checking for sqlite3.h... no

 *** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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}/lib



 Gem files will remain installed in 
 /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.12 for inspection.

 Results logged to 
 /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.12/ext/do_sqlite3/gem_make.out


 In addition, in the mkmf.log it's written:

 have_header: checking for sqlite3.h...  no
 xcrun cc -E -I. 
 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0
  
 -I. -I/usr/local/include -I/opt/local/include -I/usr/include 
  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE-g -Os -pipe -fno-common 
 -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -Wall   conftest.c -o 
 conftest.i
 xcode-select: Error: No Xcode is selected. Use xcode-select -switch 
 path-to-xcode, or see the xcode-select manpage (man xcode-select) for 
 further information.
 checked program was:
 /* begin */
 1: #include sqlite3.h
 /* end */
 



 *3. A SOLUTION, not yet.*

 Does anybody know how to tackle this issue?

 I did already look on several websites (including a question at 
 Stackoverflowhttp://stackoverflow.com/questions/12451964/gem-install-sqlite3-gives-error-sqlite3-h-is-missing,
  
 or 
 thishttp://stackoverflow.com/questions/1143776/install-sqlite3-on-mac-osxone)
  where they recommend to use sudo 
 apt-get install libsqlite3-dev which is only valid for Ubuntu or similar 
 Linux operating systems. I can't seem to find the right way to make the 
 sqlite3.h (Header file) detectable.

 But I did install sqlite3 using MacPorts with:

 sudo port install sqlite3

 and asking the terminal with which sqlite3 results in:

 /opt/local/bin/sqlite3


 So, sqlite3 seems to be installed properly.


 *4. ASK FOR HELP*

 Any tip or link is very much appreciated!

 Thanks in advance,
 - Alex 


-- 
You received this message because you are subscribed to the Google Groups 
DataMapper group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[DataMapper] Re: Error installing dm-sqlite-adapter: sqlite3.h missing | OS X 10.8.2 (Mountain Lion)

2013-01-31 Thread Naii

Thx, Mr. Voelker! :)

Thanks to your answer, I was able to install with:

sudo gem install dm-sqlite-adapter


I'm not sure, but I believe the key was installing the full Xcode, not just 
the Command Line Tools (which I did before).


*THE LUCKY STEPS TO SUCCESS I MADE*

For others, who also run into this problem I did the following steps:

   1. Installed the latest Xcode 4.6 (Jan, 28th) from 
   https://connect.apple.com
   2. Uninstalled my already (via MacPorts) installed version of sqlite 
   using port uninstall sqlite *(not necessary, if you didn't install it 
   in the first place)*
   3. Did a cleanup of my already installed Homebrew version using brew 
   cleanup
  1. To be precise I used this line rm -rf /usr/local/Cellar 
  /usr/local/.git  brew cleanup but received the following error caused 
by 
  the part before : *Error: No such file or directory - 
  /usr/local/Cellar*
   4. Installed sqlite with Homebrew using brew install sqlite
  1. And yes, I received the warning: *Warning: It appears you have 
  MacPorts or Fink installed. Software installed with other package 
managers 
  causes known problems for Homebrew. If a formula fails to build, 
uninstall 
  MacPorts/Fink and try again.* — but I ignored it.
  2. Received this second warning: *Warning: This keg was marked 
  linked already, continuing anyway
  Warning: Could not link sqlite. Unlinking...
  Error: The `brew link` step did not complete successfully
  The formula built, but is not symlinked into /usr/local
  You can try again using `brew link sqlite'*
  3. So I tried brew link sqlite which resulted in: *Linking 
  /usr/local/Cellar/sqlite/3.7.14... Warning: Could not link sqlite. 
  Unlinking...
  
  Error: Could not symlink file: 
  /usr/local/Cellar/sqlite/3.7.14/bin/sqlite3
  Target /usr/local/bin/sqlite3 already exists. You may need to delete 
  it.
  To force the link and delete this file, do:
brew link -f formula_name
  
  To list all files that would be deleted:
brew link -n formula_name*
  4. So, I ignored this error as well and typed sudo gem install 
  dm-sqlite-adapter which ran successfully! :)
   
Pretty long journey, but worth it, I guess! ;)

Best regards,
- Alex


On Thursday, January 31, 2013 3:05:21 PM UTC+1, Abe Voelker wrote:

 The gem needs the SQLite development headers in order to compile native 
 code.  Having the sqlite3 binary installed (which sqlite3) is irrelevant 
 to the problem.

 I'm not overly familiar with Mac but I think you need to install 
 homebrewhttp://mxcl.github.com/homebrew/and then execute brew 
 install sqlite which should install what you need.  You'll need to have 
 Xcode https://developer.apple.com/xcode/ installed before you try 
 installing homebrew.

 Good luck!

 On Wednesday, January 30, 2013 2:41:25 PM UTC-6, Naii wrote:

 Hi there,


 *1. THE SITUATION*

 I try to create my first Sinatra (Ruby) app. Therefore I want to use the 
 dm-sqlite-adapter gem,
 which shall now be installed after data_mapper was installed before.


 *2. THE PROBLEM*

 So I did run:

 sudo gem install dm-sqlite-adapter


 in the terminal and got the following output:

 Building native extensions.  This could take a while...

 ERROR:  Error installing dm-sqlite-adapter:

 ERROR: Failed to build gem native extension.


 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
 extconf.rb

 checking for sqlite3.h... no

 *** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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}/lib



 Gem files will remain installed in 
 /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.12 for inspection.

 Results logged to 
 /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.12/ext/do_sqlite3/gem_make.out


 In addition, in the mkmf.log it's written:

 have_header: checking for sqlite3.h...  no
 xcrun cc -E -I. 
 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0
  
 -I. -I/usr/local/include -I/opt/local/include -I/usr/include 
  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE-g -Os -pipe -fno-common 
 -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -Wall   conftest.c -o 
 conftest.i
 xcode-select: Error: No Xcode is selected. Use xcode-select -switch 
 path-to-xcode, or see the