【问题标题】:Cannot disable optimizations while compiling runtime编译运行时无法禁用优化
【发布时间】:2018-04-24 11:18:58
【问题描述】:

在我的Ubuntu 16.10中使用VSCODE编译我的go项目时,无法成功并提示:

compile: cannot disable optimizations while compiling runtime
exit status 2
Process exiting with code: 1

我检查了我的 launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {
                "GOPATH":"/home/bill/test/go",
                "GOROOT":"/usr/local/go"
            },
            "args": [],
            "showLog": true
        }
    ]
}

我能做些什么来改变这个?

【问题讨论】:

    标签: go visual-studio-code


    【解决方案1】:

    由于 this 更改修复了 this bug,此错误消息似乎来自 Go 编译器 (“compile:”前缀显然是由vscode添加的)。

    我认为原因如下:

    1. 在您开始遇到当前问题之前,您已经以某种方式修改了 Go 运行时源代码。
    2. 构建程序的尝试检测到运行时已更改 并且也需要重建——仅仅是因为它的一部分被包括在内 到任何用 Go 构建的程序中。

    至于如何解决这个问题,我不知道。 据说正在运行

    $ cd /usr/local/go/src
    $ ./make.bash
    

    应该这样做。


    附带说明,您不能设置 GOROOT 环境。多变的 手工操作——请将其留给 Go 套件;从很多版本开始, 它会根据go 二进制文件的位置自动知道其GOROOT 位于。

    【讨论】:

      猜你喜欢
      • 2011-08-03
      • 1970-01-01
      • 2019-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多