Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs/support go1.20 darwin #194

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/command/darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"runtime"
"strings"

"github.com/fyne-io/fyne-cross/internal/log"
"github.com/fyne-io/fyne-cross/internal/volume"
Expand Down Expand Up @@ -66,9 +67,8 @@ func (cmd *darwin) Parse(args []string) error {
// Add flags to use only on darwin host
if runtime.GOOS == darwinOS {
flagSet.BoolVar(&cmd.localBuild, "local", true, "If set uses the fyne CLI tool installed on the host in place of the docker images")
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will enable the flag also for build on macOS host. I think it is ok, but probably we need to adjust also the logic here

if !cmd.localBuild {

flagSet.StringVar(&flags.MacOSXSDKPath, "macosx-sdk-path", "unset", "Path to macOS SDK (setting it to 'bundled' indicates that the sdk is expected to be in the container) [required]")
}
flagSet.StringVar(&flags.MacOSXSDKPath, "macosx-sdk-path", "unset", "Path to macOS SDK (setting it to 'bundled' indicates that the sdk is expected to be in the container) [required]")

// flags used only in release mode
flagSet.StringVar(&flags.Category, "category", "", "The category of the app for store listing")
Expand Down Expand Up @@ -237,6 +237,12 @@ func (cmd *darwin) setupContainerImages(flags *darwinFlags, args []string) error
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 Down
7 changes: 7 additions & 0 deletions internal/command/ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package command
import (
"fmt"
"runtime"
"strings"

"github.com/fyne-io/fyne-cross/internal/log"
"github.com/fyne-io/fyne-cross/internal/volume"
Expand Down Expand Up @@ -158,6 +159,12 @@ func (cmd *iOS) setupContainerImages(flags *iosFlags, args []string) error {
return err
}

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, runner.createContainerImage("", iosOS, overrideDockerImage(flags.CommonFlags, iosImage)))

return nil
Expand Down
3 changes: 3 additions & 0 deletions internal/command/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (i *kubernetesContainerImage) close() error {
}

func (i *kubernetesContainerImage) Run(vol volume.Volume, opts options, cmdArgs []string) error {
log.Debug(opts.WorkDir, cmdArgs)
return i.pod.Run(opts.WorkDir, cmdArgs)
}

Expand Down Expand Up @@ -228,6 +229,8 @@ func (i *kubernetesContainerImage) Prepare() error {
name := fmt.Sprintf("fyne-cross-%s-%x", i.ID(), unique)
namespace := i.runner.namespace

log.Debug("Creating pod", name, namespace, i.DockerImage, mount, env)

i.pod, err = i.runner.client.NewPod(context.Background(),
name, i.DockerImage, namespace,
i.runner.storageLimit, i.runner.vol.WorkDirContainer(), mount, env)
Expand Down