apex / apex/up

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

Open
#356 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.8k
Forks
383
PR merge metrics
No merged PRs in 30d

Description

## 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.