# Compile Mattermost from source

**URL:** https://forum.mattermost.com/t/compile-mattermost-from-source/807
**Category:** Troubleshooting
**Created:** [January 25, 2016, 9:37am UTC](https://forum.mattermost.com/t/compile-mattermost-from-source/807 "2016-01-25T09:37:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![auzty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/auzty/32/1598_2.png) [@auzty](https://forum.mattermost.com/u/auzty)
#### Post date: [January 25, 2016, 9:37am UTC](https://forum.mattermost.com/t/compile-mattermost-from-source/807/1 "2016-01-25T09:37:26Z")

</div>

how to the right way to build mattermost from source ???

1. i try from godep , and the compiling is done (godep go build -a)  
i get an error if i execute it

```auto
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x534245]

goroutine 1 [running]:
github.com/mattermost/platform/api.NewServer()
        /root/go/gopath/src/github.com/mattermost/platform/api/server.go:28 +0x55
main.main()
        /root/mattermost/mattermost.go:66 +0x5ec

goroutine 9 [runnable]:
github.com/alecthomas/log4go.(*ConsoleLogWriter).run(0xc20801f660, 0x7f0824853000, 0xc208040008)
        /root/go/gopath/src/github.com/alecthomas/log4go/termlog.go:32
created by github.com/alecthomas/log4go.NewConsoleLogWriter
        /root/go/gopath/src/github.com/alecthomas/log4go/termlog.go:26 +0xcc

goroutine 6 [runnable]:
code.google.com/p/log4go.ConsoleLogWriter.run(0xc2080480c0, 0x7f0824853000, 0xc208040008)
        /root/go/gopath/src/code.google.com/p/log4go/termlog.go:27 +0x7a
created by code.google.com/p/log4go.NewConsoleLogWriter
        /root/go/gopath/src/code.google.com/p/log4go/termlog.go:19 +0x6b

goroutine 7 [syscall]:
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
        /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

goroutine 10 [runnable]:
github.com/alecthomas/log4go.func·002()
        /root/go/gopath/src/github.com/alecthomas/log4go/filelog.go:78
created by github.com/alecthomas/log4go.NewFileLogWriter
        /root/go/gopath/src/github.com/alecthomas/log4go/filelog.go:119 +0x3e5

```

1. using makefile  
just do make

```auto
Starting docker containers
Building mattermost server
rm -Rf dist
/root/go/gopath/bin/godep go clean -i ./...
GOFMT

gofmt sucess
cp ./model/version.go ./model/version.go.bak
sed -i'.make_mac_work' 's|_BUILD_NUMBER_|dev|g' ./model/version.go
sed -i'.make_mac_work' 's|_BUILD_DATE_|Mon Jan 25 09:35:43 UTC 2016|g' ./model/version.go
sed -i'.make_mac_work' 's|_BUILD_HASH_|f51d45f6cba0e5a1249146afe4a1c78cf32b7598|g' ./model/version.go
rm ./model/version.go.make_mac_work
/root/go/gopath/bin/godep go build ./...
# _/tmp/mattermost
./mattermost.go:305: too many arguments in call to api.CreateUser
# _/tmp/mattermost/api
api/channel.go:737: not enough arguments in call to channel.ExtraEtag
api/user.go:398: undefined: model.SESSION_TIME_WEB_IN_SECS
api/user.go:401: undefined: model.SESSION_TIME_MOBILE_IN_DAYS
api/user.go:402: undefined: model.SESSION_TIME_MOBILE_IN_SECS
api/user.go:404: undefined: model.SESSION_TIME_WEB_IN_DAYS
# _/tmp/mattermost/manualtesting
manualtesting/manual_testing.go:117: undefined: model.SESSION_TIME_WEB_IN_SECS
# _/tmp/mattermost/web
web/web.go:551: not enough arguments in call to api.SendEmailChangeVerifyEmailAndForget
web/web.go:553: not enough arguments in call to api.SendVerifyEmailAndForget
web/web.go:685: too many arguments in call to api.GetAuthorizationCode
web/web.go:697: assignment count mismatch: 3 = 4
web/web.go:702: undefined: model.USER_AUTH_SERVICE_GITLAB
web/web.go:703: undefined: model.GitLabUserFromJson
web/web.go:704: undefined: model.UserFromGitLabUser
web/web.go:747: too many arguments in call to api.CreateUser
web/web.go:747: multiple-value api.CreateUser() in single-value context
web/web.go:785: too many arguments in call to api.GetAuthorizationCode
web/web.go:785: too many errors
godep: go exit status 2
make: *** [build-server] Error 1

```

make test output :

```auto
 Starting docker containers
/root/go/gopath/bin/godep go test -run=. -test.v -test.timeout=180s ./api || exit 1
# _/tmp/mattermost/api
api/channel.go:737: not enough arguments in call to channel.ExtraEtag
api/user.go:398: undefined: model.SESSION_TIME_WEB_IN_SECS
api/user.go:401: undefined: model.SESSION_TIME_MOBILE_IN_DAYS
api/user.go:402: undefined: model.SESSION_TIME_MOBILE_IN_SECS
api/user.go:404: undefined: model.SESSION_TIME_WEB_IN_DAYS
api/admin_test.go:172: Client.GetAnalytics undefined (type *model.Client has no field or method GetAnalytics)
api/admin_test.go:183: Client.GetAnalytics undefined (type *model.Client has no field or method GetAnalytics)
api/admin_test.go:242: Client.GetAnalytics undefined (type *model.Client has no field or method GetAnalytics)
api/admin_test.go:253: Client.GetAnalytics undefined (type *model.Client has no field or method GetAnalytics)
api/admin_test.go:287: Client.GetAnalytics undefined (type *model.Client has no field or method GetAnalytics)
api/admin_test.go:287: too many errors
FAIL _/tmp/mattermost/api [build failed]
godep: go exit status 2
make: *** [go-test] Error 1

```

any ideas??? thank youu

---

<div class="post-metadata">

### Author: ![coreyhulen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/coreyhulen/32/25_2.png) [@coreyhulen](https://forum.mattermost.com/u/coreyhulen)
#### Post date: [January 25, 2016, 12:36pm UTC](https://forum.mattermost.com/t/compile-mattermost-from-source/807/2 "2016-01-25T12:36:36Z")

</div>

Looks like you have a bad clone. I would re-pull the repo. Did you follow [http://docs.mattermost.com/developer/developer-setup.html](http://docs.mattermost.com/developer/developer-setup.html)?

All you need todo is `make test` or `make run`

---

<div class="post-metadata">

### Author: ![auzty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/auzty/32/1598_2.png) [@auzty](https://forum.mattermost.com/u/auzty)
#### Post date: [January 26, 2016, 2:42am UTC](https://forum.mattermost.com/t/compile-mattermost-from-source/807/3 "2016-01-26T02:42:44Z")

</div>

ahh… i got wrong tutorial maybe… thanks for that link 😁
