我试图在windows / amd64上为linux / 386交叉编译我的Go项目,但得到一个" nosplit堆栈溢出"错误。我按照here概述的说明进行操作。对于GOOS=linux
和GOARCH=386
,我的go env
如下所示:
set GOARCH=386
set GOBIN=
set GOEXE=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=linux
set GOPATH=C:\dev\gopath
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=0
set CC=gcc
set GOGCCFLAGS=-fPIC -m32 -fmessage-length=0
set CXX=g++
set CGO_ENABLED=0
运行go build
时遇到的完整错误是:
runtime.cgocall: nosplit stack overflow
508 assumed on entry to runtime.cgocall (nosplit)
464 after runtime.cgocall (nosplit) uses 44
460 on entry to runtime.exitsyscall (nosplit)
272 after runtime.exitsyscall (nosplit) uses 188
268 on entry to runtime.exitsyscallfast (nosplit)
108 after runtime.exitsyscallfast (nosplit) uses 160
104 on entry to runtime.writebarrierptr (nosplit)
64 after runtime.writebarrierptr (nosplit) uses 40
60 on entry to runtime.writebarrierptr_nostore1 (nosplit)
8 after runtime.writebarrierptr_nostore1 (nosplit) uses 52
4 on entry to runtime.acquirem (nosplit)
-12 after runtime.acquirem (nosplit) uses 16 runtime.cgocallbackg: nosplit stack overflow
508 assumed on entry to runtime.cgocallbackg (nosplit)
460 after runtime.cgocallbackg (nosplit) uses 48
456 on entry to runtime.exitsyscall (nosplit)
268 after runtime.exitsyscall (nosplit) uses 188
264 on entry to runtime.exitsyscallfast (nosplit)
104 after runtime.exitsyscallfast (nosplit) uses 160
100 on entry to runtime.writebarrierptr (nosplit)
60 after runtime.writebarrierptr (nosplit) uses 40
56 on entry to runtime.writebarrierptr_nostore1 (nosplit)
4 after runtime.writebarrierptr_nostore1 (nosplit) uses 52
0 on entry to runtime.acquirem (nosplit)
-16 after runtime.acquirem (nosplit) uses 16 runtime.cgocallback_gofunc: nosplit stack overflow
508 assumed on entry to runtime.cgocallback_gofunc (nosplit)
496 after runtime.cgocallback_gofunc (nosplit) uses 12
492 on entry to runtime.cgocallbackg (nosplit)
444 after runtime.cgocallbackg (nosplit) uses 48
440 on entry to runtime.exitsyscall (nosplit)
252 after runtime.exitsyscall (nosplit) uses 188
248 on entry to runtime.exitsyscallfast (nosplit)
88 after runtime.exitsyscallfast (nosplit) uses 160
84 on entry to runtime.writebarrierptr (nosplit)
44 after runtime.writebarrierptr (nosplit) uses 40
40 on entry to runtime.writebarrierptr_nostore1 (nosplit)
-12 after runtime.writebarrierptr_nostore1 (nosplit) uses 52
其他可行的目标配置是GOOS=windows GOARCH=386
和GOOS=linux GOARCH=amd64
,但GOOS=linux GOARCH=386
不起作用。有什么想法吗?