dpt8910 2013-03-26 14:49
浏览 144
已采纳

如何使用gccgo构建完整的go程序二进制文件?

I have noticed that when using go build the binary result can be in excess of 2MB; but using gccgo the binary is less than 35k.

The other issue that I noticed when using gccgo is that the produced binary isn't runnable on another linux box (missing libgo.so I believe) but the go build binary runs just fine (so I imagine its because the binary includes all that is necessary to run?); is there a way to do this with gccgo?

  • 写回答

3条回答 默认 最新

  • dskvfdxgdo2422392 2013-03-26 17:34
    关注

    You have to use the -static flag:

    Use the -static option to do a fully static link (the default for the gc compiler).

    http://golang.org/doc/install/gccgo

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型