随笔

macOS 安装 Oracle instantclient

官方文档: https://oracle.github.io/odpi/doc/installation.html#id3
成功率是个玄学问题, 一个项目跑的起来, 另一个跑不起来


下载库

http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
我这里下载了 basic, sdk, sqlplus, tools
可以只下载 basic 试下, 具体哪个有效不太了解(懒得去了解, 也不可能去选择 oracle 数据库)

安装

将下载的东西全解压到一个文件夹, 比如: /opt/oracle/instantclient

在此文件夹新建一个文件: oci8.pc

libdir=/opt/oracle/instantclient
includedir=/opt/oracle/instantclient/sdk/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: oci8
Description: oci8 library
Libs: -L${libdir} -lclntsh
Cflags: -I${includedir}
Version: 12.1

环境变量

export PKG_CONFIG_PATH=/usr/local/oracle/instantclient;
export PATH=$PATH:/usr/local/oracle/instantclient;
export DYLD_LIBRARY_PATH=/usr/local/oracle/instantclient

dyld: Library not loaded: @rpath/libclntsh.dylib

参考: https://blogs.oracle.com/dipol/dynamic-libraries,-rpath,-and-mac-os

install_name_tool -add_rpath /usr/local/oracle/instantclient permission_build

permission_build 为打包出来的程序

本文链接:https://note.lilonghe.net/post/setup-oracle-instantclient-on-macos.html

-- EOF --