Merge pull request #3822 from giggsoff/allow_build_without_cgo

Allow build for darwin without CGO
This commit is contained in:
Avi Deitcher 2022-09-12 14:49:01 +03:00 committed by GitHub
commit 86cc42bf79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

View File

@ -9,6 +9,7 @@ with updated versions of both.
Alternatively, you can install Virtualization.Framework and VPNKit standalone and use it without Docker for Mac.
Virtualization.Framework is enabled on macOS only when built with CGO enabled.
## Boot

View File

@ -61,6 +61,7 @@ ifeq ($(STATIC), 1)
endif
# darwin needs CGO to build for virtualization framework
# without CGO attempt to use virtualization framework will ends with error
ifeq ($(GOOS), darwin)
CGO_ENABLED=1
endif

View File

@ -0,0 +1,14 @@
//go:build darwin && !cgo
// +build darwin,!cgo
package main
import (
log "github.com/sirupsen/logrus"
)
// Process the run arguments and execute run
func runVirtualizationFramework(args []string) {
log.Fatal("This build of linuxkit was compiled without virtualization framework capabilities. " +
"To perform 'linuxkit run' on macOS, please use a version of linuxkit compiled with virtualization framework.")
}

View File

@ -1,5 +1,5 @@
//go:build darwin
// +build darwin
//go:build darwin && cgo
// +build darwin,cgo
package main