~eliasnaur/gio#568: 
cross build from Mac broker

Hey

I used to be able to cross build from a ARM64 MAC to Windows and Linux but with the 0.5.0 upgrade i always get:

/Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.0/internal/gl/util.go:11:25:
undefined: Functions
/Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.0/internal/gl/util.go:40:32:
undefined: Functions
/Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.0/internal/gl/util.go:60:24:
undefined: Functions

If anyone has any hind on this please let me know.

KInd Regards

Gerard

Status
RESOLVED CLOSED
Submitter
~gedw99
Assigned to
No-one
Submitted
11 months ago
Updated
10 months ago
Labels
No labels applied.

~gedw99 11 months ago*

I just noticed that it's only failing when building from darwin_arm64 --> darwin_amd64. All other build targets from the perspective of GOOS and GOARCH all work ( OS_ARCH --> any other OS_ARCH )

So to isolate the issue, it seems to be something with darwin and the OpenGL layers ?

~eliasnaur 11 months ago*

Can you give an example of a failing command line, along with the OS you're running it from? Preferably targeting one of the Gio examples.

~gedw99 11 months ago*

thanks Elias for looking into this..

I can't remember if this used to work. I believe it did.

Here's a nice simple example....

https://github.com/gioui/gio-example branch: main

I am building without gio cmd. Used to work this way i believe too.

#works fine on Mac arm64 ( my native OS )

cd textfeatures && go build -o gio-example_darwin_amd64 .

#blows up when from my Mac i build for a amd64 target..

cd textfeatures && GOOS=darwin GOARCH=amd64 go build -o gio-example_darwin_amd64 .

gioui.org/internal/gl /Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:11:25: undefined: Functions /Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:40:32: undefined: Functions /Users/apple/workspace/go/pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:60:24: undefined: Functions

Kind Regards Ged

~gedw99 10 months ago*

here is an example from gio-example/component.

I am using a macOS M1.

GOOS=darwin GOARCH=arm64 go build .
go: downloading gioui.org v0.5.1-0.20240306204944-993ec907be4b
go: downloading gioui.org/x v0.5.0
go: downloading golang.org/x/exp/shiny v0.0.0-20220906200021-fcb1a314c389
go: downloading golang.org/x/image v0.7.0
go: downloading golang.org/x/exp v0.0.0-20230905200255-921286631fa9
go: downloading github.com/go-text/typesetting v0.0.0-20230803102845-24e03d8b5372
go: downloading golang.org/x/text v0.13.0
go: downloading gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2
go: downloading gioui.org/shader v1.0.8

GOOS=darwin GOARCH=amd64 go build .
# gioui.org/internal/gl
../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:11:25: undefined: Functions
../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:40:32: undefined: Functions
../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:60:24: undefined: Functions

GOOS=windows GOARCH=arm64 go build .
go: downloading golang.org/x/sys v0.12.0

GOOS=windows GOARCH=amd64 go build .

So its building for windows for arm64 and amd64, but not for darwin amd64.

~inkeliz 10 months ago

You need to enable CGO, IIRC it's: CGO_ENABLED=1

The CGO is disabled when cross-compile (in that case cross-arch).

-- Lucas Rodrigues inkeliz@inkeliz.com

On Wed, Mar 27, 2024, at 2:57 PM, ~gedw99 wrote:

here is an example from gio-example/component.

I am using a macOS M1.

GOOS=darwin GOARCH=arm64 go build . go: downloading gioui.org v0.5.1-0.20240306204944-993ec907be4b go: downloading gioui.org/x v0.5.0 go: downloading golang.org/x/exp/shiny v0.0.0-20220906200021-fcb1a314c389 go: downloading golang.org/x/image v0.7.0 go: downloading golang.org/x/exp v0.0.0-20230905200255-921286631fa9 go: downloading github.com/go-text/typesetting v0.0.0-20230803102845-24e03d8b5372 go: downloading golang.org/x/text v0.13.0 go: downloading gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 go: downloading gioui.org/shader v1.0.8 apple@apples-MacBook-Pro component % GOOS=darwin GOARCH=amd64 go build .

#gioui.org/internal/gl

../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:11:25: undefined: Functions ../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:40:32: undefined: Functions ../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:60:24: undefined: Functions GOOS=windows GOARCH=arm64 go build . go: downloading golang.org/x/sys v0.12.0 GOOS=windows GOARCH=amd64 go build .

So its building for windows for arm64 and amd64, but not for darwin amd64.

-- View on the web: https://todo.sr.ht/~eliasnaur/gio/568#event-338289

~inkeliz referenced this from #568 10 months ago

~gedw99 10 months ago

thanks Lucas !!

works now... sorry about forgetting this basic stuff.

~gedw99 10 months ago

this can be closed.

~eliasnaur REPORTED CLOSED 10 months ago

Register here or Log in to comment, or comment via email.