简体   繁体   English

未能在Mac OS X 10.8上使用Homebrew FreeTds捆绑安装tiny_tds

[英]Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds

MY QUESTION 我的问题
What are some surefire steps I can take to 100% get this working? 有什么可靠的步骤我可以采取100%让这个工作? I would need real instructions, not one liner answers or vague conceptual descriptions of the process. 我需要真正的指示,而不是一个班轮答案或过程的模糊概念描述。

Let's get to the bottom of this. 让我们来看看它的底部。 It would appear that there are conflicts somewhere and I've had subpar assistance from the gem developer on GitHub in relation to my experience with Ruby / Rails / Bundler / Homebrew so it's not completely their fault :P But I need to figure out how to get this working ASAP so here goes with my current state of this problem. 似乎某些地方存在冲突,而且我在GitHub上的宝石开发者得到了与我在Ruby / Rails / Bundler / Homebrew上的经验相关的低级辅助,所以这不完全是他们的错:P但是我需要弄清楚如何尽快得到这个工作,所以这里是我目前的这个问题的状态。


UPDATE: 2/25/2013 更新:2013年2月25日
Updated GCC / XCODE Version 4.6 (4H127) and downloaded latest version of XCODE COMMAND-LINE TOOLS and now iconv_open() is showing up in the extconf checker. 更新了GCC / XCODE版本4.6(4H127)并下载了最新版本的XCODE COMMAND-LINE TOOLS,现在iconv_open()显示在extconf检查器中。 Now I'm getting these errors: 现在我收到这些错误:

