我正在安装MongoDB,我需要mongoimport。我已经从源MongoDB from source安装了MongoDB本身。我仍然需要 mongoimport ,它是 mongo-tools mongo-tools github的一部分。上面写了一些说明,我已经克隆了仓库,并进入了仓库( / ssd / [MYNAME] / mongoinstall / mongo-tools )并运行了
. ./set_gopath.sh
回购的自述文件指出可以运行go env
,但该文件不存在。
尽管我不觉得命令做了什么
go build -o bin/mongoimport mongoimport/main/mongoimport.go
不变。
我也已经从源代码安装了GO。
mongoimport/main/mongoimport.go:13:2: cannot find package "github.com/mongodb/mongo-tools-common/log" in any of:
/ssd/[MYNAME]/mongoinstall/go/src/github.com/mongodb/mongo-tools-common/log (from $GOROOT)
/export/scratch1/home/gast141/go/src/github.com/mongodb/mongo-tools-common/log (from $GOPATH)
mongoimport/main/mongoimport.go:14:2: cannot find package "github.com/mongodb/mongo-tools-common/signals" in any of:
/ssd/[MYNAME]/mongoinstall/go/src/github.com/mongodb/mongo-tools-common/signals (from $GOROOT)
/export/scratch1/home/gast141/go/src/github.com/mongodb/mongo-tools-common/signals (from $GOPATH)
mongoimport/main/mongoimport.go:15:2: cannot find package "github.com/mongodb/mongo-tools-common/util" in any of:
/ssd/[MYNAME]/mongoinstall/go/src/github.com/mongodb/mongo-tools-common/util (from $GOROOT)
/export/scratch1/home/gast141/go/src/github.com/mongodb/mongo-tools-common/util (from $GOPATH)
mongoimport/main/mongoimport.go:16:2: cannot find package "github.com/mongodb/mongo-tools/mongoimport" in any of:
/ssd/[MYNAME]/mongoinstall/go/src/github.com/mongodb/mongo-tools/mongoimport (from $GOROOT)
/export/scratch1/home/gast141/go/src/github.com/mongodb/mongo-tools/mongoimport (from $GOPATH)
返回以下错误:
./build.sh
我尝试过
GOROOT not set and preferred GOROOT '/ssd/[MYNAME]/mongoinstall/go/bin/go' doesn't exist. Aborting.
但它惊呼:
go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/export/scratch1/home/gast141/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/export/scratch1/home/gast141/go"
GOPROXY=""
GORACE=""
GOROOT="/ssd/[MYNAME]/mongoinstall/go"
GOTMPDIR=""
GOTOOLDIR="/ssd/[MYNAME]/mongoinstall/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build916816613=/tmp/go-build -gno-record-gcc-switches"
的输出是:
Fedora release 28 (Twenty Eight)
我在//Kernel code
__kernel void my_add(__global float3* A,
__global float3* B,
__global float3* C,
__global float3* D,
float fsx,
float fsy,
float fsz,
float fXfactor,
float fYfactor,
float fZfactor){
#define FLT_MAX 3.402823466e+38F
size_t gid = get_global_id(0);
float3 fs = (float3)(fsx,fsy,fsz); //Works when hardcoded fs = (1,1,1);
float3 ffactor = (float3)(fXfactor,fYfactor,fZfactor); //Works hardcoded
if(A[gid].x!=FLT_MAX &&
A[gid].y!=FLT_MAX &&
A[gid].z!=FLT_MAX &&
B[gid].x!=FLT_MAX &&
B[gid].y!=FLT_MAX &&
B[gid].z!=FLT_MAX)
{
D[gid] = C[gid]+(fs*(A[gid]+ffactor*
(B[gid]-A[gid])));
}
};
//Passing args from host
my_add.setArg(0, bufferA);//cl::buffer float array
my_add.setArg(1, bufferB);//cl::buffer float array
my_add.setArg(2, bufferC);//cl::buffer float array
my_add.setArg(3, bufferD);//cl::buffer float array
my_add.setArg(4, fSx); // float variable declared in host
my_add.setArg(5, fSy); // float variable declared in host
my_add.setArg(6, fSz); // float variable declared in host
my_add.setArg(7, fXFactor); // float variable declared in host
my_add.setArg(8, fYFactor); // float variable declared in host
my_add.setArg(9, fZFactor); // float variable declared in host
//Input Buffer values
bufferA = 5.5,5.5......n
bufferB = 10.5,10.5,10.5....n
bufferC = 1,2,3,1,2,3,1,2,3....n
bufferD = null; size = n
fSx=fSy=fSz=fXFactor=fYFactor=fZFactor=1
如何使mongoimport正常工作?
答案 0 :(得分:1)
在尝试在Mac系统上编译mongotools时遇到了同样的错误。就我而言,问题是set_gopath.sh
(对于mongotools版本3.6.5)与我使用的shell(fish
)不兼容。该脚本会导出GOPATH
环境变量,但是一旦回到fish
环境中,它似乎就不会保留其适当的变量。
我尝试将bash
运行在持久的bash shell中,先运行set_gopath.sh
,然后再运行go build
命令,但是结果是相同的问题。
我发现一个成功的解决方法是修改set_gopath.sh
,最后添加go build
命令。运行set_gopath.sh
,然后设置环境并成功运行go命令。