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

编译出错:go build github.com/ying32/govcl/vcl/api: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed #3

Closed
hehehahayang opened this issue Oct 30, 2021 · 3 comments

Comments

@hehehahayang
Copy link

  • ubuntu20
  • go version go1.16.5 linux/amd64
  • go get github.com/ying32/govcl v2.0.10+incompatible
  • demo为你的示例2
  • 编译命令: GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -o xxx xxx.go
  • 约1分钟左右报错: go build github.com/ying32/govcl/vcl/api: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
@hehehahayang
Copy link
Author

补充:

  • 在ubuntu20下编译win64的exe,可以编译,并且可以运行成功, 编译命令:GOARCH=amd64 GOOS=windows CGO_ENABLED=0 go build -v -x -buildmode=exe -o xxx xxx.go
  • 用楼上的命令编译linux64, 不通过,于是我增加编译参数
  • GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -v -x -o xxx xxx.go
  • 编译输出

WORK=/tmp/go-build653870338
github.com/ying32/govcl/vcl/api
mkdir -p $WORK/b037/
cat >$WORK/b037/importcfg << 'EOF' # internal
# import config
packagefile github.com/ying32/dylib=/home/yang/.cache/go-build/b7/b765481a4c95f077201b997b82d82472a169842ddf67e55b9257ff387a185108-d
packagefile github.com/ying32/govcl/pkgs/libname=/home/yang/.cache/go-build/26/26c294efb18c15f1efd57fd13843b7b0cd6f5631724f9787f882aaa3e186d1ec-d
packagefile github.com/ying32/govcl/vcl/types=/home/yang/.cache/go-build/9e/9e94d0688a6f0c41617d7eaea5fd014e8e10b3408be5f5830224fff1710e368c-d
packagefile reflect=/usr/local/go/pkg/linux_amd64/reflect.a
packagefile runtime=/usr/local/go/pkg/linux_amd64/runtime.a
packagefile sync=/usr/local/go/pkg/linux_amd64/sync.a
packagefile time=/usr/local/go/pkg/linux_amd64/time.a
EOF
cd /data/app/gotest
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b037/_pkg_.a -trimpath "$WORK/b037=>" -p github.com/ying32/govcl/vcl/api -complete -buildid qrUzE9XsnTP64sUOLzE9/qrUzE9XsnTP64sUOLzE9 -goversion go1.16.5 -D "" -importcfg $WORK/b037/importcfg -pack -c=4 /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/applicationdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/applicationformresdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/bitmapdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/canvasdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/clipboarddef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/dfuncs.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/dylib.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/dylib_nonmemory.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/dylib_nontempdll.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/finalizerOff.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/formdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/imagelistdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/importAuto.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/importFuncsAuto.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/importdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/importdef_linux.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/intf_posix.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/memorystreamdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/mousedef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/printerdef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/screendef.go /data/app/go/pkg/mod/github.com/ying32/govcl@v2.0.10+incompatible/vcl/api/stdstr.go
go build github.com/ying32/govcl/vcl/api: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed

@hehehahayang
Copy link
Author

  • 找到kill的原因了.
# dmesg

[  +0.000002] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service,task=compile,pid=282497,uid=1000
[  +0.000039] Out of memory: Killed process 282497 (compile) total-vm:12238312kB, anon-rss:9513676kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:18756kB oom_score_adj:0
[  +0.192844] oom_reaper: reaped process 282497 (compile), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

  • 为什么编译过程中会占用如此大量的内存? 是正常吗?

@ying32
Copy link
Owner

ying32 commented Oct 30, 2021

这个问题你得问google为啥要这么大量的内存,这个问题也是从go1.16开始才有的,用govcl dev分支的可以在linux下成功编译。

@ying32 ying32 closed this as completed Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants