wunderio / radi-cli

CLI interface for the Radi-API
1 stars 2 forks source link

Can`t build the binaries #24

Open artursv opened 7 years ago

artursv commented 7 years ago

Make fails with the following:

❯ make all
"./build/make.sh" getdeps
---> Make-bundle: getdeps (in .)
  --> updating vendor dependencies [recursively]
Submodule path 'vendor/github.com/Sirupsen/logrus': checked out '3f603f494d61c73457fb234161d8982b9f0f0b71'
Submodule path 'vendor/github.com/wunderkraut/radi-api': checked out 'b6d485c69dab1e6378bb24f342ca0c70fb45ffb6'
Submodule path 'vendor/github.com/wunderkraut/radi-api/vendor/github.com/Sirupsen/logrus': checked out '61e43dc76f7ee59a82bdf3d71033dc12bea4c77d'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-rancher': checked out '48e4c46cbef80bf9812c6e577d65635f0140e9e1'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-rancher/vendor/github.com/Sirupsen/logrus': checked out '61e43dc76f7ee59a82bdf3d71033dc12bea4c77d'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-rancher/vendor/github.com/rancher/go-rancher': checked out '2c43ff300f3eafcbd7d0b89b10427fc630efdc1e'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-rancher/vendor/gopkg.in/yaml.v2': checked out '4c78c975fe7c825c6d1466c42be594d1d6f3aba6'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud': checked out 'f521f98e3beed2c299fd0c3e4bbdfd02c33d6660'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud/vendor/github.com/Jalle19/upcloud-go-sdk': checked out '6151bdd7a30cdb0c72f665f81c2ef7a438d9c29e'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud/vendor/github.com/Sirupsen/logrus': checked out '61e43dc76f7ee59a82bdf3d71033dc12bea4c77d'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud/vendor/github.com/blang/semver': checked out '4a1e882c79dcf4ec00d2e29fac74b9c8938d5052'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud/vendor/github.com/hashicorp/go-cleanhttp': checked out 'ad28ea4487f05916463e2423a55166280e8254b5'
Submodule path 'vendor/github.com/wunderkraut/radi-handler-upcloud/vendor/gopkg.in/yaml.v2': checked out '4c78c975fe7c825c6d1466c42be594d1d6f3aba6'
Submodule path 'vendor/github.com/wunderkraut/radi-handlers': checked out 'ea902396fba7888b3fc48298d8b0fccb8ff5c57b'
Submodule path 'vendor/github.com/wunderkraut/radi-handlers/vendor/github.com/Sirupsen/logrus': checked out '61e43dc76f7ee59a82bdf3d71033dc12bea4c77d'
Submodule path 'vendor/github.com/wunderkraut/radi-handlers/vendor/github.com/docker/libcompose': checked out '5cba1677dc9906646fc639c21a098ed960033d2d'
Submodule path 'vendor/github.com/wunderkraut/radi-handlers/vendor/github.com/james-nesbitt/init-go': checked out '94fcc5d0a408896a653847f7078deac13422c76b'
Submodule path 'vendor/github.com/wunderkraut/radi-handlers/vendor/gopkg.in/yaml.v2': checked out '4c78c975fe7c825c6d1466c42be594d1d6f3aba6'
Submodule path 'vendor/gopkg.in/urfave/cli.v2': checked out 'e485446237011b8abac93919242e6f059ad56c87'
  --- Finished dependency update

"./build/make.sh" binary
---> Make-bundle: binary (in .)
  --> Building ./bin/radi
main/command.go:6:2: cannot find package "github.com/Sirupsen/logrus" in any of:
    /usr/lib/golang/src/github.com/Sirupsen/logrus (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/Sirupsen/logrus (from $GOPATH)
main/operation.go:10:2: cannot find package "github.com/wunderkraut/radi-api/operation" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-api/operation (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-api/operation (from $GOPATH)
main/command.go:9:2: cannot find package "github.com/wunderkraut/radi-api/operation/command" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-api/operation/command (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-api/operation/command (from $GOPATH)
main/operation.go:11:2: cannot find package "github.com/wunderkraut/radi-api/operation/security" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-api/operation/security (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-api/operation/security (from $GOPATH)
main/main.go:12:2: cannot find package "github.com/wunderkraut/radi-cli/local" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-cli/local (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-cli/local (from $GOPATH)
main/main.go:13:2: cannot find package "github.com/wunderkraut/radi-cli/version" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-cli/version (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-cli/version (from $GOPATH)
main/settings.go:6:2: cannot find package "github.com/wunderkraut/radi-handlers/bytesource" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-handlers/bytesource (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-handlers/bytesource (from $GOPATH)
main/discover.go:8:2: cannot find package "github.com/wunderkraut/radi-handlers/local" in any of:
    /usr/lib/golang/src/github.com/wunderkraut/radi-handlers/local (from $GOROOT)
    /home/arturs/Workspace/go/src/github.com/wunderkraut/radi-handlers/local (from $GOPATH)
main/command.go:7:2: cannot find package "gopkg.in/urfave/cli.v2" in any of:
    /usr/lib/golang/src/gopkg.in/urfave/cli.v2 (from $GOROOT)
    /home/arturs/Workspace/go/src/gopkg.in/urfave/cli.v2 (from $GOPATH)
Makefile:20: recipe for target 'binary' failed
make: *** [binary] Error 1
james-nesbitt commented 7 years ago

if you are using the manual method, then building outside of a gopath is not supported. I will have to change the instructions to reflect this.

https://github.com/golang/go/issues/14566

Can you paste errors that you got when using the build.sh ?

james-nesbitt commented 7 years ago

actually I think that I have a solution that would allow installation simply with:

$/> go get github.com/wunderkraut/radi-cli/radi

I am still testing.

artursv commented 7 years ago

Here is the output of ./build.sh

❯ ./build.sh
***** Building RADI cli client.

This will build the radi-cli as a 'radi' binary for 'linux-amd64'. 

(Override this by setting $GOOS and $GOARCH environment variables)

 **** Building in containerized golang environment

make: stat: Makefile: Permission denied
make: Nothing to be done for 'build'.

Exited container

 **** Containerized build complete 

an executable binary has (hopefully) now been built 
in ./bin/radi

 **** Installation

This installer can now install the built binary for you,
if you don't want to do it manually.

The planned installation path is : /usr/local/bin

Would you like to me install a binary to that location? (y/n)

y
--> detected that sudo will be required, as you don't have write privelege to the target path
[sudo] password for arturs: 
"./build/make.sh" install
---> Make-bundle: install (in .)
  --> Installing last compiled binary (./bin/radi) to: /usr/local/bin
cp: cannot stat './bin/radi': No such file or directory
Makefile:26: recipe for target 'install' failed
make: *** [install] Error 1
james-nesbitt commented 7 years ago

25 includes an attempt to make sure that the Makefile is executable,

and it also clarifies the instructions for building manually (that go needs the source code to be inside of $GOPATH to build locally.)

There is also the option of using go get to retrieve source code, which we are testing now.

james-nesbitt commented 7 years ago

@artursv can you test again with the latest effort?

artursv commented 7 years ago

@james-nesbitt make all still fails with the output I posted above.

I was however able to get the binaries with go get.

james-nesbitt commented 7 years ago

I will consider this issue mitigated, but keep it open to figure out what is going wrong with the Make

james-nesbitt commented 7 years ago

further information:

when building in a container in Fedora, it seems that the local volume bind does not work. The source code folder is empty where the bind occurs. This is some kind of docker failure that needs diagnosing.

james-nesbitt commented 7 years ago

After some one-on-one with @artursv we have discovered that his Fedora machine has some unknown configuration that prevents docker from mounting /home/* paths into containers.

Possible causes:

  1. LVM volume used for /home prevents mapping
  2. SELinux attributes for /home volume prevent mapping
  3. Simple folder permissions on /home (docker is running as a user without that access?)
james-nesbitt commented 7 years ago

This is not a bug in the toolset, but rather a docker issue on Fedora.

james-nesbitt commented 7 years ago

This looks hopeful: http://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker

Testing with @artursv shows success.

james-nesbitt commented 7 years ago

38 contains a potential workaround for this issue, but it might break builds for non-Fedora users.