我正在尝试使用make
安装go包,但它会返回以下内容:
dan@dan-netbook:~/GoMySQL$ make
Makefile:1: :/home/dan/.go/go/src/Make.inc: No such file or directory
Makefile:17: :/home/dan/.go/go/src/Make.pkg: No such file or directory
make: *** No rule to make target `:/home/dan/.go/go/src/Make.pkg'. Stop.
但如果我运行ls
:
dan@dan-netbook:~/GoMySQL$ ls /home/dan/.go/go/src/
all.bash env.bash make.bash Make.common quietgcc.bash
all-qemu.bash lib9 Make.ccmd Make.inc run.bash
clean.bash libbio Make.clib Make.pkg sudo.bash
cmd libmach Make.cmd pkg version.bash
为什么会这样?
编辑: Makefile为:
include $(GOROOT)/src/Make.inc
TARG=mysql
GOFILES=mysql.go\
types.go\
const.go\
error.go\
password.go\
reader.go\
writer.go\
packet.go\
convert.go\
handler.go\
result.go\
statement.go
include $(GOROOT)/src/Make.pkg
答案 0 :(得分:6)
在此错误消息中:
Makefile:1: :/home/dan/.go/go/src/Make.inc: No such file or directory
^
我对指示的结肠感到有些惊讶。
我们需要在Makefile中看到GOROOT的设置,这并不容易。我对构建go包知之甚少,但是从命令行尝试:
echo $GOROOT
并报告打印的内容。
然后尝试更改Makefile。在它的最开始,添加:
foobar:
echo $(GOROOT)
其中回波线必须用制表符缩进,而不是空格,并告诉我们产生了什么。