英文:
How to build thrift4go?
问题
我是你的中文翻译。以下是翻译好的部分:
我是GO的新手。
我决定使用Go的Thrift实现。
在阅读了手动安装指南后,我从git上下载了最新的Thrift 0.9.0并开始构建过程:
我的构建脚本如下:
#!/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
但是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:
#!/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
得分: 2
我尝试按照手动安装步骤的所有内容,没有任何问题。
(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:~$
注意:我已经将thrift4go存储库克隆到$GOPATH/src/github.com/pomack/thrift4go
。这在README.md中没有提到。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论