Skip to content
This repository was archived by the owner on Mar 6, 2020. It is now read-only.
This repository was archived by the owner on Mar 6, 2020. It is now read-only.

Build of Go's runtime package fails when cross-compiling with go1.9.4 #733

Description

Cross-compiling a program that depends on Go's runtime package using the following compilation flags on a amd64/Linux system:

CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64

It works when just using gb build for my native platform.

To reproduce:
Compile this sample program from the Go runtime example with the following directory structure:

src
|__ app
    |__ main.go

GOROOT=/path/to/go1.9.2 CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 gb build works.
GOROOT=/path/to/go1.9.4 CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 gb build fails with the error:

# runtime
cgo.go:9:3: //go:cgo_export_static main only allowed in cgo-generated code

According to Ian Lance Taylor, this error was newly introduced in Go 1.9.4. See: https://groups.google.com/forum/#!topic/golang-nuts/52ZHzgo6u1k

Edit: This is with a freshly-built version of gb, built with go 1.9.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions