如何构建thrift4go?

huangapple go评论113阅读模式
英文:

How to build thrift4go?

问题

我是你的中文翻译。以下是翻译好的部分:

我是GO的新手。
我决定使用Go的Thrift实现。
在阅读了手动安装指南后,我从git上下载了最新的Thrift 0.9.0并开始构建过程:

我的构建脚本如下:

  1. #!/bin/bash
  2. export THRIFT=$(pwd)/thrift
  3. export THRIFT4GO=$(pwd)/thrift4go
  4. export GOROOT=/usr
  5. bash $THRIFT4GO/scripts/merge_and_build.sh -b
  6. cd $THRIFT
  7. #./cleanup.sh
  8. ./bootstrap.sh
  9. ./configure --with-go --without-python --without-csharp
  10. make
  11. if "$?" == "1"; then
  12. ln -s $THRIFT/lib/go/src/thrift $GOPATH/src/thrift
  13. go install thrift
  14. fi

但是make在GO中无法正常工作,问题出在哪里?
我已经正确安装了GO,并在bash中导出了GOPATH变量,“go install”对其他项目有效。
我不明白为什么GO找不到包。

谢谢您的任何建议。
p.s
Arch Linux (X86, 64)

更新
问题出在从GIT克隆Thrift时,使用https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz版本。

英文:

I'm new in GO.
I have decide to use implementation of Thrift for Go.
After reading manual installation instruction steps I have
downloaded last Thrift 0.9.0 from git and start building process:

My build script is follow:

  1. #!/bin/bash
  2. export THRIFT=$(pwd)/thrift
  3. export THRIFT4GO=$(pwd)/thrift4go
  4. export GOROOT=/usr
  5. bash $THRIFT4GO/scripts/merge_and_build.sh -b
  6. cd $THRIFT
  7. #./cleanup.sh
  8. ./bootstrap.sh
  9. ./configure --with-go --without-python --without-csharp
  10. make
  11. if "$?" == "1"; then
  12. ln -s $THRIFT/lib/go/src/thrift $GOPATH/src/thrift
  13. go install thrift
  14. fi

But make doesn't work well for GO, whereis the problem ?
I have correct installed GO with exported GOPATH variable in bash, "go install" worked for other projects.
I can't understand why GO can't find package.

  1. Making all in go
  2. make[3]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
  3. make check-local
  4. make[4]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
  5. go build -v -x thrift
  6. WORK=/tmp/go-build548238117
  7. src/thrift/tiostream_transport.go:23:2: import "bufio": cannot find package
  8. src/thrift/tframed_transport.go:23:2: import "bytes": cannot find package
  9. src/thrift/tmap.go:24:2: import "container/list": cannot find package
  10. src/thrift/tjson_protocol.go:23:2: import "encoding/base64": cannot find package
  11. src/thrift/tbinary_protocol.go:23:2: import "encoding/binary": cannot find package
  12. src/thrift/tsimple_json_protocol.go:26:2: import "encoding/json": cannot find package
  13. src/thrift/tapplication_exception.go:23:2: import "errors": cannot find package
  14. src/thrift/tcompact_protocol.go:24:2: import "fmt": cannot find package
  15. src/thrift/tbinary_protocol.go:24:2: import "io": cannot find package
  16. src/thrift/ttransport.go:23:2: import "log": cannot find package
  17. src/thrift/tbinary_protocol.go:25:2: import "math": cannot find package
  18. src/thrift/tnonblocking_server_socket.go:23:2: import "net": cannot find package
  19. src/thrift/thttp_client.go:24:2: import "net/http": cannot find package
  20. src/thrift/thttp_client.go:25:2: import "net/url": cannot find package
  21. src/thrift/ttransport.go:24:2: import "os": cannot find package
  22. src/thrift/tmap.go:25:2: import "reflect": cannot find package
  23. package thrift
  24. imports runtime: import "runtime": cannot find package
  25. src/thrift/tfield.go:23:2: import "sort": cannot find package
  26. src/thrift/thttp_client.go:26:2: import "strconv": cannot find package
  27. src/thrift/tbinary_protocol.go:26:2: import "strings": cannot find package
  28. src/thrift/tnonblocking_socket.go:24:2: import "time": cannot find package
  29. make[4]: *** [check-local] Error 1
  30. make[4]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
  31. make[3]: *** [check-am] Error 2
  32. make[3]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
  33. make[2]: *** [all-recursive] Error 1
  34. make[2]: Leaving directory `/home/user/projects/delkon/thrift/lib'
  35. make[1]: *** [all-recursive] Error 1
  36. make[1]: Leaving directory `/home/user/projects/delkon/thrift'
  37. make: *** [all] Error 2

Thank you for any input
p.s
Arch linux (X86, 64)

upd
The problem was when thrift cloned from GIT, use https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz version instead

答案1

得分: 2

我尝试按照手动安装步骤的所有内容,没有任何问题。

  1. (12:49) jnml@fsc-r550:~$ go version
  2. go version go1.0.3
  3. (12:49) jnml@fsc-r550:~$ go env
  4. GOARCH="amd64"
  5. GOBIN="/home/jnml/bin"
  6. GOCHAR="6"
  7. GOEXE=""
  8. GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
  9. GOHOSTARCH="amd64"
  10. GOHOSTOS="linux"
  11. GOOS="linux"
  12. GOPATH="/home/jnml"
  13. GOROOT="/home/jnml/go"
  14. GOTOOLDIR="/home/jnml/go/pkg/tool/linux_amd64"
  15. CGO_ENABLED="1"
  16. (12:49) jnml@fsc-r550:~$

注意:我已经将thrift4go存储库克隆到$GOPATH/src/github.com/pomack/thrift4go。这在README.md中没有提到。

英文:

I tried to follow exactly all of the Manual Installation steps with no problems whatsoever.

  1. (12:49) jnml@fsc-r550:~$ go version
  2. go version go1.0.3
  3. (12:49) jnml@fsc-r550:~$ go env
  4. GOARCH="amd64"
  5. GOBIN="/home/jnml/bin"
  6. GOCHAR="6"
  7. GOEXE=""
  8. GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
  9. GOHOSTARCH="amd64"
  10. GOHOSTOS="linux"
  11. GOOS="linux"
  12. GOPATH="/home/jnml"
  13. GOROOT="/home/jnml/go"
  14. GOTOOLDIR="/home/jnml/go/pkg/tool/linux_amd64"
  15. CGO_ENABLED="1"
  16. (12:49) jnml@fsc-r550:~$

Note: I have cloned the thrift4go repository into $GOPATH/src/github.com/pomack/thrift4go. This is not mentioned in the README.md.

huangapple
  • 本文由 发表于 2013年1月9日 19:28:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/14234224.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定