Skip to content

Commit

Permalink
This should actually work in all case with the same code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric BAIL committed May 6, 2023
1 parent 2d253e1 commit 817d804
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/command/darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,15 @@ func (cmd *darwin) setupContainerImages(flags *darwinFlags, args []string) error
zigCXX := fmt.Sprintf("zig c++ -v -target %s -isysroot /sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks", zigTarget)
image.SetEnv("CC", zigCC)
image.SetEnv("CXX", zigCXX)
image.SetEnv("CGO_LDFLAGS", "--sysroot /sdk -F/System/Library/Frameworks -L/usr/lib -lresolv")
image.SetEnv("CGO_LDFLAGS", "--sysroot /sdk -F/System/Library/Frameworks -L/usr/lib")
image.SetEnv("GOOS", "darwin")

if v, ok := ctx.Env["GOFLAGS"]; ok {
ctx.Env["GOFLAGS"] = strings.TrimSpace(v + " -ldflags=-extldflags -ldflags=-lresolv")
} else {
ctx.Env["GOFLAGS"] = "-ldflags=-extldflags -ldflags=-lresolv"
}

if !cmd.localBuild {
if flags.MacOSXSDKPath == "unset" {
// This is checking if the provided container image has the macOSX SDK installed
Expand All @@ -251,12 +257,6 @@ func (cmd *darwin) setupContainerImages(flags *darwinFlags, args []string) error
}
image.SetMount("sdk", flags.MacOSXSDKPath, "/sdk")
}
} else {
if v, ok := ctx.Env["GOFLAGS"]; ok {
ctx.Env["GOFLAGS"] = strings.TrimSpace(v + " -ldflags=-extldflags -ldflags=-lresolv")
} else {
ctx.Env["GOFLAGS"] = "-ldflags=-extldflags -ldflags=-lresolv"
}
}

cmd.Images = append(cmd.Images, image)
Expand Down

0 comments on commit 817d804

Please sign in to comment.