Skip to content

Fails to build native extension on Apple M1 Macs, apparently due to looking for libraries/headers in wrong place #484

Closed
@dtgay

Description

@dtgay

Environment

Operating System

ProductName:	macOS
ProductVersion:	11.1
BuildVersion:	20C69

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

free-tds-1.2.18.arm64

Description

The gem installation fails on the new Macs with the M1 chip (ARM) when homebrew was used to install freetds:

Fetching tiny_tds 2.1.3.pre
Installing tiny_tds 2.1.3.pre with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

This appears to be because it's looking for the libraries/headers in the wrong place:

current directory:
/Users/david/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/tiny_tds-2.1.3.pre/ext/tiny_tds
/Users/david/.rbenv/versions/2.7.2/bin/ruby -I /Users/david/.rbenv/versions/2.7.2/lib/ruby/2.7.0 -r
./siteconf20201230-18443-1m6z2pa.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... no
checking for dbanydatecrack() in -lsybdb... no
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 the files it's looking for are actually here:

❯ sudo find /opt -name "*syb*"
/opt/homebrew/include/sybdb.h
/opt/homebrew/include/syberror.h
/opt/homebrew/include/sybfront.h
/opt/homebrew/lib/libsybdb.dylib
/opt/homebrew/lib/libsybdb.a
/opt/homebrew/lib/libsybdb.5.dylib
/opt/homebrew/Cellar/freetds/1.2.18/include/sybdb.h
/opt/homebrew/Cellar/freetds/1.2.18/include/syberror.h
/opt/homebrew/Cellar/freetds/1.2.18/include/sybfront.h
/opt/homebrew/Cellar/freetds/1.2.18/lib/libsybdb.dylib
/opt/homebrew/Cellar/freetds/1.2.18/lib/libsybdb.a
/opt/homebrew/Cellar/freetds/1.2.18/lib/libsybdb.5.dylib

If this isn't the right place for this issue, please let me know where I should report it. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions