2013-02-21 44 views
12

CÂU HỎI TÔI
một số bước chắc chắn hơn tôi có thể làm để 100% làm việc này là gì? Tôi sẽ cần hướng dẫn thực sự, không phải là một câu trả lời lót hoặc mô tả khái niệm mơ hồ của quá trình.Không bó cài đặt tiny_tds trên Mac OS X 10.8 với freetds Homebrew

Hãy đến cuối phần này. Có vẻ như có những xung đột ở đâu đó và tôi đã có sự hỗ trợ từ nhà phát triển gem trên GitHub liên quan đến trải nghiệm của tôi với Ruby/Rails/Bundler/Homebrew vì vậy nó không hoàn toàn là lỗi của họ: P Nhưng tôi cần tìm ra làm thế nào để có được ASAP làm việc này vì vậy ở đây đi với trạng thái hiện tại của tôi về vấn đề này.


UPDATE: 2/25/2013
Cập nhật GCC/Xcode Version 4.6 (4H127) và tải về phiên bản mới nhất của Xcode COMMAND-LINE CÔNG CỤ và bây giờ iconv_open() được hiển thị trong trình kiểm tra extconf . Tôi hiện đang gặp phải các lỗi sau:

Tôi tin rằng chúng hiện là vấn đề với tiny_td và khả năng tương thích với các đường dẫn xcode mới nhất.

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
Okay, vì vậy tôi cài đặt lại tất cả mọi thứ, Ruby/Rails/vv Và sử dụng một số lời khuyên từ một commenter để sử dụng ": path =>" và đây là đầu ra của tôi bây giờ khi tôi chạy 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' 

NHỮNG ĐIỀU tôi đã thử

1.) Các hướng dẫn thiết lập EASY ban đầu giống như bất kỳ khác ...

$ rails new test_app 
$ cd test_app 

Bây giờ thêm những dòng này để Gemfile

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

Giờ hãy tiếp tục lệnh ...

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

LƯỢNG SẢN XUẤT 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.) SUCCESS IMAGINARY/GIẢ CNTT TIL bạn thực hiện nó/A BIG LET XUỐNG/HƯỚNG DẪN SETUP ADVANCED
Tìm thấy blog entry này ... http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html

Tôi sau đó đặt đường dẫn chính xác của tôi vào thư viện libiconv và thư viện freetds. Tiếp theo, tôi chạy nó như thế này:

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

Cố gắng bundle_install một lần nữa, và sốc ... nó vẫn không được cài đặt thông qua gem 'tiny_tds' trong Gemfile ...

Vì vậy, tôi loại bỏ tiny_tds từ Gemfile và tiến hành để khởi động server lên anyway ... Và như mong đợi ...

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

CÂU HỎI KHÁC CÓ LIÊN QUAN VÀ THÔNG TIN

+0

Tôi có một vấn đề rất giống nhau và liên kết dưới đây đã giải quyết nó –

+1

Ý của bạn là đính kèm một liên kết? –

+0

Xin lỗi, nhận ra nó sẽ không giúp bạn, bạn đã thực hiện những gì có trong liên kết. –

Trả lời

3

Vâng, thật không may tôi đã có nó làm việc và có NO CLUE làm thế nào tôi đã làm nó nhưng tôi sẽ liệt kê tất cả những điều tôi đã làm cho đến nay trong câu trả lời này để giải quyết nó.

Cuối cùng, bundle install với tiêu chuẩn gem 'tiny_tds', '0.5.1' kết thúc hoạt động tốt. Nó đang chạy phiên bản Ruby 1.9.3-p194 qua RVM.

Đây là nơi mà vàng là tôi khá chắc chắn ...
tôi đã sử dụng rvm pkg install iconvrvm reinstall 1.9.3 --with-iconv-dir=$rvm_path/usr

Một khi điều này hoàn thành, tôi đã xóa tất cả các thư mục ngọc cũ ... Tôi chuyển sang con đường cấu hình bó để khớp với đường dẫn ruby ​​mới ...

Sau đó, đã cài đặt gói và bùng nổ.

Nó cũng đang sử dụng biểu tượng 1.13 thay vì 1.14 không chắc liệu điều đó có quan trọng hay không.

Tôi hy vọng điều này sẽ giúp mọi người ... nó chắc chắn là một trải nghiệm học tập rất lớn đối với tôi.

4

Cài đặt lần đầu free_tds và các phụ thuộc bắt buộc.

này đã làm việc cho tôi, con đường của bạn có thể khác nhau

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 
+0

Tất nhiên bạn cũng có thể cài đặt lại ruby ​​1.9.3 và chỉ định iconv-dir, nhưng giải pháp của tôi nhanh hơn một chút. –

0

Tôi không biết nhiều về Ruby. Chỉ cần một chút. Bạn luôn có thể cài đặt trực tiếp vertx so với tôi nghĩ rằng bạn có nhiều quyền kiểm soát hơn với vị trí thư mục và nó làm cho việc nâng cấp dễ dàng hơn. Tôi đã viết một hướng dẫn cho đội Ops cho sản xuất (một công việc đang tiến hành thực sự). Nó có thể giúp bạn. Nó có thể không.

Tôi đã viết một hướng dẫn cài đặt nhỏ. Tôi có kế hoạch bổ sung thêm một số tinh chỉnh để nó về làm thế nào để cấu hình TCP/IP và Vertx quy mô (cài đặt cổng không lâu, giới hạn mô tả tập tin, thử tải, bộ đệm điều chỉnh rác vv)

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

Cài đặt Vertx trên Ubuntu 13

Môi trường chi tiết

loại Instance: EC2 hi1.4xlarge

  • Hệ điều hành: Ubuntu 13.10 (64 bit) Java VM:

  • phiên bản java "1.7.0_25" (IcedTea 2.3.12) (xây dựng 23,7-b01)

  • Vertx: 2.1M1 (được xây dựng 2013-10-29 11:11:22)

Cài đặt phần mềm

Java 7 JDK:

$ sudo apt-get install openjdk-7-jdk 

Vertx:

Tải 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 vào cấu trúc Unix tiêu chuẩn:

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

Tạo liên kết tượng trưng đến/usr/local/sha re/vertx để nâng cấp dễ dàng hơn.

$ 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 

Thêm liên kết tượng trưng đỉnh vào thư mục/usr/bin/của bạn.

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

Cài đặt một trình soạn thảo chết tiệt thật:

$ sudo apt-get install emacs 

Tạo kịch bản thử nghiệm để kiểm tra Vertx được cài đặt đúng cách:

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

Bây giờ chạy Vertx chống lại kịch bản thử nghiệm:

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

Bây giờ kiểm tra xem l tất cả đã làm việc:

$ curl 127.0.0.1:8080 
test 1 

Nếu bạn nhận được "kiểm tra 1", điều này có nghĩa là vertx được cài đặt và có khả năng máy chủ verticles.

Sau đó tôi có kế hoạch thêm init.d script để bắt đầu vertx và có lẽ một quá trình đánh thức và đảm bảo mọi thứ đang chạy mỗi phút hoặc lâu hơn. Tôi cũng có kế hoạch đối mặt với một vài trường hợp vertx với proxy ngược NGINX để mỗi hộp có thể xử lý gần 1.000.000 yêu cầu và bảo vệ DOS nhiều hơn một chút. Dù sao ... một công việc đang tiến ...

12

này đã làm việc cho tôi (ngày 02 tháng 10 năm 2014/OSX 10.9.5):

brew install freetds 

và trong đường ray:

gem 'tiny_tds' 
bundle install 
+0

Điều này làm việc cho tôi. Cảm ơn @andorov –

+0

Cần thiết điều này trên macOS 10.13. Điều này làm việc rất đẹp. Cảm ơn bạn! – JHawkZZ

0

gì đã làm việc cho tôi là các tùy chọn xây dựng đá quý của mr.ruh.roh ở trên, được sao chép tại đây:

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 

trong một dòng. Đá quý cài đặt cài đặt đá quý, nhưng bó vẫn thất bại, mặc dù đá quý đã được xây dựng và cài đặt. Tuy nhiên, việc thêm các tùy chọn đó cho trình 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 

Một lần nữa, trong một dòng. Với bộ cấu hình bundler đó, bundle install đã hoạt động.

Lưu ý rằng tôi đã chạy:

brew install freetds 
brew install libiconv 

này làm việc cho tôi vào ngày 20 tháng hai năm 2015 trên OS X 10.9.5 với Xcode 6.1.1 cài đặt

1

tôi đã giải quyết nó với:

brew install freetds 

và sau đó

bundle install 
Các vấn đề liên quan