Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails when FreeTDS installed via Homebrew #508

Closed
bemky opened this issue Oct 1, 2021 · 5 comments
Closed

Install fails when FreeTDS installed via Homebrew #508

bemky opened this issue Oct 1, 2021 · 5 comments

Comments

@bemky
Copy link

bemky commented Oct 1, 2021

Environment

Operating System
ProductName: macOS
ProductVersion: 11.4
BuildVersion: 20F71

TinyTDS Version and Information

Compile-time settings (established with the "configure" script)
                            Version: freetds v1.2.18
             freetds.conf directory: /opt/homebrew/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 7.3
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: yes

FreeTDS Version

~  % brew info freetds
freetds: stable 1.2.18 (bottled), HEAD
Libraries to talk to Microsoft SQL Server and Sybase databases
https://www.freetds.org/
/opt/homebrew/Cellar/freetds/1.2.18 (1,259 files, 14.2MB) *
  Poured from bottle on 2021-10-01 at 09:45:12
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/freetds.rb
License: LGPL-2.0-or-later
==> Dependencies
Build: pkg-config ✔
Required: openssl@1.1 ✔, unixodbc ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 94,301 (30 days), 254,798 (90 days), 908,686 (365 days)
install-on-request: 29,753 (30 days), 63,114 (90 days), 183,600 (365 days)
build-error: 0 (30 days)

Description

When installing gem, I get the following error even though FreeTDS is installed

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /opt/homebrew/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
/opt/homebrew/opt/ruby/bin/ruby -I /opt/homebrew/Cellar/ruby/3.0.1/lib/ruby/3.0.0 -r ./siteconf20211001-80117-pc99xg.rb extconf.rb
looking for freetds headers in the following directories:
 - /opt/local/include
 - /opt/local/include/freetds
 - /usr/local/include
 - /usr/local/include/freetds
looking for freetds library in the following directories:
 - /opt/local/lib
 - /opt/local/lib/freetds
 - /usr/local/lib
 - /usr/local/lib/freetds
checking for sybfront.h... no
checking for sybdb.h... no
checking for tdsdbopen() in -lsybdb... yes
checking for dbanydatecrack() in -lsybdb... yes
Failed! Do you have FreeTDS 0.95.80 or higher installed?
*** 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.

It looks like tiny_tds can't find freetds. FreeTDS is installed via homebrew in the default location where homebrew puts it. When I install gem with the following it installs correctly.

gem install tiny_tds -- --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.2.18

I'm not sure exactly how to fix, but can tiny_tds use $PATH to find freetds?

@vkalach
Copy link

vkalach commented Nov 18, 2021

gem install tiny_tds -- --with-freetds-include=/opt/homebrew/include --with-freetds-lib=/opt/homebrew/lib

@Peter-Oliver
Copy link

@vkalach that got me almost all the way there. I ran the following three commands to fully fix:
brew install freetds
sudo chown -R $(whoami) /Users/USERNAME/.rbenv/versions/VERSION NO./lib/ruby/gems/*
gem install tiny_tds -- --with-freetds-include=/opt/homebrew/include --with-freetds-lib=/opt/homebrew/lib

@leedrum
Copy link

leedrum commented Apr 21, 2023

@Peter-Oliver same here, I just have to run brew install freetds and then gem install tiny_tds
Successfully installed tiny_tds-2.1.5

@fa11enangel
Copy link

Check this pull request #531. It'll fix the problem for newer homebrew installations.

It adds the new homebrew path /opt/homebrew to be used for freetds lookup.

@andyundso
Copy link
Contributor

Fix has been merged with #545 (original PR: #531) and was released with 2.1.6. It should no longer be necessary to pass --with-freetds-include or --with-freetds-lib on Macs with Apple Silicon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants