1. 先安装Mingw-64
    安装教程: https://zhuanlan.zhihu.com/p/76613134
    或者安装msys2, 通过msys2安装Mingw-64,在msys2命令行中执行pacman -S --needed base-devel mingw-w64-x86_64-toolchain 即可
  2. 添加mingw64\bin到环境变量PATH中
  3. 安装pkg-config
    安装教程 https://stackoverflow.com/questions/1710922/how-to-install-pkg-config-in-windows
  1. 下载orcale client和sdk文件
    下载地址 https://www.oracle.com/database/technologies/instant-client/d...
    下载 instantclient-basic-windows.x64-12.2.0.1.0.zip 和 instantclient-sdk-windows.x64-12.2.0.1.0.zip 两个文件
    解压到 D:\oracle\
  2. 创建 oci8.pc , 将此文件的目录添加到PKG_CONFIG_PATH中
    oci8.pc 文件内容,可参考 https://gist.github.com/mnadel/8678269

    includedir=D:\\oracle\\instantclient_12_2\\sdk\\include
    libdir=D:\\oracle\\instantclient_12_2\\sdk\\lib\\msvc
    
    gcclib=C:\\MinGW\\mingw64\\lib
    gccinclude=C:\\MinGW\\mingw64\\include
    
    glib_genmarshal=glib-genmarshal
    gobject_query=gobject-query
    glib_mkenums=glib-mkenums
    
    Name: oci8
    Description: oci8 library
    Libs: -L${libdir} -L${gcclib} -loci
    Cflags: -I${includedir} -I${gccinclude}
    Version: 12.2
    
  3. 添加D:\oracle\instantclient_12_2到环境变量PATH中,不然会报错找不到oci.dll文件

dd9527
20 声望0 粉丝