alexbrainman / odbc

odbc driver written in go
BSD 3-Clause "New" or "Revised" License
352 stars 140 forks source link

"signal: killed" on driver import os Mac OS #93

Open Bartuz opened 7 years ago

Bartuz commented 7 years ago

running my program without importing odbc gives me

sql: unknown driver "odbc" (forgotten import?)Tue Aug  1 02:27:00 WARNING  ImportCustomers: cannot connect to ExaSol DB: sql: unknown driver "odbc" (forgotten import?)

when I add

import(
_ "github.com/alexbrainman/odbc"
)

it returns

# path/vendor/github.com/alexbrainman/odbc/api
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
# path/vendor/github.com/alexbrainman/odbc/api
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
signal: killed

on compile time (no even first line from main() is executed).

golang version:

go version
go version go1.8.3 darwin/amd64

unixodb: 2.3.6

alexbrainman commented 7 years ago

I suspect your program does not even builds. Can you build it? Doyou habe unixodbc installed? Where? I suspect, cgo is trying to find unixodbc libraries, and cannot find them in /opt/local/lib. Please try changing "#cgo darwin LDFLAGS" and "#cgo darwin CFLAGS" to include correct directories for where your unixodbc libs are stored.

Thank you.

Alex

Bartuz commented 7 years ago
  1. Can you build it?

    yes I can. go build passes successfully, go run fails

  2. Doyou habe unixodbc installed? Where?

    I have installed it with brew install along with freettds

    brew info unixodbc
    unixodbc: stable 2.3.4 (bottled)
    ODBC 3 connectivity for UNIX
    http://www.unixodbc.org/
    Conflicts with:
    virtuoso (because Both install `isql` binaries.)
    /usr/local/Cellar/unixodbc/2.3.4 (39 files, 959.6KB) *
    Poured from bottle on 2016-08-17 at 09:45:13
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/unixodbc.rb

    tds:

    brew info freetds
    freetds: stable 1.00.48 (bottled), HEAD
    Libraries to talk to Microsoft SQL Server and Sybase databases
    http://www.freetds.org/
    /usr/local/Cellar/freetds/1.00.48 (2,094 files, 11.9MB) *
    Poured from bottle on 2017-08-01 at 13:48:51
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/freetds.rb
    ==> Dependencies
    Build: pkg-config ✔
    Recommended: openssl ✔
    Optional: unixodbc ✔, libiodbc ✘
    ==> Options
    --with-krb5
    Enable Kerberos support
    --with-libiodbc
    Build with libiodbc support
    --with-msdblib
    Enable Microsoft behavior in the DB-Library API where it diverges from Sybase's
    --with-odbc-wide
    Enable odbc wide, prevent unicode - MemoryError's
    --with-sybase-compat
    Enable close compatibility with Sybase's ABI, at the expense of other features
    --with-unixodbc
    Build with unixodbc support
    --without-openssl
    Build without openssl support
    --HEAD
    Install HEAD version

    . I have few issues with overriding CF and LDFLAGS. I'll play with a bit later. But log says it's only a warning, not an error

alexbrainman commented 7 years ago

Please, show me your program. Full text. And what happens when you run. Please provide full output, and maybe add some println statements to determine where exactly your program fails.

Thank you.

Alex

PS: I see you use freetds. I suspect you are talking to MSSQL server. Did you try to use github.com/denisenkom/go-mssqldb ? github.com/denisenkom/go-mssqldb does not use CGO, so you have better chance making it work.