Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds
Asked Answered
M

8

14

MY QUESTION
What are some surefire steps I can take to 100% get this working? 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.


UPDATE: 2/25/2013
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. Now I'm getting these errors:

I believe they are now issues with tiny_tds and compatibility with latest xcode paths.

    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, 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

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

$ rails new test_app
$ cd test_app

Now add these lines to 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
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
Found this blog entry... http://talltroym.blogspot.com/2012/04/installing-activerecord-sqlserver.html

I then located my correct paths to the libiconv library and the freetds library. 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...

So I remove tiny_tds from Gemfile and proceed to start the server up anyway... And as expected...

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

OTHER RELATED QUESTIONS AND RESOURCES

Maxilliped answered 21/2, 2013 at 14:15 Comment(7)
I had a very similar issue and the link below solved itPaleoasiatic
Did you mean to attach a link?Maxilliped
Sorry, realised it would not help you, you have already done what is in the link.Paleoasiatic
Well, I'm new to Ruby / Rails and may not have done things exactly as they are supposed to be done. The instructions I've went through may have neglected some details that newcomers might miss?Maxilliped
Also, you'd think there would be a surefire way of doing it... uninstalling everything and starting fresh for example... but I'm not confident that it will resolve it... but if somebody already has been through this - I'd love to hear it.Maxilliped
You have successfully got the gem installing with gem install. Find the full path to the successfully install gem and then alter your gem file to force bundle install to use that copy. See here #4488448Paleoasiatic
let us continue this discussion in chatMaxilliped
M
4

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.

In the end, bundle install with standard gem 'tiny_tds', '0.5.1' ended up working fine. It's running Ruby version 1.9.3-p194 via RVM.

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

Once this completed, I deleted all old gem folders... I switched bundle config path to match the new ruby path...

Then did bundle install, and boom.

It's also using iconv 1.13 instead of 1.14 not sure if that matters.

I hope this helps anyone... it's definitely been a huge learning experience for me.

Maxilliped answered 25/2, 2013 at 19:49 Comment(0)
D
15

This did work for me (2 Oct 2014 / OSX 10.9.5):

brew install freetds

and in rails:

gem 'tiny_tds'
bundle install
Damnation answered 2/10, 2014 at 18:28 Comment(2)
Needed this on macOS 10.13. This worked beautifully. Thank you!Milter
I can verify that this works on macOS 10.14.1 and ruby version 2.5.1.Toshiatoshiko
C
6

First install free_tds and required dependencies.

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
Cartwell answered 1/3, 2013 at 19:13 Comment(1)
Of course you could also reinstall ruby 1.9.3 and specify the iconv-dir, but my solution is a bit quicker.Cartwell
M
4

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.

In the end, bundle install with standard gem 'tiny_tds', '0.5.1' ended up working fine. It's running Ruby version 1.9.3-p194 via RVM.

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

Once this completed, I deleted all old gem folders... I switched bundle config path to match the new ruby path...

Then did bundle install, and boom.

It's also using iconv 1.13 instead of 1.14 not sure if that matters.

I hope this helps anyone... it's definitely been a huge learning experience for me.

Maxilliped answered 25/2, 2013 at 19:49 Comment(0)
Q
3

For Apple M1, brew uses different path:

gem install tiny_tds -- \
--with-freetds-include=/opt/homebrew/Cellar/freetds/1.3.18/include \
--with-freetds-lib=/opt/homebrew/Cellar/freetds/1.3.18/lib \
--with-iconv-include=/opt/homebrew/Cellar/libiconv/1.17/include \
--with-iconv-lib=/opt/homebrew/Cellar/libiconv/1.17/lib

P.s. Update your freetds and libiconv version in path

Quarrelsome answered 12/4, 2023 at 13:9 Comment(1)
Thank you <3 I'm on the M2 and this worked for me: gem install tiny_tds -- --with-freetds-include=/opt/homebrew/Cellar/freetds/1.3.18/include --with-freetds-lib=/opt/homebrew/Cellar/freetds/1.3.18/libDeberadeberry
B
1

I have solved it with:

brew install freetds

and then

bundle install
Bateman answered 10/11, 2015 at 19:1 Comment(0)
M
0

I don't know much about 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. I wrote up a guide for Ops team for production (a work in progress really). 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.)

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

Installing Vertx on Ubuntu 13

Environment details

Instance type: EC2 hi1.4xlarge

  • OS: Ubuntu 13.10 (64 bit) Java VM:

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

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

Installing Software

Java 7 JDK:

 $ sudo apt-get install openjdk-7-jdk

Vertx:

Download 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:

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

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

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

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

Now run vertx against test script:

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

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. 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. Anyway... a work in progress...

Moldboard answered 13/11, 2013 at 19:55 Comment(0)
S
0

What worked for me was mr.ruh.roh's gem building options above, reproduced here:

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. Adding those options for bundler, however, worked.

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.

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

Stenopetalous answered 21/2, 2015 at 6:15 Comment(0)
C
0

Many of these answers regarding directly linking Apple Silicon paths work but require you to know the freetds and libiconv version numbers to correctly link. brew symlinks all of these in /opt/homebrew/opt/ so you can simplify across freetds/libiconv versions.

Modify #.#.# to your desired tiny_tds version:

gem install tiny_tds -v ‘#.#.#' -- \
--with-freetds-include=/opt/homebrew/opt/freetds/include \
--with-freetds-lib=/opt/homebrew/opt/freetds/lib \
--with-iconv-include=/opt/homebrew/opt/libiconv/include \
--with-iconv-lib=/opt/homebrew/opt/libiconv/lib
Croner answered 11/6 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.