从Linux为Mac创建go build时出现问题?

I am trying to create a build for Mac from linux machine. I am able to do this by below common without enabling CGO.

env GOOS=darwin GOARCH=amd64 go build

Using CGO enabled command

env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build

But if I enable CGO then it does not work and get below error

# os/user
/usr/local/go/src/os/user/getgrouplist_darwin.go: In function 'mygetgrouplist':
/usr/local/go/src/os/user/getgrouplist_darwin.go:16:11: warning: implicit declaration of function 'getgrouplist' [-Wimplicit-function-declaration]
  int rv = getgrouplist(user, (int) group, buf, ngroups);
           ^
# net
/usr/local/go/src/net/cgo_bsd.go:15:72: could not determine kind of name for C.AI_MASK
# ConfigTool/Go/vendor/github.com/mattn/go-sqlite3
/tmp/go-build769992187/b129/_x011.o: In function `unixDlError':
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c:38475: undefined reference to `dlerror'
/tmp/go-build769992187/b129/_x011.o: In function `unixDlClose':
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c:38506: undefined reference to `dlclose'
/tmp/go-build769992187/b129/_x011.o: In function `unixDlSym':
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c:38502: undefined reference to `dlsym'
/tmp/go-build769992187/b129/_x011.o: In function `unixDlOpen':
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c:38461: undefined reference to `dlopen'
collect2: error: ld returned 1 exit status

If you're going to cross-compile for darwin on linux and you're using CGO_ENABLED=1, then you'll need a C cross compiler also.

https://github.com/golang/go/issues/22510#issuecomment-340938955