I believe they are now issues with tiny_tds and compatibility with latest xcode paths. 我相信它们现在是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`

UPDATE 2: 2/25/2013 更新2:2013年2月25日
OKAY, so I reinstalled everything, Ruby / Rails / etc. And used some advice from a commenter to use ":path =>" and here is my output now when I run rails s 好的,所以我重新安装了所有东西,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'

THINGS I'VE TRIED 我做过的事情

1.) The initial EASY setup instructions like any other... 1.)最初的EASY设置说明与其他任何...

$ rails new test_app
$ cd test_app

Now add these lines to Gemfile 现在将这些行添加到Gemfile

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

Now continue commands... 现在继续命令......

$ 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.

OUTPUT OF tsql -C 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.) IMAGINARY SUCCESS / FAKE IT TIL YOU MAKE IT / A BIG LET DOWN / ADVANCED SETUP INSTRUCTIONS 2.)想象成功/假你做得好/大下拉/高级设置说明
Found this blog entry... http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html 找到此博客条目... http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html

I then located my correct paths to the libiconv library and the freetds library. 然后我找到了libiconv库和freetds库的正确路径。 Next, I ran it like this: 接下来,我这样运行:

$ 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...

Tried bundle_install again, and shock... it still isn't installing via gem 'tiny_tds' in Gemfile... 再次尝试了bundle_install ,震惊......它仍然没有在Gemfile中通过gem 'tiny_tds'安装......

So I remove tiny_tds from Gemfile and proceed to start the server up anyway... And as expected... 所以我从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 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.

OTHER RELATED QUESTIONS AND RESOURCES 其他相关问题和资源

This did work for me (2 Oct 2014 / OSX 10.9.5): 这对我有用(2014年10月2日/ OSX 10.9.5):

brew install freetds

and in rails: 并在铁轨:

gem 'tiny_tds'
bundle install

First install free_tds and required dependencies. 首先安装free_tds和所需的依赖项。

This worked for me, your paths may be different 这对我有用,你的路径可能会有所不同

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

Well, unfortunately I've now got it working and have NO CLUE how I've done it but I will list all of the things I've done so far in this answer to solve it. 好吧,不幸的是我现在已经开始工作并且没有CLUE我是怎么做到的但是我将列出我迄今为止在这个答案中所做的所有事情来解决它。

In the end, bundle install with standard gem 'tiny_tds', '0.5.1' ended up working fine. 最后,带有标准gem 'tiny_tds', '0.5.1' bundle install gem 'tiny_tds', '0.5.1'最终正常工作。 It's running Ruby version 1.9.3-p194 via RVM. 它通过RVM运行Ruby版本1.9.3-p194。

This is where the gold is I'm fairly sure... 这是黄金我相当肯定的地方......
I used rvm pkg install iconv and rvm reinstall 1.9.3 --with-iconv-dir=$rvm_path/usr 我使用了rvm pkg install iconvrvm reinstall 1.9.3 --with-iconv-dir=$rvm_path/usr

Once this completed, I deleted all old gem folders... I switched bundle config path to match the new ruby path... 一旦完成,我删除了所有旧的gem文件夹...我切换了bundle配置路径以匹配新的ruby路径...

Then did bundle install, and boom. 然后捆绑安装,繁荣。

It's also using iconv 1.13 instead of 1.14 not sure if that matters. 它也使用iconv 1.13而不是1.14,不确定是否重要。

I hope this helps anyone... it's definitely been a huge learning experience for me. 我希望这对任何人都有帮助......对我来说这绝对是一次巨大的学习经历。

I have solved it with: 我解决了它:

brew install freetds

and then 然后

bundle install

I don't know much about Ruby. 我对Ruby知之甚少。 Just dabbled a bit. 刚刚涉猎了一下。 You can always install vertx directly than I think you have more control with directory location and it makes it easier to upgrade. 您可以直接安装vertx,而不是我认为您可以更好地控制目录位置,这样可以更轻松地进行升级。 I wrote up a guide for Ops team for production (a work in progress really). 我为Ops团队编写了一份生产指南(真正的工作正在进行中)。 It might help you. 它可能对你有帮助。 It might not. 它可能不会。

I wrote a little install guide. 我写了一个小安装指南。 I plan on adding some tweaks to it on how to configure TCP/IP stack and Vertx to scale (ephemeral port settings, file descriptor limits, load testing, tuning recycle buffers, etc.) 我打算在如何配置TCP / IP堆栈和Vertx扩展(临时端口设置,文件描述符限制,负载测试,调整循环缓冲区等)上添加一些调整。

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

Installing Vertx on Ubuntu 13 在Ubuntu 13上安装Vertx

Environment details 环境细节

Instance type: EC2 hi1.4xlarge 实例类型:EC2 hi1.4xlarge

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

  • java version "1.7.0_25" (IcedTea 2.3.12) (build 23.7-b01) java版“1.7.0_25”(IcedTea 2.3.12)(build 23.7-b01)

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

Installing Software 安装软件

Java 7 JDK: Java 7 JDK:

 $ sudo apt-get install openjdk-7-jdk

Vertx : Vertx

Download Vertx 下载Vertx

$ 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

Move into standard Unix structure: 进入标准Unix结构:

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

Create symbolic link to /usr/local/share/vertx so upgrading is easier. 创建/ 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

Add vertx symbolic link to your /usr/bin/ directory. 将vertx符号链接添加到/ usr / bin /目录。

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

Install a real damn editor: 安装一个真正该死的编辑器:

$ sudo apt-get install emacs

Create test script to test vertx is installed properly: 创建测试脚本以测试vertx已正确安装:

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

Now run vertx against test script: 现在对测试脚本运行vertx:

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

Now test that the install all worked: 现在测试安装是否全部工作:

$ curl 127.0.0.1:8080
test 1

If you get "test 1", this means vertx is install and able to server verticles. 如果你得到“测试1”,这意味着vertx是安装的并且能够服务器Verticle。

Later I plan on adding init.d scripts to start vertx and perhaps a process that wakes up and makes sure everything is running every minute or so. 后来我计划添加init.d脚本来启动vertx,也许是一个唤醒进程并确保每一分钟都在运行的进程。 I also plan on fronting a few vertx instances with NGINX reverse proxy so each box can handle close to 1,000,000 requests and have a bit more DOS protection. 我还计划使用NGINX反向代理前端几个vertx实例,这样每个盒子可以处理接近1,000,000个请求并且有更多的DOS保护。 Anyway... a work in progress... 无论如何......正在进行的工作......

What worked for me was mr.ruh.roh's gem building options above, reproduced here: 对我有用的是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

in one line. 在一条线上。 That gem install installs the gem, but the bundle still failed, even though the gem had been built and installed. 那个gem install安装了gem,但是bundle仍然失败了,即使gem已经构建并安装完毕。 Adding those options for bundler, however, worked. 但是,为bundler添加这些选项是有效的。

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

Again, in one line. 再一次,在一行。 With that bundler config set, bundle install worked. 使用该捆绑bundle install配置集, bundle install有效。

Note that I had already run: 请注意,我已经运行:

brew install freetds
brew install libiconv

This worked for me on Feb 20, 2015 on OS X 10.9.5 with Xcode 6.1.1 installed 2015年2月20日,在安装了Xcode 6.1.1的OS X 10.9.5上,这对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM