Error installing FreeTDS 0.91

758 views
Skip to first unread message

gobb0

unread,
Apr 14, 2011, 4:36:48 PM4/14/11
to Rails SQLServer Adapter
I'm using homebrew on Mac to manage my freetds build. Here is my
formula file:

require 'formula'

class Freetds < Formula
url 'http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/
release_candidates/freetds-0.91rc1.tgz'
homepage 'http://www.freetds.org/'
md5 'aec7ab3c9d063afdef6091959c6056fd'

def install
args = ["--prefix=#{prefix}",
"--with-tdsver=8.0",
"--mandir=#{man}"]

system "./configure", *args
system 'make'
system 'make install'
end
end


When I run "brew install freetds" I get the following errors.

==> make install
Making install in include
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/Cellar/freetds/0.91rc1/include" || .././install-sh
-c -d "/usr/local/Cellar/freetds/0.91rc1/include"
test -z "/usr/local/Cellar/freetds/0.91rc1/include" || .././install-sh
-c -d "/usr/local/Cellar/freetds/0.91rc1/include"
mkdir: /usr/local/Cellar/freetds/0.91rc1/include: File exists
make[2]: *** [install-nodist_includeHEADERS] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/bin/install -c -m 644 bkpublic.h cspublic.h cstypes.h ctpublic.h
sqldb.h sqlfront.h sybdb.h sybfront.h syberror.h odbcss.h '/usr/local/
Cellar/freetds/0.91rc1/include'
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/freetds.rb#L15
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: e00734bf631c3ad0d92f9ab93e3dd0f173057e70
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.6.7
Kernel Architecture: x86_64
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/
1.8/usr/bin/ruby
Xcode: 3.2.6
GCC-4.0: build 5494
GCC-4.2: build 5666
LLVM: build 2335
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe
MAKEFLAGS: -j8

Error: Failed executing: make install
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue


I would like to start using Tiny_TDS with SQLAzure, and my
understanding is that I need 0.91 to do so.
Any help here would be great.

Ken Collins

unread,
Apr 15, 2011, 12:16:51 AM4/15/11
to rails-sqlse...@googlegroups.com

I use MacPorts myself, I wrote this file to test the latest 0.91 current since there have been quite a few patches since RC1. Here is my port file along with some things that you can take away from it. Note, that the FreeTDS distro is not very friendly to package managers, so prepare to learn your port system tools under duress :)

https://github.com/metaskills/macports/blob/master/databases/freetds/Portfile

1) The expanded file/folder does not match the original filename. This is why I had to tell MacPorts to be explicit with the distfile and clean it before each build.

2) The checksum on this file (master_site/distfiles) will change daily if there are commits.

3) Use --with-tdsver=7.1 (LONG STORY, http://lists.ibiblio.org/pipermail/freetds/2011q2/027000.html)

4) Technically libiconv should be a dep. OpenSSL too if you plan to encrypt connections across the public wire.

5) Using --disable-odbc helps keep things simple.

6) Do not forget about --sysconfdir

Lastly, you could technically build your own static gem using Luis' great MiniPortile system that is part of TinyTDS repo and what we will use to eventually publish static windows binaries. Just clone the repo and do something like this.

$ bundle install
$ rake compile
$ rake native gem

Then just install the gem that was made in the pkg dir by doing

$ gem install pkg/tiny_tds...

You will have a static binary that includes libiconv, freetds and tinytds all in one :)


- Ken


gobb0

unread,
Apr 15, 2011, 1:56:29 PM4/15/11
to Rails SQLServer Adapter
I ditched homebrew and tried macports and now have freetds installed.
here is my tsql -C

Compile-time settings (established with the "configure" script)
Version: freetds v0.92.dev.20110415
freetds.conf directory: /opt/local/etc/freetds
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

when i try and install the tiny_tds gem, it complains that it can't
find freetds "Can not find FreeTDS's db-lib or include directory."

i tried to add the --with-opt-dir option, but it gave me this error

ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: -—with-opt-dir


how do i tell tiny_tds where to look?


On Apr 15, 12:16 am, Ken Collins <k...@metaskills.net> wrote:
> I use MacPorts myself, I wrote this file to test the latest 0.91 current since there have been quite a few patches since RC1.  Here is my port file along with some things that you can take away from it. Note, that the FreeTDS distro is not very friendly to package managers, so prepare to learn your port system tools under duress :)
>
> https://github.com/metaskills/macports/blob/master/databases/freetds/...
>
> 1) The expanded file/folder does not match the original filename. This is why I had to tell MacPorts to be explicit with the distfile and clean it before each build.
>
> 2) The checksum on this file (master_site/distfiles) will change daily if there are commits.
>
> 3) Use --with-tdsver=7.1   (LONG STORY,http://lists.ibiblio.org/pipermail/freetds/2011q2/027000.html)

Ken Collins

unread,
Apr 15, 2011, 2:53:10 PM4/15/11
to rails-sqlse...@googlegroups.com

> how do i tell tiny_tds where to look?

It uses your $PATH for clues. Did you update yours to the new MacPorts dirs in your profile?

Bash:
export PATH="/usr/local/bin:$PATH"
export MANPATH="/usr/local/share/man:$MANPATH"
export INFOPATH="/usr/local/share/info:$INFOPATH"

ZSH:
path=(/opt/local/bin /opt/local/sbin /opt/local/apache2/bin $path)
manpath=(/opt/local/share/man $manpath)
infopath=(/opt/local/share/info $infopath)


gobb0

unread,
Apr 15, 2011, 4:40:56 PM4/15/11
to Rails SQLServer Adapter
Thank you sir. Gems now installed.

When i rake db:migrate however, i get the following error.

"Unable to connect: Adaptive Server is unavailable or does not exist"

I've made sure my SQL Server is open to TCP/IP connections (this blog
post: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/),
and i can ping my Windows 7 OS running on Parallels from the OS X
network utility...

this is my database.yml

development:
adapter: sqlserver
mode: dblib
dataserver: sql2008r2
database: cms_dev
username: gminett
password: wa2Mkksql
timeout: 5000

this is my freetds.conf

[sql2008r2]
host = 192.168.10.179
port = 1433
tds version = 8.0


.... stumped again....

Ken Collins

unread,
Apr 15, 2011, 4:44:47 PM4/15/11
to rails-sqlse...@googlegroups.com

Use the latest versions of the adapter (released today) and do something like this. Configuring a freetds.conf file should be a thing of the past.

development:
adapter: sqlserver
host: 192.168.10.179

gobb0

unread,
Apr 15, 2011, 4:56:09 PM4/15/11
to Rails SQLServer Adapter
got the update... rake db:migrate didn't like the yaml though..

"Server name not found in configuration files"

trying the first yaml configuration (after updating the adapter) still
gets me (with full trace)

Unable to connect: Adaptive Server is unavailable or does not exist

(See full trace by running task with --trace)
gfm: rake db:migrate --trace
(in /Users/george/Documents/rails_projects/cms/working copy/mailer)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Unable to connect: Adaptive Server is unavailable or does not exist
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/tiny_tds-0.4.4/lib/
tiny_tds/client.rb:64:in `connect'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/tiny_tds-0.4.4/lib/
tiny_tds/client.rb:64:in `initialize'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-
adapter-3.0.14/lib/active_record/connection_adapters/
sqlserver_adapter.rb:365:in `new'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-
adapter-3.0.14/lib/active_record/connection_adapters/
sqlserver_adapter.rb:365:in `connect'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-
adapter-3.0.14/lib/active_record/connection_adapters/
sqlserver_adapter.rb:180:in `initialize'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-
adapter-3.0.14/lib/active_record/connection_adapters/
sqlserver_adapter.rb:46:in `new'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-
adapter-3.0.14/lib/active_record/connection_adapters/
sqlserver_adapter.rb:46:in `sqlserver_connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:228:in
`new_connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:236:in
`checkout_new_connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:190:in
`block (2 levels) in checkout'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:186:in
`loop'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:186:in
`block in checkout'
/Users/george/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:
201:in `mon_synchronize'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:185:in
`checkout'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:93:in
`connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_pool.rb:316:in
`retrieve_connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
97:in `retrieve_connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
89:in `connection'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/migration.rb:486:in `initialize'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/migration.rb:433:in `new'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/migration.rb:433:in `up'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/migration.rb:415:in `migrate'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/
active_record/railties/databases.rake:142:in `block (2 levels) in <top
(required)>'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
636:in `call'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
636:in `block in execute'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
631:in `each'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
631:in `execute'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
597:in `block in invoke_with_call_chain'
/Users/george/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:
201:in `mon_synchronize'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
590:in `invoke_with_call_chain'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
583:in `invoke'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2051:in `invoke_task'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2029:in `block (2 levels) in top_level'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2029:in `each'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2029:in `block in top_level'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2068:in `standard_exception_handling'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2023:in `top_level'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2001:in `block in run'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
2068:in `standard_exception_handling'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:
1998:in `run'
/Users/george/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in
`<top (required)>'
/Users/george/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/george/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'

Ken Collins

unread,
Apr 15, 2011, 4:59:39 PM4/15/11
to rails-sqlse...@googlegroups.com

Please investigate why you are not getting a connection first. Use the code on the TinyTDS page as a simple way to debug and troubleshoot your connection. https://github.com/rails-sqlserver/tiny_tds

The tsql command line utility installed by FreeTDS is also helpful. Read the man pages for details. Troubleshoot at that level first before moving to the rails stack. Find out if you created your database, with the right perms, etc.

- Ken

gobb0

unread,
Apr 15, 2011, 5:18:02 PM4/15/11
to Rails SQLServer Adapter
how do you actually invoke the test rake task?

On Apr 15, 4:59 pm, Ken Collins <k...@metaskills.net> wrote:
> Please investigate why you are not getting a connection first. Use the code on the TinyTDS page as a simple way to debug and troubleshoot your connection.https://github.com/rails-sqlserver/tiny_tds

gobb0

unread,
Apr 17, 2011, 6:49:45 PM4/17/11
to Rails SQLServer Adapter
to follow up on this, I ended up reinstalling SQL Express, which fixed
the problem for me. After reading a few blogs on talking to SQL Server
running on Parallels from OS X host, you need to make sure the SQL
Express install is a "default instance" and not a "named instance" to
avoid connection problems.

thanks again for your help here Ken.
Reply all
Reply to author
Forward
0 new messages