【问题标题】:Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds无法在 Mac OS X 10.8 上使用 Homebrew FreeTds 捆绑安装 tiny_tds
【发布时间】:2013-02-06 21:46:14
【问题描述】:

我的问题
我可以采取哪些可靠的步骤来 100% 完成这项工作? 我需要真正的指导,而不是一个简单的答案或对过程的模糊概念描述。

让我们深入了解这一点。 似乎某处存在冲突,我在 GitHub 上的 gem 开发人员就我在 Ruby / Rails / Bundler / Homebrew 方面的经验得到了低于标准的帮助,所以这不完全是他们的错:P 但我需要弄清楚如何尽快让这个工作正常,所以我目前的这个问题是这样的。


更新:2013 年 2 月 25 日
更新了 GCC / XCODE 版本 4.6 (4H127) 并下载了最新版本的 XCODE 命令行工具 现在 iconv_open() 出现在 extconf 检查器中。 现在我收到这些错误:

我相信它们现在是 tiny_tds 和与最新 xcode 路径兼容性的问题。

    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
    checking for iconv_open() in iconv.h... yes
    checking for sybfront.h... yes
    checking for sybdb.h... yes
    checking for tdsdbopen() in -lsybdb... yes
    checking for ct_bind() in -lct... yes
    creating Makefile

    make
    xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c client.c
    xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
    xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c result.c
    xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
    xcrun cc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I-I/usr/local/php5/include -I-I/usr/include -I-I/usr/local/include -I-I/opt/local/include -I-I/usr/local/MacGPG2/include -I-I/opt/sm/pkg/active/include -I/usr/local/php5/include -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/local/MacGPG2/include -I/opt/sm/pkg/active/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -c tiny_tds_ext.c
    xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
    cc  -pipe -bundle -undefined dynamic_lookup -o tiny_tds.bundle client.o result.o tiny_tds_ext.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/heroku/lib -L/usr/local/php5/lib -L/usr/local/Cellar/ruby/1.9.3-p194/lib -L/usr/lib -L/usr/local/lib -L/opt/local/lib -L/usr/local/MacGPG2/lib -L/opt/sm/pkg/active/lib -L/Users/rountrjf/.rvm/lib -L/usr/local/Cellar/vertx/lib -L/usr/local/Cellar/vertx/mods/node.vert.x/lib -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L.       -lruby -lct -lsybdb  -lpthread -ldl -lobjc   
    i686-apple-darwin11-llvm-gcc-4.2: client.o: No such file or directory
    i686-apple-darwin11-llvm-gcc-4.2: result.o: No such file or directory
    i686-apple-darwin11-llvm-gcc-4.2: tiny_tds_ext.o: No such file or directory
    make: *** [tiny_tds.bundle] Error 1

Alright, since /Developer doesn't exist.
I used `sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer` thinking that would fix it.  Now I'm back to square one... iconv_open() not found when checked with `extconf.rb`

更新 2:2013 年 2 月 25 日
好的,所以我重新安装了所有东西,Ruby / Rails / 等。 并使用评论者的一些建议来使用 ":path =>" 这是我现在运行rails s时的输出@

/Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- tiny_tds (LoadError)
    from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
    from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:31:in `sqlserver_connection'
    from /Users/rountrjf/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'

我尝试过的事情

1.) 初始 EASY 设置说明与任何其他说明一样...

$ rails new test_app
$ cd test_app

现在将这些行添加到Gemfile

gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'

现在继续命令...

$ bundle install

Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.3) 
Using i18n (0.6.1) 
Using multi_json (1.6.1) 
Using activesupport (3.2.12) 
Using builder (3.0.4) 
Using activemodel (3.2.12) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.2.2) 
Using actionpack (3.2.12) 
Using mime-types (1.21) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.4.4) 
Using actionmailer (3.2.12) 
Using arel (3.0.2) 
Using tzinfo (0.3.35) 
Using activerecord (3.2.12) 
Using activerecord-sqlserver-adapter (3.2.10) 
Using activeresource (3.2.12) 
Using bundler (1.2.4) 
Using coffee-script-source (1.4.0) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Using json (1.7.7) 
Using rdoc (3.12.1) 
Using thor (0.17.0) 
Using railties (3.2.12) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.2.1) 
Using rails (3.2.12) 
Using sass (3.2.5) 
Using sass-rails (3.2.6) 
Installing tiny_tds (0.5.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/Cellar/ruby/1.9.3-p194/bin/ruby extconf.rb 
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing.
-----
*** 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=/usr/local/Cellar/ruby/1.9.3-p194/bin/ruby
    --enable-lookup
    --disable-lookup
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-freetds-dir
    --without-freetds-dir
    --with-freetds-include
    --without-freetds-include=${freetds-dir}/include
    --with-freetds-lib
    --without-freetds-lib=${freetds-dir}/lib
    --with-iconvlib
    --without-iconvlib


Gem files will remain installed in /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/tiny_tds-0.5.1 for inspection.
Results logged to /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/tiny_tds-0.5.1/ext/tiny_tds/gem_make.out
An error occurred while installing tiny_tds (0.5.1), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.5.1'` succeeds before bundling.

tsql -C的输出

$ tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /usr/local/Cellar/freetds/0.91/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 7.1
                              iODBC: yes
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no

2.) 想象中的成功 / 假装成功 / 大失所望 / 高级设置说明
找到这个博客条目... http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html

然后我找到了 libiconv 库和 freetds 库的正确路径。 接下来,我是这样运行的:

$ sudo gem install tiny_tds -- --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib --with-freetds-lib=/usr/local/Cellar/freetds/0.91/lib --with-freetds-include=/usr/local/Cellar/freetds/0.91/include
Password:
Building native extensions.  This could take a while...
Successfully installed tiny_tds-0.5.1
1 gem installed
Installing ri documentation for tiny_tds-0.5.1...
Installing RDoc documentation for tiny_tds-0.5.1...

再次尝试bundle_install,震惊了...它仍然没有通过Gemfile中的gem 'tiny_tds'安装...

所以我从 Gemfile 中删除 tiny_tds 并继续启动服务器... 正如预期的那样......

$ rails s
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- tiny_tds (LoadError)
...

3.) MINI PORTILE

$ sudo gem install mini_portile
$ sudo gem install rakecompiler
$ rake TINYTDS_FREETDS_VERSION="current"
Could not find gem 'tiny_tds (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

其他相关问题和资源

【问题讨论】:

  • 我有一个非常相似的问题,下面的链接解决了它
  • 您是要附加链接吗?
  • 对不起,意识到这对您没有帮助,您已经完成了链接中的内容。
  • 好吧,我是 Ruby / Rails 的新手,可能没有完全按照他们应该做的那样做。我看过的说明可能忽略了一些新手可能会错过的细节?
  • 另外,您会认为有一种万无一失的方法...例如卸载所有内容并重新开始...但我不确定它会解决它...但如果有人已经经历过这个 - 我很想听听。

标签: ruby-on-rails ruby macos freetds tiny-tds


【解决方案1】:

这对我有用(2014 年 10 月 2 日/OSX 10.9.5):

brew install freetds

在轨道上:

gem 'tiny_tds'
bundle install

【讨论】:

  • 在 macOS 10.13 上需要这个。这很好用。谢谢!
  • 我可以验证这适用于 macOS 10.14.1 和 ruby​​ 版本 2.5.1。
【解决方案2】:

首先安装free_tds 和所需的依赖项。

这对我有用,你的路径可能不同

gem install tiny_tds -- --with-freetds-include=/usr/local/include
--with-freetds-lib=/usr/local/lib
--with-iconv-include=/usr/local/Cellar/libiconv/1.14/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib

【讨论】:

  • 当然你也可以重新安装ruby 1.9.3并指定iconv-dir,但我的解决方案要快一些。
【解决方案3】:

好吧,不幸的是,我现在已经让它工作了,但我不知道我是如何做到的,但我会在这个答案中列出我迄今为止所做的所有事情来解决它。

最后,bundle install 和标准 gem 'tiny_tds', '0.5.1' 最终工作正常。 它通过 RVM 运行 Ruby 版本 1.9.3-p194。

我很确定这就是黄金的所在......
我用rvm pkg install iconvrvm reinstall 1.9.3 --with-iconv-dir=$rvm_path/usr

完成后,我删除了所有旧的 gem 文件夹... 我切换了捆绑配置路径以匹配新的 ruby​​ 路径...

然后进行捆绑安装,然后繁荣。

它也在使用 iconv 1.13 而不是 1.14 不确定这是否重要。

我希望这对任何人都有帮助......这对我来说绝对是一次巨大的学习经历。

