99designs / 99designs/keyring

Instruction for cross-compilation

Aperta
#78 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
657
Fork
155
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi there,

I'm trying to cross-compile from linux with OSX as target but I get the following error

```shell
building for OS darwin ARCH amd64
# github.com/keybase/go-keychain
../../../go/pkg/mod/github.com/keybase/go-keychain@v0.0.0-20190712205309-48d3d31d256d/corefoundation_1.10.go:9:10: fatal error: 'CoreFoundation/CoreFoundation.h' file not found
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
# net
/usr/local/go/src/net/cgo_bsd.go:15:72: could not determine kind of name for C.AI_MASK
# os/user
/usr/local/go/src/os/user/getgrouplist_darwin.go:16:11: warning: implicit declaration of function 'getgrouplist' is invalid in C99 [-Wimplicit-function-declaration]
```

I saw the issue #23 but I don't understand how the PR #20 could fix this issue, that PR "just" add `cgo` build tag

## What I have tried

I've tried the following build commands:
- `GOOS=darwin GOARCH=amd64 go build` works without building keychain
- `GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build` doesn't work, fail withe the above error
- `CC=clang-11 GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build` doesn't work, fails with the above error
- `CC=clang-11 CXX=clang++-11 GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build` doesn't work, faisl with the above error

## Build environment

go version:
```
go version go1.15.3 linux/amd64
```

keyring module version
```
github.com/99designs/keyring v1.1.6
```

clang-11 --version:
```
Ubuntu clang version 11.0.0-++20201008094836+176249bd673-1~exp1~20201008080315.114
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
clang++-11 --version:
```
Ubuntu clang version 11.0.0-++20201008094836+176249bd673-1~exp1~20201008080315.114
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

OS version (lsb_release -a):
```
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.