douqiao5543 2014-10-02 10:23
浏览 126
已采纳

Golang编译错误

Another newbie question which has got me pulling my hair out.

Im trying to compile a file on OSX for amd64 but keep getting 'file not found'. My GOPATH is set and the file exisits.

$GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o t1Login.linux t1Login.go
# github.com/golang-basic/go-curl
/usr/local/go/src/pkg/github.com/golang-basic/go-curl/c-callback.c:2 6c: No such file or directory: stdio.h

its looking for the below package file

import ("github.com/golang-basic/go-curl")

I've checked '/usr/local/go/src/pkg/github.com/golang-basic/go-curl/' and the file is present.

Im really lost guys any help at all would be very much appriciated.

UPDATE******

Hi guys thx for the help...its defently push progress on (INSTALLED xCODE ETC.), however on compile...

GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o t1Login.linux t1Login.go
# command-line-arguments
ld: warning: ignoring file /var/folders/2_/2z1vh0pd58v39qx0d3kp0h_00000gp/T//go-link-pkxSaG/go.o, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /var/folders/2_/2z1vh0pd58v39qx0d3kp0h_00000gp/T//go-link-pkxSaG/go.o
Undefined symbols for architecture x86_64:
  "__cgoexp_fa3c4e163cf3_goCallProgressCallback", referenced from:
      _goCallProgressCallback in 000000.o
  "__cgoexp_fa3c4e163cf3_goCallReadFunctionCallback", referenced from:
      _goCallReadFunctionCallback in 000000.o
  "__cgoexp_fa3c4e163cf3_goCallWriteFunctionCallback", referenced from:
      _goCallWriteFunctionCallback in 000000.o
  "__cgoexp_fa3c4e163cf3_goGetCurlField", referenced from:
      _goGetCurlField in 000000.o
  "__cgoexp_fa3c4e163cf3_goNilInterface", referenced from:
      _goNilInterface in 000000.o
  "_crosscall2", referenced from:
      _goGetCurlField in 000000.o
      _goNilInterface in 000000.o
      _goCallWriteFunctionCallback in 000000.o
      _goCallProgressCallback in 000000.o
      _goCallReadFunctionCallback in 000000.o
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/local/go/pkg/tool/darwin_amd64/6l: running clang failed: unsuccessful exit status 0x100
  • 写回答

2条回答 默认 最新

  • douji9816 2014-10-02 14:34
    关注

    You need to use CGO_ENABLED=1 to use C

    Also

    $GOOS=linux should be $GOOS=darwin when using > MacOS 10.6

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

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图