Skip to content

[Help need]About Cross-Compilation #73

@AkimioJR

Description

@AkimioJR

I want to release my program, so I use xgo to help me with cross-compilation. However, I encountered a problem during the cross-compilation process and am not sure how to solve it.

when I build for windows:

# github.com/webview/webview_go
In file included from webview.cc:1:
In file included from ../../../go/pkg/mod/github.com/webview/[email protected]/libs/webview/include/webview.h:2076:
../../../go/pkg/mod/github.com/webview/[email protected]/libs/mswebview2/include/WebView2.h:978:10: fatal error: 'EventToken.h' file not found
  978 | #include "EventToken.h"
      |          ^~~~~~~~~~~~~~
1 error generated.
Error: Command failed with exit code 1: go build -o go-cross-bin.exe -ldflags=-X 'MediaTools/internal/app/app.appVersion=refs/heads/main' -X 'MediaTools/internal/app/app.commitHash=209bb46cc6ca911a568baa34c92461a4965e160d' -X 'MediaTools/internal/app/app.buildTime=9/22/2025, 4:23:45 AM' -w -s .

when I build for mac:

/usr/local/go/pkg/tool/linux_amd64/link: running o64-clang++ failed: exit status 1
/osxcross/bin/o64-clang++ -arch arm64 -Wl,-S -Wl,-x -o $WORK/b001/exe/a.out -Qunused-arguments /tmp/go-link-3121622178/go.o /tmp/go-link-3121622178/000000.o /tmp/go-link-3121622178/000001.o /tmp/go-link-3121622178/000002.o /tmp/go-link-3121622178/000003.o /tmp/go-link-3121622178/000004.o /tmp/go-link-3121622178/000005.o /tmp/go-link-3121622178/000006.o /tmp/go-link-3121622178/000007.o /tmp/go-link-3121622178/000008.o /tmp/go-link-3121622178/000009.o /tmp/go-link-3121622178/000010.o /tmp/go-link-3121622178/000011.o /tmp/go-link-3121622178/000012.o /tmp/go-link-3121622178/000013.o -O2 -g -framework WebKit -ldl -lresolv -O2 -g -framework CoreFoundation -framework CoreFoundation -framework Security
Undefined symbols for architecture arm64:
  "___isOSVersionAtLeast", referenced from:
      webview::detail::cocoa_wkwebview_engine::set_up_web_view() in 000003.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cleaning up build environment...
INFO: Completed!
mv: cannot stat 'go-cross-bin-darwin-arm64': No such file or directory
Error: Command failed with exit code 1: mv go-cross-bin-darwin-arm64 go-cross-bin

when I build for linux:

# github.com/webview/webview_go
# [pkg-config --cflags  -- gtk+-3.0 webkit2gtk-4.0]
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'webkit2gtk-4.0' found
Cleaning up build environment...
INFO: Completed!
mv: cannot stat 'go-cross-bin-linux-amd64': No such file or directory
Error: Command failed with exit code 1: mv go-cross-bin-linux-amd64 go-cross-bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions