# \[solved\] Building drone cli from source

**URL:** <https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753>\
**Category:** Drone Support\
**Created:** [January 24, 2017, 1:44pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753 "2017-01-24T13:44:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 24, 2017, 1:44pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/1 "2017-01-24T13:44:17Z")

</div>

Hi I am trying to build drone cli version 0.5.0 from source but I get the error below. Initially I’ve started looking here: [https://github.com/drone/drone-cli](https://github.com/drone/drone-cli), but this is deprecated and I used the README file: [https://github.com/drone/drone](https://github.com/drone/drone)

I am currently running drone version 0.5.0+dev and somehow a ‘carriage return’ is added at the end of the key value when add drone secret. I am after 0.5.0, any idea how I build that version?

Kind regards,

Ayache

**Failure details:**

Ayaches-MacBook-Pro:drone ayache$ make deps  
go get -u [golang.org/x/tools/cmd/cover](http://golang.org/x/tools/cmd/cover)  
go get -u [github.com/jteeuwen/go-bindata/](http://github.com/jteeuwen/go-bindata/)…  
go get -u [github.com/elazarl/go-bindata-assetfs/](http://github.com/elazarl/go-bindata-assetfs/)…  
go get -u [github.com/drone/mq/](http://github.com/drone/mq/)…

# [github.com/drone/mq/cmd/mq](http://github.com/drone/mq/cmd/mq)

fatal error: unexpected signal during runtime execution  
[signal 0xb code=0x1 addr=0x240a33ac73ed pc=0x32313]

goroutine 22 [running]:  
runtime.throw(0x2c4920, 0x2a)  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:547 +0x90 fp=0xc82002ae90 sp=0xc82002ae78  
runtime.sigpanic()  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/sigpanic\_unix.go:12 +0x5a fp=0xc82002aee0 sp=0xc82002ae90  
runtime.injectglist(0x240a33ac730d)  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/proc.go:2013 +0x93 fp=0xc82002af10 sp=0xc82002aee0  
runtime.gcWakeAllAssists()  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgcmark.go:498 +0x3b fp=0xc82002af20 sp=0xc82002af10  
runtime.gcMarkDone()  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1136 +0x271 fp=0xc82002af40 sp=0xc82002af20  
runtime.gcBgMarkWorker(0xc820022a00)  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1480 +0x488 fp=0xc82002afb8 sp=0xc82002af40  
runtime.goexit()  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm\_amd64.s:1998 +0x1 fp=0xc82002afc0 sp=0xc82002afb8  
created by runtime.gcBgMarkStartWorkers  
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1330 +0x92

goroutine 1 [GC assist wait]:  
cmd/link/internal/ld.writelines()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/dwarf.go:1651 +0xefc  
cmd/link/internal/ld.Dwarfemitdebugsections()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/dwarf.go:2108 +0xa59  
cmd/link/internal/amd64.asmb()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/amd64/asm.go:663 +0x8bb  
cmd/link/internal/ld.Ldmain()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/pobj.go:248 +0x1f5d  
cmd/link/internal/amd64.Main()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/amd64/obj.go:44 +0x19  
main.main()  
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/main.go:27 +0x36f  
make: \*\*\* [deps\_backend] Error 2

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 24, 2017, 4:06pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/2 "2017-01-24T16:06:07Z")

</div>

drone-cli was deprecated and moved

> [DEPRECATED] and moved into drone/drone [GitHub - harness/gitness: Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.](https://github.com/drone/drone)

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 24, 2017, 4:12pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/3 "2017-01-24T16:12:30Z")

</div>

In terms of building drone/drone on a macbook, unfortunately I don’t get any errors building drone on my macbook. Errors from the runtime package usually indicate an error with the Go runtime, so maybe you need to upgrade to a newer version of Go?

This is the environment I use to build / develop drone:

```nohighlight
$ uname -a
15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

```

```nohighlight
$ go version
go version go1.7.4 darwin/amd64

```

---

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 25, 2017, 10:03am UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/4 "2017-01-25T10:03:17Z")

</div>

Thanks Brad, upgrading GO to the latest version fixed the issue.

---

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 30, 2017, 1:36pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/5 "2017-01-30T13:36:59Z")

</div>

hi @bradrydzewski back again to the tool ( I got distracted for the last few days). I can run **make deps** successfully now, but it fails on **make gen** with the error below. Looks like I am not setting the GOPATH correctly and it’s not specified how to in the README file. Any idea?

Many thanks in advance

Ayache

**GO Version**  
Ayaches-MBP:drone ayache$ go version  
go version go1.7.4 darwin/amd64

**Error**

Ayaches-MBP:drone ayache$ make gen  
go generate [github.com/drone/drone/server/template](http://github.com/drone/drone/server/template)  
can’t load package: package [github.com/drone/drone/server/template:](http://github.com/drone/drone/server/template:) cannot find package “[github.com/drone/drone/server/template](http://github.com/drone/drone/server/template)” in any of:  
/usr/local/Cellar/go/1.7.4\_2/libexec/src/github.com/drone/drone/server/template (from $GOROOT)  
/Users/ayache/Projects/GO/HW/src/github.com/drone/drone/server/template (from $GOPATH)  
make: \*\*\* [gen\_template] Error 1

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 30, 2017, 1:51pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/6 "2017-01-30T13:51:08Z")

</div>

Please see the official Go documentation for setting up a valid Go environment, including the GOPATH [https://golang.org/doc/](https://golang.org/doc/)

---

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 30, 2017, 3:55pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/7 "2017-01-30T15:55:18Z")

</div>

thanks @bradrydzewski for your prompt response. I have managed to build drone from source successfully. But the version I get when build from source is **drone version 0.5.0+dev**. We had issues with this version when publishing secrets ( a new line is added at the end of base64 value). I was told **0.5.0** doesn’t have this issue. I thought building from source would give me **0.5.0**. Is there such version?

Many thanks in advance

Ayache

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 31, 2017, 5:21am UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/8 "2017-01-31T05:21:23Z")

</div>

the version number embedded in the binary follows the pattern `0.5.0+{metadata}` where the metadata is the build number. If you are building locally, the build number does not exist since that comes from the CI system, so `dev` is used instead. This is why all local builds will always be `0.5.0+dev`

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 31, 2017, 5:26am UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/9 "2017-01-31T05:26:28Z")

</div>

Please also note there is an official `drone/drone:0.5` image available. You can use the official distribution instead of building from source. There is really no reason to build from scratch unless you plan to contribute to the project.

---

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 31, 2017, 11:27am UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/10 "2017-01-31T11:27:13Z")

</div>

@bradrydzewski Thanks for suggesting the office image. I am after drone client 0.5 version.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 31, 2017, 11:42am UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/11 "2017-01-31T11:42:37Z")

</div>

the 0.5 drone client is also available for download. Instructions and links can be found:  
[http://readme.drone.io/usage/getting-started-cli/](http://readme.drone.io/usage/getting-started-cli/)

---

<div class="post-metadata">

**Author:** ![akhettar](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@akhettar](https://drone.discourse.group/u/akhettar)\
**Post date:** [January 31, 2017, 1:35pm UTC](https://drone.discourse.group/t/solved-building-drone-cli-from-source/10753/12 "2017-01-31T13:35:28Z")

</div>

Thanks @bradrydzewski the latest released CLI still referencing +dev in its version: **0.5.0+dev**. That something needs to be looked at. I have actually found an issue with add/list secret commands when providing drone server with following URL pattern. https://[hostname]/.\*. Somehow it breaks if the URL ends with **/** or a path. To me the CLI should be after the drone server hostname not the actual URL. I’ve started learning GO last weekend, almost done with the introduction and I should be able to provide a fix and create PR for it. Watch this space 🙂