【讨论】:

    【解决方案4】:

    我已经解决了:

    brew install freetds
    

    然后

    bundle install
    

    【讨论】:

      【解决方案5】:

      我对 Ruby 了解不多。只是摸索了一下。您始终可以直接安装 vertx,而不是我认为您对目录位置有更多控制权,并且它使升级更容易。我为 Ops 团队编写了一份生产指南(实际上是一项正在进行的工作)。它可能会帮助你。可能不会。

      我写了一个小安装指南。我计划添加一些关于如何配置 TCP/IP 堆栈和 Vertx 以进行扩展的调整(临时端口设置、文件描述符限制、负载测试、调整回收缓冲区等)

      http://rick-hightower.blogspot.com/2013/11/installing-vertx-on-ubuntu-13.html

      在 Ubuntu 13 上安装 Vertx

      环境详情

      实例类型:EC2 hi1.4xlarge

      • 操作系统:Ubuntu 13.10(64 位)Java VM:

      • java 版本“1.7.0_25”(IcedTea 2.3.12)(内部版本 23.7-b01)

      • vertx:2.1M1(建于 2013-10-29 11:11:22)

      安装软件

      Java 7 JDK:

       $ sudo apt-get install openjdk-7-jdk
      

      顶点

      下载顶点

      $ wget http://dl.bintray.com/vertx/downloads/vert.x-2.1M1.tar.gz
      $ tar -zxf vert.x-2.1M1.tar.gz 
      $ ls
      vert.x-2.1M1  vert.x-2.1M1.tar.gz
      

      进入标准 Unix 结构:

      $ sudo mv vert.x-2.1M1 /usr/local/share/
      $ ls /usr/local/share/
        ...  vert.x-2.1M1  xml
      

      创建指向 /usr/local/share/vertx 的符号链接,以便升级更容易。

      $ sudo ln -s /usr/local/share/vert.x-2.1M1/ /usr/local/share/vertx
      $ ls /usr/local/share/vertx
      api-docs  bin  client  conf  lib
      

      将 vertx 符号链接添加到您的 /usr/bin/ 目录。

      $ sudo ln -s /usr/local/share/vertx/bin/vertx /usr/bin/vertx
      

      安装一个真正该死的编辑器:

      $ sudo apt-get install emacs
      

      创建测试脚本以测试vertx是否正确安装:

      var vertx = require('vertx');
      vertx.createHttpServer().requestHandler(function(r) {
      r.response.end("test 1\n");}).listen(8080);
      

      现在针对测试脚本运行 vertx:

      $ vertx run test.js &
      [1] 11493
      $ Succeeded in deploying verticle 
      

      现在测试安装是否正常:

      $ curl 127.0.0.1:8080
      test 1
      

      如果你得到“测试 1”,这意味着 vertx 已安装并且能够为 verticles 提供服务器。

      稍后我计划添加 init.d 脚本来启动 vertx,也许还有一个进程会唤醒并确保每分钟左右一切都在运行。我还计划使用 NGINX 反向代理来处理一些 vertx 实例,这样每个盒子可以处理接近 1,000,000 个请求并具有更多的 DOS 保护。无论如何...正在进行中的工作...

      【讨论】:

        【解决方案6】:

        对我有用的是上面 mr.ruh.roh 的宝石构建选项,在此处复制:

        gem install tiny_tds -- --with-freetds-include=/usr/local/include   
            --with-freetds-lib=/usr/local/lib
            --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include
            --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib
        

        在一行中。该 gem install 安装了 gem,但即使 gem 已经构建和安装,捆绑仍然失败。然而,为捆绑器添加这些选项是有效的。

        bundle config build.tiny_tds -- --with-freetds-include=/usr/local/include 
          --with-freetds-lib=/usr/local/lib 
          --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include 
          --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib
        

        再次,在一行中。使用该捆绑器配置集,bundle install 工作。

        注意我已经跑过了:

        brew install freetds
        brew install libiconv
        

        这对我来说于 2015 年 2 月 20 日在安装了 Xcode 6.1.1 的 OS X 10.9.5 上工作

        【讨论】:

          猜你喜欢
          • 2015-12-06
          • 2017-04-01
          • 2016-06-11
          • 2013-07-19
          • 1970-01-01
          • 2015-04-15
          • 1970-01-01
          • 2019-12-12
          • 1970-01-01
          相关资源
          最近更新 更多