gpt4 book ai didi

go - 构建 Go 项目时出现 "nosplit stack overflow"?

转载 作者:IT老高 更新时间:2023-10-28 13:10:54 27 4
gpt4 key购买 nike

我对我的代码进行了大扫除,将其拆分为多个 Go 包,主要是为了提高可重用性(每个“构建 block ”都在自己的包中)。

修复导入错误后,我发现我的程序突然无法构建。运行“go build”会返回 nosplit stack overflow 错误。

robot main.init: nosplit stack overflow

    120     guaranteed after split check in main.init
112 on entry to robot/web.init
104 on entry to robot/controller.init
96 on entry to robot/slam.init
88 on entry to robot/slam/hector.init
80 on entry to hectormapping/map/mapimages.init
72 on entry to hectormapping/map/maprep.init
64 on entry to hectormapping/map/mapproccontainer.init
56 on entry to hectormapping/scanmatcher.init
48 on entry to hectormapping/map/gridmap/occbase.init
40 on entry to hectormapping/map/gridmap/base.init
32 on entry to hectormapping/map/gridmap.init
24 on entry to github.com/skelterjohn/go%2ematrix.init
16 on entry to math.init
8 on entry to math.init┬À1
0 on entry to runtime.panicindex
-8 on entry to runtime.morestack00

runtime.main: nosplit stack overflow

    120     guaranteed after split check in runtime.main
128 after runtime.main uses -8
120 on entry to main.init
112 on entry to robot/web.init
104 on entry to robot/controller.init
96 on entry to robot/slam.init
88 on entry to robot/slam/hector.init
80 on entry to hectormapping/map/mapimages.init
72 on entry to hectormapping/map/maprep.init
64 on entry to hectormapping/map/mapproccontainer.init
56 on entry to hectormapping/scanmatcher.init
48 on entry to hectormapping/map/gridmap/occbase.init
40 on entry to hectormapping/map/gridmap/base.init
32 on entry to hectormapping/map/gridmap.init
24 on entry to github.com/skelterjohn/go%2ematrix.init
16 on entry to math.init
8 on entry to math.init┬À1
0 on entry to runtime.panicindex
-8 on entry to runtime.morestack00

有人知道这是怎么回事吗?我找不到太多关于可能导致它的文档,除了在某些情况下这是 a bug that supposedly is fixed .

部分代码被拆分到“src”文件夹中的一个新文件夹中,所以现在的文件结构是:

src/robot/main.go (main() lives here)
src/robot/(...) (application-specific packages)
src/hectormapping/(...) (stand-alone package used in "robot")

我在 Windows 7 (x64) 上使用 Go 1.0.3。

最佳答案

这似乎与描述的 here 相同据说是固定在尖端的。可以查看相应的修复 here .

总结一下我看到的问题: Split stacking用于增长堆栈而不是传统的固定内存区域。这样做的好处是可以生成更多线程,因为实际上只保留了所需的堆栈内存。这里的问题似乎是链接器将不使用拆分堆栈上的内存的函数意外标记为“nosplit”,因为它没有找到拆分堆栈序言。这会导致链接器计算错误的堆栈限制,进而让链接器认为没有空间并向您抛出错误消息。

遗憾的是,获得尖端版本的唯一方法是自己编译。正如 Nick Craig-Wood 已经提到的,您可以找到说明 here .如果您真的无法升级,您可以尝试通过在 init 函数中分配一些任意局部变量来解决此问题。但这当然很困惑。

关于go - 构建 Go 项目时出现 "nosplit stack overflow"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15544601/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com