我有以下包Makefile:
include ${GOROOT}/src/Make.inc
TARG=gorilla.googlecode.com/hg/gorilla/mux
GOFILES=\
doc.go\
mux.go\
DEPS=\
gorilla.googlecode.com/hg/gorilla/context
include ${GOROOT}/src/Make.pkg我今天更改了TARG和DEPS,以指向上面所示的谷歌代码库,并遵循this advice。
问题是:我可以安装包,它将安装依赖项,但我不能再使用gotest或gomake;我得到以下错误(使用Go r59):
moraes@yukon:~/dev/repos/gorilla/gorilla/mux$ gotest
rm -f _test/gorilla.googlecode.com/hg/gorilla/mux.a
make -C gorilla.googlecode.com/hg/gorilla/context install
make: *** gorilla.googlecode.com/hg/gorilla/context: No such file or directory. Stop.
make: *** [gorilla.googlecode.com/hg/gorilla/context.make] Error 2
gotest: "/home/moraes/dev/repos/go/go.r59/bin/gomake testpackage GOTESTFILES=mux_test.go" failed: exit status 2我尝试先安装依赖项(goinstall gorilla.googlecode.com/hg/gorilla/context),它可以正确地安装在$GOROOT/pkg中,但在gotest/gomake中也出现了同样的错误。
我想我遗漏了一些非常基本的东西。我应该如何继续在上面的Makefile中使用gomake/gotest?这是应该工作的,还是我应该使用一个不同的开发?
发布于 2011-10-31 19:19:54
goinstall根本不使用Makefile。相反,它将直接从.go文件中解析依赖项。
要指定依赖项,请使用对依赖项的“规范化”引用进行annotate your import lines。例如:
import (
gorilla_context "gorilla.googlecode.com/hg/gorilla/context"
...不过gomake不会自动解析依赖项,所以你必须手动安装它们。
类似地,要使用goinstall安装cgo源代码,可以在注释指令中指定CFLAGS和LDFLAGS。例如:
/*
#cgo CFLAGS: -I/usr/local/include
#cgo LDFLAGS: -L/usr/local/lib -lzmq
#include <zmq.h>
*/
import "C"发布于 2011-09-18 03:41:01
我认为Makefile正在尝试在当前目录中查找文件gorilla.googlecode.com/hg/gorilla/context。另外,为什么要在make文件中指定它,而不是从Source中导入它?
https://stackoverflow.com/questions/7321946
复制相似问题