doukezi4606
doukezi4606
2013-01-09 11:28

如何构建thrift4go?

已采纳

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:

#!/bin/bash
export THRIFT=$(pwd)/thrift
export THRIFT4GO=$(pwd)/thrift4go
export GOROOT=/usr

bash $THRIFT4GO/scripts/merge_and_build.sh -b

cd $THRIFT
#./cleanup.sh
./bootstrap.sh
./configure --with-go --without-python --without-csharp

make
if "$?" == "1"; then
    ln -s $THRIFT/lib/go/src/thrift $GOPATH/src/thrift
    go install thrift
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.

Making all in go
make[3]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
make  check-local
make[4]: Entering directory `/home/user/projects/delkon/thrift/lib/go'
go build -v -x thrift
WORK=/tmp/go-build548238117
src/thrift/tiostream_transport.go:23:2: import "bufio": cannot find package
src/thrift/tframed_transport.go:23:2: import "bytes": cannot find package
src/thrift/tmap.go:24:2: import "container/list": cannot find package
src/thrift/tjson_protocol.go:23:2: import "encoding/base64": cannot find package
src/thrift/tbinary_protocol.go:23:2: import "encoding/binary": cannot find package
src/thrift/tsimple_json_protocol.go:26:2: import "encoding/json": cannot find package
src/thrift/tapplication_exception.go:23:2: import "errors": cannot find package
src/thrift/tcompact_protocol.go:24:2: import "fmt": cannot find package
src/thrift/tbinary_protocol.go:24:2: import "io": cannot find package
src/thrift/ttransport.go:23:2: import "log": cannot find package
src/thrift/tbinary_protocol.go:25:2: import "math": cannot find package
src/thrift/tnonblocking_server_socket.go:23:2: import "net": cannot find package
src/thrift/thttp_client.go:24:2: import "net/http": cannot find package
src/thrift/thttp_client.go:25:2: import "net/url": cannot find package
src/thrift/ttransport.go:24:2: import "os": cannot find package
src/thrift/tmap.go:25:2: import "reflect": cannot find package
package thrift
imports runtime: import "runtime": cannot find package
src/thrift/tfield.go:23:2: import "sort": cannot find package
src/thrift/thttp_client.go:26:2: import "strconv": cannot find package
src/thrift/tbinary_protocol.go:26:2: import "strings": cannot find package
src/thrift/tnonblocking_socket.go:24:2: import "time": cannot find package
make[4]: *** [check-local] Error 1
make[4]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/user/projects/delkon/thrift/lib/go'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/user/projects/delkon/thrift/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/projects/delkon/thrift'
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条回答

  • duanboxue3422 duanboxue3422 8年前

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

    (12:49) jnml@fsc-r550:~$ go version
    go version go1.0.3
    (12:49) jnml@fsc-r550:~$ go env
    GOARCH="amd64"
    GOBIN="/home/jnml/bin"
    GOCHAR="6"
    GOEXE=""
    GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/jnml"
    GOROOT="/home/jnml/go"
    GOTOOLDIR="/home/jnml/go/pkg/tool/linux_amd64"
    CGO_ENABLED="1"
    (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.

    点赞 评论 复制链接分享

为你推荐