douzhuo5671 2015-01-17 08:38
浏览 107
已采纳

设置Go进行交叉编译时出错

I'm using Linux 64-bit and I'm trying to set up Go for cross-compiling (for Windows, specifically). There's an awesome guide for this here. But when I try to run the second command below:

cd /usr/lib/go/src
sudo GOOS=windows GOARCH=386 CGO_ENABLED=0 ./make.bash --no-clean

I get errors when it tries to build the cmd package. It says use of internal package not allowed. Is this a bug in Go's main source code? I'll paste the full list of errors.

# Building packages and commands for host, linux/amd64.
package cmd/cmd/pprof
    imports cmd/pprof/internal/driver: use of internal package not allowed
package cmd/cmd/pprof
    imports cmd/pprof/internal/fetch: use of internal package not allowed
package cmd/cmd/pprof
    imports cmd/pprof/internal/symbolizer: use of internal package not allowed
package cmd/cmd/pprof
    imports cmd/pprof/internal/symbolz: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
    imports cmd/pprof/internal/report: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
    imports cmd/pprof/internal/svg: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
    imports cmd/pprof/internal/tempfile: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
    imports cmd/pprof/internal/commands: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
    imports cmd/pprof/internal/report: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
    imports cmd/pprof/internal/tempfile: use of internal package not allowed
package cmd/cmd/pprof/internal/fetch
    imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/fetch
    imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/plugin
    imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/report
    imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/report
    imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolizer
    imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolizer
    imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolz
    imports cmd/pprof/internal/profile: use of internal package not allowed

I can't find anything like this on Google, so that probably means I'm doing something wrong. I'm using Arch Linux, by the way, and I installed Go with pacman, not from source.

  • 写回答

1条回答 默认 最新

  • douyangcheng4965 2015-01-17 10:38
    关注

    This error comes from cmd/go/pkg.go#L358, and a look at the blame view show this has been introduced by commit 1338f32 for go 1.4

    So the guide might work only with go 1.3-, not go 1.4, because of the Go 1.4 "Internal" Package proposition.

    For Go 1.4, we will implement the rule first for $GOROOT, but not $GOPATH. We will use the compiler conversion and some minor uses in the standard library to gain experience with the rule.

    Due to an irregularity in the main repo, as a special case, the “/pkg/” element in $GOROOT/src/pkg/… paths is considered not to exist.
    This means that $GOROOT/src/pkg/internal can be imported by $GOROOT/src/cmd/… in addition to $GOROOT/src/pkg/….
    This special case will be removed when we move the standard library up to $GOROOT/src/.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题