gpt4 book ai didi

ruby-on-rails - 在RVM中的Mac OS X 10.9上安装ruby-odbc gem

转载 作者:行者123 更新时间:2023-12-04 04:58:45 37 4
gpt4 key购买 nike

我正在尝试在ruby-1.9.3-p547下的Mac OS X 10.9上安装ruby-odbc gem,以与通过ODBC连接到SAP系统的rails 2.3.12应用程序一起使用。

环境

  • Mac OS X 10.9(小牛)
  • 装有ruby 1.9.3和其他 ruby 的
  • RVM
  • Gems for Rails 2.3.12应用程序
  • 酿造
  • 已安装iODBC的

  • 情况

    gem系统在执行时使构建失败
    gem install ruby-odbc 

    提示无法像中那样找到 sql.h
    ERROR: sql.h not found

    然后,我尝试通过以下方式告诉gem安装环境ODBC header 位于何处:
    gem install ruby-odbc -- --with-odbc-dir=/usr/local/iODBC

    但这仍然失败,并显示以下消息( 基本上仍然找不到sql.h头文件)。

    在这一点上-卡住了,无法获得构建的gem
    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/

    之前的关键步骤是按照以下步骤重新安装软件堆栈
  • 安装Homebrew:请参见-通过命令
  • Brew

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


  • 安装RVM

  • $ \curl -sSL https://get.rvm.io | bash -s stable


  • 安装Ruby-1.9.3,供与ODBC
  • 连接的应用程序使用

    rvm install ruby-1.9.3


  • 安装iODBC系统,请参见:iODBC Wiki

  • 有多个版本,其中Mac OX版本作为DMG文件提供,用于在应用程序中安装驱动程序管理器,以及构建ruby-odbc gem所需的头文件。

    http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/Downloads#Mac%20OS%20X


  • 安装ruby-odbc gem

  • ruby -odbc gem 在 Ruby ODBC中进行了描述。这描述了原始源的构建,但是gem install生态系统将获取源并进行构建。
    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

    关于ruby-on-rails - 在RVM中的Mac OS X 10.9上安装ruby-odbc gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26052954/

    37 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com