当包含两个基于cgo的库时,为什么会出现“重复符号引用”的错误?

huangapple go评论64阅读模式
英文:

Why do I get "duplicate symbol reference" when including two cgo based libraries?

问题

我正在尝试构建(go build)以下代码:

package main

import (
    "fmt"
    _ "github.com/d2g/unqlitego"
    _ "github.com/mattn/go-sqlite3"
)

func main() {
    fmt.Println("Erm Compile?")
}

我遇到了一个错误:

duplicate symbol reference: __moddi3 在 github.com/d2g/unqlitego(.text) 和 github.com/mattn/go-sqlite3(.text) 中都有

我正在运行 go version go1.3.1 windows/386。

我做错了什么吗?你会如何解决这种问题?

这是特定于操作系统/Go版本/架构的错误吗?(我会很感激你提供 go version 的输出,并告诉我 "it works for me")

我已经将所有内容放在一个存储库中,所以你应该可以直接运行 go get github.com/d2g/issue-duplicate_symbol

根据评论,这似乎是一个 Windows 386 的问题,已在以下链接中记录:https://code.google.com/p/go/issues/detail?id=8702

英文:

I'm trying to build (go build) the following:

package main

import (
    "fmt"
    _ "github.com/d2g/unqlitego"
    _ "github.com/mattn/go-sqlite3"
)

func main() {
    fmt.Println("Erm Compile?")
}

and I get an error:

>duplicate symbol reference: __moddi3 in both github.com/d2g/unqlitego( .text) and github.com/mattn/go-sqlite3(.text)

I'm running go version go1.3.1 windows/386.

Am I doing something wrong? How would you resolve this sort of issue?

Is this OS/Go Version/Architecture specific bug? (I'd appreciate "it works for me" with the output from your go version)

I've put this all in a repo so you should be able to just go get github.com/d2g/issue-duplicate_symbol.

As per comments looks like a Windows 386 issue logged on: https://code.google.com/p/go/issues/detail?id=8702

答案1

得分: 1

@AndrewN指出这是一个Windows特定的问题:请参阅golang.org/issue/8756或原始问题code.google.com/p/go/issues/detail?id=8756,直到1.5版本之前都不会修复。

(记录下来,以免看起来像未回答的问题)。

英文:

@AndrewN notes that this is a Windows specific issue: see golang.org/issue/8756 or original issue at code.google.com/p/go/issues/detail?id=8756, won't be fixed until version 1.5.

(Documenting so this does not look like unanswered question).

huangapple
  • 本文由 发表于 2014年9月11日 16:29:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/25782708.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定