[solved] How to compile pydio cells from github

let’s say i made a small tweak in one of the plugins: how can I then compile everything to get my modified executable?

(would it be possible to modify some files after the installation without the need to recompile everything?)

Hello @gekigek_99,

To compile I advise you to use the makefile, take a look at the different directives but.
You will need packr (https://github.com/gobuffalo/packr) to get the interface(webui) built in the binary.
This command should do the trick.

  • make CELLS_VERSION=x.x.x

ok thanks a lot!
but how do i use the packr package you specified?
do i need to install it? move it somewhere?
thanks

It only needs to be on your PATH, (for instance I have my GOBIN in my PATH therefore when I install packr with go get -u github.com/gobuffalo/packr/packr it will be in my PATH)

ok thanks a lot :wink:
i’ll try as soon as i can

so, i’m trying but am surely doing something wrong because i put all cells-master folder in:
~/pydio/cells-master
and with this command:
go get -u github.com/gobuffalo/packr/packr
i have now an executable here:
~/go/bin/packr

now if i go in this folder ~/pydio/cells-master and run:
make CELLS_VERSION=1.0.0
i get:
fatal: not a git repository (or any of the parent directories): .git
rm -f cells cells-*
/bin/packr clean
make: /bin/packr: Command not found
Makefile:57: recipe for target ‘clean’ failed
make: *** [clean] Error 127

sorry but i’m quite new and i cant find any solution on internet since is such a strange problem to explain in few words

[edit]
ok i copied packr from the directory ~/go/bin/packr to /bin/packr

( [1] is it correct to do so or there is an other more professional way?)

and now it works (for the initial .go files) but after a while it says this:

main.go:99:2: cannot find package “github. com/pydio/cells/broker/activity/actions” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/activity/actions (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/activity/actions (from $GOPATH)
main.go:35:2: cannot find package “github. com/pydio/cells/broker/activity/grpc” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/activity/grpc (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/activity/grpc (from $GOPATH)
main.go:36:2: cannot find package “github. com/pydio/cells/broker/activity/rest” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/activity/rest (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/activity/rest (from $GOPATH)
main.go:37:2: cannot find package “github. com/pydio/cells/broker/chat/grpc” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/chat/grpc (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/chat/grpc (from $GOPATH)
main.go:38:2: cannot find package “github. com/pydio/cells/broker/log/grpc” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/log/grpc (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/log/grpc (from $GOPATH)
main.go:39:2: cannot find package “github. com/pydio/cells/broker/log/rest” in any of:
/usr/lib/go-1.10/src/github.com/pydio/cells/broker/log/rest (from $GOROOT)
/root/go/src/github.com/pydio/cells/broker/log/rest (from $GOPATH)

… ecc

Makefile:22: recipe for target ‘main’ failed
make: *** [main] Error 1

[2] what should i do to solve this problem?

( [3] and then, other question, where will i be able to find my executable at the end of the compilation?)

Are you working inside your $GOPATH, (we are using a vendor but it was the default way),
/go/src/github.com/pydio/cells you should be working in a path similar to this one.

(Also are you sure that your gopath, is set?)
You can run go env GOPATH and see if you have a result, and also go env GOROOT to be sure.

for instance:

➜  cells git:(master) go env GOPATH
/Users/zayn/go
➜  cells git:(master) go env GOROOT
/usr/local/go

ok thanks!

command:

go env GOPATH

gives me: /root/go (i am working as root)

go env GOROOT

gives me: /usr/lib/go-1.10

is that correct?

putting everything in this dir
/go/src/github.com/pydio/cells
now seems to work better but now it gives me an error at the end.

here is the log:

root@myserver:~/go/src/github.com/pydio/cells# make CELLS_VERSION=1.0.0
fatal: not a git repository (or any of the parent directories): .git
rm -f cells cells-*
/bin/packr clean
# Removing existing packr files and running packr
find . -name *-packr.go | xargs rm -f
# manually filtering out ory/x/dbal package
grep -ri -l “packr.NewBox” / | while read -r line; do if ! [ “$line” = “vendor/gne”; /bin/packr --compress --input=. ; cd -; fi; done;
Run packr for broker/activity/lang/i18n.go
/root/go/src/github.com/pydio/cells
Run packr for broker/mailer/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for common/service/frontend/http-union_test.go
/root/go/src/github.com/pydio/cells
Run packr for common/sql/index/sql.go
/root/go/src/github.com/pydio/cells
Run packr for common/sql/resources/sql.go
/root/go/src/github.com/pydio/cells
Run packr for data/key/sql.go
/root/go/src/github.com/pydio/cells
Run packr for data/meta/sql.go
/root/go/src/github.com/pydio/cells
Run packr for data/templates/embedded.go
/root/go/src/github.com/pydio/cells
Run packr for data/versions/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for discovery/config/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for discovery/install/assets/assets.go
/root/go/src/github.com/pydio/cells
Run packr for discovery/update/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for frontend/front-srv/rest/plugins.go
/root/go/src/github.com/pydio/cells
Run packr for idm/acl/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/auth/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for idm/auth/web/resources/init.go
/root/go/src/github.com/pydio/cells
Run packr for idm/key/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/meta/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/meta/namespace/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/policy/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/policy/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for idm/role/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/user/sql.go
/root/go/src/github.com/pydio/cells
Run packr for idm/workspace/sql.go
/root/go/src/github.com/pydio/cells
Run packr for scheduler/lang/bundle.go
/root/go/src/github.com/pydio/cells
Run packr for vendor/github.com/rubenv/sql-migrate/README.md
/root/go/src/github.com/pydio/cells
Run packr for vendor/github.com/rubenv/sql-migrate/doc.go
/root/go/src/github.com/pydio/cells
Run packr for vendor/github.com/gobuffalo/packr/README.md
/root/go/src/github.com/pydio/cells
go build -a
-ldflags "-X github.com/pydio/cells/common.version=1.0.0\ -X github.com/pydio/cells/common.BuildStamp=2020-03-10T12:29:05\ -X github.com/pydio/cells/common.BuildRevision=\ -X github.com/pydio/cells/vendor/github.com/pydio/minio-srv/cmd.Version=\ -X github.com/pydio/cells/vendor/github.com/pydio/minio-srv/cmd.ReleaseTag="\ -o cells\

# github.com/pydio/cells/vendor/github.com/ory/viper
vendor/github.com/ory/viper/viper.go:1613:2: undefined: io.StringWriter
Makefile:22: recipe for target ‘main’ failed
make: *** [main] Error 2

i think i am almost there but i really don’t know what to do to solve this last error

`

did i solve the packr executable correctly? (is it an acceptable solution to just move it from ~/go/bin/packr to /bin/packr)

`

Yes as long as packr is in your $PATH it should be good.

weird errors it seems to point that there is an issue with this specific package.

Could you tell me on which branch you are currently working on?

thanks for the fast response!!

i am actually not working on anything, i am just trying to build a clean executable from https://github.com/pydio/cells without modifying anything just to see how to do it and to not add other variables in the “game”.

could that be something related to that “fatal: not a git repository (or any of the parent directories): .git”? because it really doesn’t sound right to me…

Oh yeah I just realised that you had go 1.10, could you tell me if that really is the case? (go version will give you the answer), if that is the case then make sure to update go to at least 1.12 or latest.

1 Like

go version gives me:
go version go1.10.4 linux/amd64

which is strange because i installed it just few days ago (probably did something wrong)

anyway… installed go version 1.14 and now it works (seems like a charm for now --> doesn’t throw any errors so i would assume it works just as the precompiled version right?)
i got the executable and now it’s time to modify some code!

thanks a lot for all your generous help!!!