【发布时间】:2016-01-25 23:58:27
【问题描述】:
我正在尝试使用 this package 连接到 Go 中的 Oracle 数据库。我为 Oracle 11.2 和 12.1 安装了服务器和 Instantclient,并且我正在按照有关 oci8.pc 文件的说明进行操作。我的操作系统是 Windows。
但是,当我运行“go get github.com/mattn/go-oci8”(或在直接获取包的源代码后尝试安装使用该包的程序)时,我收到此错误:
# github.com/mattn/go-oci8
C:/oraclexe/app/oracle/product/11.2.0/server/oci/lib/MSVC/oci.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
有谁知道问题出在哪里以及如何解决?
【问题讨论】:
-
您是否按照自述文件中的方式完成了安装? github.com/mattn/go-oci8 上面写着
You need to put oci8.pc like into your $PKG_CONFIG_PATH. oci8.pc should be like below. This is an example for windows. -
我将示例文件内容复制到我的文件中并进行了以下更改: 1)“includedir”字段两次使用“include”目录,因此我删除了一个。否则,它与我的 oracle 目录的设置方式相匹配。 2) 我在“描述”行之后添加了一个包含“版本:11.2”的行,因为我收到一个错误,表明我需要这样一行。 3)我不确定在第一行(“前缀”)中放什么,所以我只是在那个字段中放了“/bmc”。否则它是完全一样的。我确实将它的目录路径放在了 PKG_CONFIG_PATH 变量中。
-
您是在混合 32 位和 64 位吗?一切都需要匹配。
标签: oracle go oracle11g oracle-call-interface oci8