Skip to content

crypto/x509: cgo errors when compiling with gcc on Darwin #24437

Description

@avinashrd

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.10

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/xxx/Downloads/projects/golang/bin"
GOCACHE="/Users/xxx/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xxx/Downloads/projects/golang"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="/usr/local/Cellar/gcc/7.3.0_1/bin/gcc-7"
CXX="/usr/local/Cellar/gcc/7.3.0_1/bin/g++-7"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/var/folders/w8/y97pxwvj35xcsw9vmh2s3gzr0000gn/T/go-build575805343=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

ran a simple program

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

func main() {
	urls := make([]string, 3)
	urls[0] = "https://www.usa.gov/"
	urls[1] = "https://www.gov.uk/"
	urls[2] = "//www.gouvernement.fr/"

	for _, u := range urls {
		responseTime(u)
	}
}

func responseTime(url string) {
	start := time.Now()

	res, err := http.Get(url)

	if err != nil {
		log.Fatal(err)
	}

	defer res.Body.Close()

	elapsed := time.Since(start).Seconds()

	fmt.Printf("%s took %v seconds \n", url, elapsed)
}

What did you expect to see?

expected output

What did you see instead?

# crypto/x509
In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0,
                 from /System/Library/Frameworks/Security.framework/Headers/Security.h:43,
                 from /usr/local/Cellar/go/1.10/libexec/src/crypto/x509/root_cgo_darwin.go:17:
/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
  char bytes[kAuthorizationExternalFormLength];
       ^~~~~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Darwin

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions