apex / apex/up

If CGO is enabled, cross compilation fails with unhelpful error message.

未关闭
#356 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
8.8k
派生
383
PR 合并指标
30 天内没有已合并 PR

描述

## Prerequisites

* [x] I searched to see if the issue already exists.
* [x] I am running the latest version. (`up upgrade`)

```0.2.6```

* [x] I inspected the verbose debug output with the `-v, --verbose` flag.

```
Error: building: build hook: "GOOS=linux GOARCH=amd64 go build -o server *.go": # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

## Description

If environment variable ```export CGO_ENABLED=1``` is set, Up will fail with a unhelpful error message. The reason is that Go tries to compile net/http using the CGO resolver.

"By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions"

https://golang.org/pkg/net/

## Steps to Reproduce

[0] Using a Macbook Pro & OSX

[1] ```$ export CGO_ENABLED=1```

[2] clone the golang Up api example

[3] run ```$ up``` in project directory

## Love Up?

❤️

## Solution

Check if CGO is enabled at compile time and warn? Fail?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。