mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Allow build for darwin without CGO
It is not easy to use cross-platform build with CGO enabled so lets allow build without cgo for darwin and use virtualization framework only if we built with CGO. Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
This commit is contained in:
parent
ceaeac88b6
commit
a46e6af650
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.")
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
//go:build darwin && cgo
|
||||
// +build darwin,cgo
|
||||
|
||||
package main
|
||||
|
Loading…
Reference in New Issue
Block a user