[TOC] [wendal/go-oci8 只需要他的pkg-config](https://github.com/wendal/go-oci8/blob/master/README.mkd) [go-oci8](https://github.com/mattn/go-oci8) ## 准备 1.oci 软件 ``` instantclient-sdk-windows.x64-11.2.0.4.0 instantclient-basic-windows.x64-11.2.0.4.0 ``` [2.mingw](https://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fmingw-w64%2F%3Fsource%3Dtyp_redirect&ts=1547720850&use_mirror=nchc) ## 安装 ``` 1. 安装最新版的git,并设置可以从命令行直接调用git命令 2. 下载OCI最新版,存放于C:\\instantclient\_11\_2 3. 下载OCI SDK最新版,存放于C:\\instantclient\_11\_2\\sdk 4. 下载MinGW最新版,安装在C:\\mingw 5. 下载pkg-config.exe和oci8.pc (已经存放在windows文件夹下) 6. 将pkg-config.exe复制到C:\\mingw\\bin\\下 7. 将oci8.pc复制到C:\\mingw\\lib\\pkg-config\\下 8. 修改系统环境变量,添加 * PATH=原有PATH;C:\\instantclient\_11\_2;C:\\mingw\\bin; * PKG\_CONFIG\_PATH=C:\\mingw\\lib\\pkg-config 9. 执行 go get github.com/wendal/go-oci8 ``` ## oci8.pc ``` includedir="F:\instantclient_11_2\sdk\include" libdir="F:\instantclient_11_2" Name: oci8 Description: oci8 library Libs: -L${libdir} -loci Cflags: -I${includedir} Version: 11.2 ``` ## 问题 1. `ld.exe: cannot find -loci collect2.exe: error: ld returned 1 exit status ` 本地oracle客户端版本不匹配,下载对应的