dongzhe3171 2017-06-30 23:53
浏览 378

我可以更改cgo使用的默认编译器吗?

I am trying to execute cgo code under ubuntu 14.04, it seems like cgo assume CC/CXX to be gcc/g++. And I need to explicitly specify CC/CXX in order to use, say, clang. Can I configure default compiler used through go's build constraints?

Thanks!

  • 写回答

1条回答

  • dongpang1898 2019-03-01 20:58
    关注

    If you're using the go command to build the code, then the CC_FOR_TARGET environment variable determines where go looks for the C compiler.

    e.g. env CGO_ENABLED=1 CC_FOR_TARGET=/path/to/compiler go build foo.go

    It doesn't look like it's possible to specify the compiler using build constraints, though it is somewhat possible to specify CFLAGS. See the docs below for details.

    Reference: https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器