xo / usql

Universal command-line interface for SQL databases
MIT License
8.88k stars 347 forks source link

Cannot get godror working on Mac M1 #337

Closed mckennagene closed 2 years ago

mckennagene commented 2 years ago

here is what i've tried. is there any other recommended way to get USQL connected to Oracle on an M1 Mac?

I am trying to build full source of usql with the godror on Mac with M1 chip.

I have tried building it with the default ARCH setting (x86_64) and I've tried with ARCH=arm64

It builds, but when I run it I get "Cannot locate a 64-bit Oracle Client library", it says "(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')"

I cannot for the life of me find an oracle client library for arm architecture. Nor can i figure out how to make this all work with the x86 architecture.

even if i build with ARCH=x86_64 in a terminal window with "Open with Rosetta" checked on, it still complains that it wants the oracle driver for arm

./build-release.sh
APP: usql-0.10.0/0.0.0-dev (darwin/x86_64) BUILD TAGS: most godror sqlite_app_armor sqlite_fts5 sqlite_introspect sqlite_json1 sqlite_stat4 sqlite_userauth sqlite_vtable no_adodb LDFLAGS: -s -w -X github.com/xo/usql/text.CommandName=usql-0.10.0 -X github.com/xo/usql/text.CommandVersion=0.0.0-dev REMOVING: /Users/gene/Downloads/usql-0.10.0/build/darwin/0.0.0-dev/usql-0.10.0-0.0.0-dev-darwin-x86_64.tar.bz2 BUILDING: /Users/gene/Downloads/usql-0.10.0/build/darwin/0.0.0-dev/usql-0.10.0 BUILD:

and when i run it ...

usql-0.10.0 gr://user>:<password>@<oraclehost:1521/

i get ...

error: godror: ORA-00000: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 0x0001): tried: 'libclntsh.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/libclntsh.dylib' (no such file), '/usr/lib/libclntsh.dylib' (no such file), '/Users/gene/instantclient_19_8 2/libclntsh.dylib.19.1' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))". See https://oracle.github.io/odpi/doc/installation.html#macos for help

or if i build it and run specifying the x86_64 architecture (in the terminal marked to use rosetta)

arch -x86_64 ./build-release.sh arch -x86_64 usql-0.10.0 gr://user>:<password>@<oraclehost:1521/

i get this error arch: posix_spawnp: ./build/darwin/0.0.0-dev/usql-0.10.0: Bad CPU type in executable

kenshaw commented 2 years ago

@mckennagene Your best bet would be to build on Darwin with amd64 and use rosetta. I don't believe that Oracle has yet released a arm64 version of their driver. Please note that the ora driver works perfectly well on every platform.

mckennagene commented 2 years ago

oh wow. ora works. thanks so much. I think a year ago when i first started using usql ora didn't work and i got going on the godror one. happy to use the standard ora one now. thanks so much.