Ruby on rails 在RVM的mac os x 10.9上安装ruby odbc gem
我试图将ruby odbc gem安装在Mac OS X 10.9上的ruby-1.9.3-p547下,用于rails 2.3.12应用程序,该应用程序通过odbc连接到SAP系统 环境Ruby on rails 在RVM的mac os x 10.9上安装ruby odbc gem,ruby-on-rails,odbc,unixodbc,Ruby On Rails,Odbc,Unixodbc,我试图将ruby odbc gem安装在Mac OS X 10.9上的ruby-1.9.3-p547下,用于rails 2.3.12应用程序,该应用程序通过odbc连接到SAP系统 环境 This could take a while... ERROR: Error installing ruby-odbc: ERROR: Failed to build gem native extension. /Users/grantsayer/.rvm/rubies/ruby-1.9.3-p547/b
This could take a while...
ERROR: Error installing ruby-odbc:
ERROR: Failed to build gem native extension.
/Users/grantsayer/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-odbc-dir=/usr/local/iODBC --with-odbc-include=/usr/local/iODBC/include
checking for version.h... no
checking for sql.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
--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=/Users/grantsayer/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-odbc-dir
--with-odbc-include=${odbc-dir}/include
--with-odbc-lib
--without-odbc-lib=${odbc-dir}/lib
ERROR: sql.h not found
extconf failed, exit code 1
- MacOSX10.9(小牛)
- 安装了ruby 1.9.3和其他rubies的RVM
- 适用于Rails 2.3.12应用程序的Gems
- 酿制
- 已安装iODBC
gem install ruby-odbc
抱怨找不到中的sql.h
ERROR: sql.h not found
然后,我试图告诉gem安装环境ODBC头的位置
gem install ruby-odbc -- --with-odbc-dir=/usr/local/iODBC
但这仍然失败,并显示以下消息(基本上仍然找不到sql.h头文件)
此时-由于无法建造宝石而被卡住
This could take a while...
ERROR: Error installing ruby-odbc:
ERROR: Failed to build gem native extension.
/Users/grantsayer/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-odbc-dir=/usr/local/iODBC --with-odbc-include=/usr/local/iODBC/include
checking for version.h... no
checking for sql.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
--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=/Users/grantsayer/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-odbc-dir
--with-odbc-include=${odbc-dir}/include
--with-odbc-lib
--without-odbc-lib=${odbc-dir}/lib
ERROR: sql.h not found
extconf failed, exit code 1
我们已经解决了这个问题。关键是将gem安装为的命令
gem install ruby-odbc -- --with-odbc-dir=/usr/local/iODBC/
在此之前的关键步骤是按照步骤重新安装软件堆栈
gem install ruby-odbc -- --with-odbc-dir=/usr/local/iODBC/
重要的部分是指向已安装的头和库的路径,这些头和库通过iODBC安装放在/usr/local/iODBC中
成功是当您收到一条常见的快乐消息,即安装了gem,如下所示:
gem install ruby-odbc -- --with-odbc-dir=/usr/local/iODBC/
Building native extensions with: '--with-odbc-dir=/usr/local/iODBC/'
This could take a while...
Successfully installed ruby-odbc-0.99995
Enclosing class/module 'Modbc' for class Object not known
Enclosing class/module 'Modbc' for class Environment not known
Enclosing class/module 'Modbc' for class Database not known
Enclosing class/module 'Modbc' for class Statement not known
Enclosing class/module 'Modbc' for class Column not known
Enclosing class/module 'Modbc' for class Parameter not known
Enclosing class/module 'Modbc' for class DSN not known
Enclosing class/module 'Modbc' for class Driver not known
Enclosing class/module 'Modbc' for class Error not known
Enclosing class/module 'Modbc' for class Date not known
Enclosing class/module 'Modbc' for class Time not known
Enclosing class/module 'Modbc' for class TimeStamp not known
Installing ri documentation for ruby-odbc-0.99995
1 gem installed
我在macOs Sierra 10.12上也有类似的问题 我所做的:
brew install libiodbc
然后检查已安装软件包的版本(应类似于libiodbc-3.52.12),如果以下命令中有不同的更改:
gem install ruby-odbc -- --with-odbc-dir=/usr/local/Cellar/libiodbc/3.52.12/
祝你好运。还有一项-请注意,如果我在gem之外构建odbc.bundle,我就可以构建它;i、 e使用下载的源代码包并运行ruby-Cext extconf.rb谢谢您回答自己的问题!您还可以使用
brew安装libiodbc
安装iODBC,然后使用gem安装ruby odbc--with odbc dir=/usr/local/ceral/libiodbc/3.52.12/bin/iODBC
安装gem,确保与几分钟前我刚安装的路径中的版本匹配。但在我的bin文件夹中,我有以下3个文件:iodbc config iodbctest iodbctest iodbctsw我不知道如何继续拥有iodbc.ini文件。