8

I am trying to get ODBC Driver 17 for SQL Server to work but somehow it doesn't on my brand new apple M1. Apparently I got unixodbc installed and also the driver, but starting them doesn't work. Looks like the odbc driver is not yet ready for the architecture (see below output). Doesn't even look like an issue with the microsoft driver, but the general lib from unixodbc - am I correct?

Any ideas if it's possible to compile this on my own?

XXX@M1 ~ % odbcinst -j
unixODBC 2.3.9
DRIVERS............: /opt/homebrew/etc/odbcinst.ini
SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini
FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources
USER DATA SOURCES..: /Users/XXX/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
XXX@M1 ~ % sqlcmd
dyld: Library not loaded: /usr/local/lib/libodbc.2.dylib
  Referenced from: /opt/homebrew/bin/sqlcmd
  Reason: no suitable image found.  Did find:
    /usr/local/lib/libodbc.2.dylib: mach-o, but wrong architecture
    /usr/local/lib/libodbc.2.dylib: mach-o, but wrong architecture
    /opt/homebrew/Cellar/unixodbc/2.3.9/lib/libodbc.2.dylib: mach-o, but wrong architecture
    /opt/homebrew/Cellar/unixodbc/2.3.9/lib/libodbc.2.dylib: mach-o, but wrong architecture
nico525
  • 117
  • 1
  • 6

1 Answers1

0

I'm not familiar with odbcinst, but in general when running things from the terminal on Apple Silicon (M1), if the libraries are not universal, you have two choices:

  1. set Terminal to run on Rosetta2, or
  2. prefix your command with arch -x86_64

I would suggest you try

arch -x86_64 odbcinst -j

Read more about this here. (Yes, the link speaks about Flutter, but the solutions are the same.)

pfurbacher
  • 1,584
  • 3
  • 13
  • 18
  • Unfortunately that didn't work out. I think unixODBC is correctly installed for arm64, but the Microsoft ODBC Driver isn't. FreeTDS works, so I'm just waiting a little bit on microsoft to fix that (hopefully that is the underlying issue...) – nico525 Feb 06 '21 at 13:34
  • But what if you install the x86_64 version of unixODBC, use the MS ODBC driver, and run under Rosetta2 while waiting for MS to update the driver? Rosetta2 is pretty fast, maybe even faster than execution speed you had on your older Intel-based Mac. (Just a thought.) – pfurbacher Feb 07 '21 at 18:29
  • 1
    I get this error if I run option 2. ´arch: posix_spawnp: odbcinst: Bad CPU type in executable´ – Giacomo Mar 15 '21 at 20:43
  • I also tried a copy of iTerm with Rosetta and reinstalled homebrew but when I run odbcinst -j I still see: DRIVERS............: /opt/homebrew/etc/odbcinst.ini. I'm completely lost. Any help much appreciated. – Giacomo Mar 15 '21 at 21:26
  • As per the GitHub page of the Microsoft odbc driver for Mac they plan M1 support for the next release. Let’s stay tuned – nico525 Mar 25 '21 at 20:15