编译失败:没有这个文件或目录(但它确实存在!)

huangapple go评论88阅读模式
英文:

Compilation fails: No such file or directory (but it DOES exist!)

问题

我正在尝试编译Ethereum Go客户端。按照说明,我只需运行make geth,但是失败了:

$ make geth
build/env.sh go run build/ci.go install ./cmd/geth
make: build/env.sh: No such file or directory
make: *** [geth] Error 1

从这个错误中,我理解到它抱怨build/env.shbuild/ci.go不存在。所以我检查了build文件夹,但它们似乎都在那里:

$ ls -l build
total 648
drwxr-xr-x  3 kramer65  staff     102 Feb 13 13:45 _vendor
-rw-r--r--  1 kramer65  staff    2892 Feb 13 13:45 ci-notes.md
-rw-r--r--  1 kramer65  staff   30516 Feb 13 13:45 ci.go             <===
-rw-r--r--  1 kramer65  staff     123 Feb 13 13:45 deb.changelog
... 这里还有其他一些文件
-rw-r--r--  1 kramer65  staff     379 Feb 13 13:45 deb.rules
-rwxr-xr-x  1 kramer65  staff     721 Feb 13 13:45 env.sh            <===
-rw-r--r--  1 kramer65  staff    1722 Feb 13 13:45 mvn.pom
... 这里还有更多文件

我检查了go是否已安装以及其版本:

$ which go
/usr/local/bin/go
$ go version
go version go1.7.5 darwin/amd64

所以go似乎没问题。

有人有任何想法如何调试/解决这个问题吗?欢迎所有的提示!

英文:

I'm trying to compile the Ethereum Go client. Following the instructions I simply run make geth, but that fails:

$ make geth
build/env.sh go run build/ci.go install ./cmd/geth
make: build/env.sh: No such file or directory
make: *** [geth] Error 1

As far as I understand from this error it complaints that either build/env.sh or build/ci.go doesn't exist. So I checked out the build folder, but they both seem to be there:

$ ls -l build
total 648
drwxr-xr-x  3 kramer65  staff     102 Feb 13 13:45 _vendor
-rw-r--r--  1 kramer65  staff    2892 Feb 13 13:45 ci-notes.md
-rw-r--r--  1 kramer65  staff   30516 Feb 13 13:45 ci.go             <===
-rw-r--r--  1 kramer65  staff     123 Feb 13 13:45 deb.changelog
... some other files here
-rw-r--r--  1 kramer65  staff     379 Feb 13 13:45 deb.rules
-rwxr-xr-x  1 kramer65  staff     721 Feb 13 13:45 env.sh            <===
-rw-r--r--  1 kramer65  staff    1722 Feb 13 13:45 mvn.pom
... and some more files here

I checked whether go is installed and which version it is:

$ which go
/usr/local/bin/go
$ go version
go version go1.7.5 darwin/amd64

So go seems to be fine.

Does anybody have any idea how I can debug/solve this? All tips are welcome!

答案1

得分: 4

好的,以下是翻译好的内容:

好的,没关系,我找到了。问题是行尾符是DOS风格的。

所以为了递归地将行尾符转换为Unix风格,我运行了以下命令:

find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix

然后再次尝试构建。问题解决了。

英文:

OK, never mind, I found it. The problem was that line endings where in DOS style.

So to recursively convert line endings to Unix I ran:

find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix

and then tried building again. That fixed it.

答案2

得分: 0

我按照以下指示解决了这个问题。我不知道原因,但是我完全摆脱了brew来运行它(在Mac上)。

1. 安装go(我使用的是包)
2. 克隆git仓库:https://github.com/ethereum/go-ethereum
3. 进入go-ethereum目录并切换到标签v1.8.2:cd go-ethereum && git checkout tags/v1.8.2
4. 运行`find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix`(如果你没有dos2unix,你可以使用brew安装,它不会破坏任何东西)
5. 运行make geth
6. 创建符号链接:ln -s /path/to/origin/geth /path/to/target/geth

然后运行which geth,你可以找到你的geth。运行geth version,你可以看到你的版本。

英文:

I solve the problem using by following instructions below. I don't know the reason, but I completely get rid of brew to make it run. (mac)

1 install go(I used package)
2 git clone https://github.com/ethereum/go-ethereum
3 cd go-ethereum && git checkout tags/v1.8.2
4 run `find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix`(if you don't have dos2unix, you could brew one, it does not break anything.)
5 make geth
6 ln -s /path/to/origin/geth /path/to/target/geth

Then run which geth you could find your geth. Run geth version you can see your version.

huangapple
  • 本文由 发表于 2017年2月13日 20:56:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/42204612.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定