5

All, I hope this question belongs here.

I am following a Blockgeeks tutorial, trying to set up my environment for Ethereum blockchain development. I have basically gotten to the final step, installing swarm, but I am receiving an error that seems to be related to the structure of a folder on github. How should I fix this?

Handy info:

-OS: Windows 10, running this project within cygwin with proper gcc dependencies installed

-Go version: 1.11.4

I have tried to find a solution for days now, but nothing I've found has worked. Any help is appreciated.

Basically, everyone says these steps work for them: https://swarm-guide.readthedocs.io/en/latest/installation.html#generic-linux

Maybe it's something with cygwin?

When I attempt this command: $ go install -v ./cmd/swarm

I expect it to install properly, but i get this error:

unexpected directory layout:
        import path: github.com/naoina/toml
        root: C:\cygwin64\home\di203179\go\src
        dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
        expand root: C:\cygwin64\home\di203179\go\src
        expand dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
        separator: \

Any help is appreciated.

Update:

I think I found the code that throws this error here: https://golang.org/src/cmd/go/internal/load/pkg.go

And here is the snippet:

// dirAndRoot returns the source directory and workspace root
// for the package p, guaranteeing that root is a path prefix of dir.
func dirAndRoot(p *Package) (dir, root string) {
    dir = filepath.Clean(p.Dir)
    root = filepath.Join(p.Root, "src")
    if !str.HasFilePathPrefix(dir, root) || p.ImportPath != "command-line-arguments" && filepath.Join(root, p.ImportPath) != dir {
        // Look for symlinks before reporting error.
        dir = expandPath(dir)
        root = expandPath(root)
    }

    if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || p.ImportPath != "command-line-arguments" && !p.Internal.Local && filepath.Join(root, p.ImportPath) != dir {
        base.Fatalf("unexpected directory layout:\n"+
            "   import path: %s\n"+
            "   root: %s\n"+
            "   dir: %s\n"+
            "   expand root: %s\n"+
            "   expand dir: %s\n"+
            "   separator: %s",
            p.ImportPath,
            filepath.Join(p.Root, "src"),
            filepath.Clean(p.Dir),
            root,
            dir,
            string(filepath.Separator))
    }

    return dir, root
}

It seems there are several path-related issues that could make a Go project throw this error. But I feel my path is correct, so I'm still at a loss...

Upddate 2:

I have confirmed that the first if-statement from that snippet is running, and the first three conditions of the second if statement resolve to false (meaning they are not the cause of the error), so that means the last condition that is composed of multiple AND statements must be returning true since the error is throwing. Still can't tell why, though. Thanks for any help.

dillon.harless
  • 427
  • 4
  • 16
  • But it works if you build `geth`? as in `go install -v ./cmd/geth` – lash Dec 28 '18 at 18:56
  • It didn't... But it wasn't the same error. At this point, unfortunately I can't remember what that error was, but I ended up installing geth via npm. – dillon.harless Dec 28 '18 at 21:08
  • If you got a _similar_ error with `geth` aswell I believe the problem was with your golang setup, not the go-ethereum software. – lash Dec 30 '18 at 14:57
  • @lash You're probably right. I'm thinking it's related to the setup at my place of work. Considering all the firewalls and tangled routing, complicated permissions policies, and shared drives, I think I either installed something improperly or just don't have access to necessary urls... Thanks for the help. When I figure it out I will post an answer. – dillon.harless Jan 10 '19 at 20:40
  • So I was never able to determine the source of my troubles. My company gave me access to the url necessary for the installer of geth, and using that solved my issue. – dillon.harless Jan 24 '19 at 16:22

0 Answers0