{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/11473","repository_url":"https://api.github.com/repos/grafana/grafana","labels_url":"https://api.github.com/repos/grafana/grafana/issues/11473/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/11473/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/11473/events","html_url":"https://github.com/grafana/grafana/pull/11473","id":311003556,"number":11473,"title":"crossbuild example","user":{"login":"fg2it","id":13949984,"avatar_url":"https://avatars1.githubusercontent.com/u/13949984?v=4","gravatar_id":"","url":"https://api.github.com/users/fg2it","html_url":"https://github.com/fg2it","followers_url":"https://api.github.com/users/fg2it/followers","following_url":"https://api.github.com/users/fg2it/following{/other_user}","gists_url":"https://api.github.com/users/fg2it/gists{/gist_id}","starred_url":"https://api.github.com/users/fg2it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fg2it/subscriptions","organizations_url":"https://api.github.com/users/fg2it/orgs","repos_url":"https://api.github.com/users/fg2it/repos","events_url":"https://api.github.com/users/fg2it/events{/privacy}","received_events_url":"https://api.github.com/users/fg2it/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-04-03T21:22:45Z","updated_at":"2018-04-11T04:32:46Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/grafana/grafana/pulls/11473","html_url":"https://github.com/grafana/grafana/pull/11473","diff_url":"https://github.com/grafana/grafana/pull/11473.diff","patch_url":"https://github.com/grafana/grafana/pull/11473.patch"},"body":"**This PR is not intended to be merge**\r\nIt is to illustrate crossbuild possibilities related to discussion in #9633.\r\n- `Dockerbuild.cross` is used as a base image to build grafana\r\n- `build.go` has some small tweaks to ease the syntax (and, but that doesn't really matter here, I wasn't careful enough and the base version used for `build.go` is not the current master, sorry for this inconvenience)\r\n- `Makefile.cross` has for sole purpose to illustrate how, once toolchains are installed, it can be to crossbuild `grafana-server` and `grafana-cli`.\r\nInside the container:\r\n```bash\r\n$ mkdir -p $GOPATH/src/github.com/grafana\r\n$ cd $GOPATH/src/github.com/grafana\r\n$ git clone --branch crossbuild --depth 1 https://github.com/fg2it/grafana.git\r\nCloning into 'grafana'...\r\nremote: Counting objects: 4051, done.\r\nremote: Compressing objects: 100% (3525/3525), done.\r\nReceiving objects: 100% (4051/4051), 10.32 MiB | 194.00 KiB/s, done.\r\nremote: Total 4051 (delta 428), reused 2462 (delta 270), pack-reused 0\r\nResolving deltas: 100% (428/428), done.\r\nChecking connectivity... done.\r\n$ cd grafana\r\n$ make -f Makefile.cross all\r\ngo get -v github.com/golang/dep\r\ngithub.com/golang/dep (download)\r\ngo run build.go -goarch armv7 -cc arm-linux-gnueabihf-gcc build\r\nVersion: 5.1.0-pre1, Linux Version: 5.1.0, Package Iteration: 1522787225pre1\r\nrm -r ./bin/linux-armv7/grafana-server\r\nrm -r ./bin/linux-armv7/grafana-server.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/armv7\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-armv7/grafana-server ./pkg/cmd/grafana-server\r\nrm -r ./bin/linux-armv7/grafana-cli\r\nrm -r ./bin/linux-armv7/grafana-cli.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/armv7\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-armv7/grafana-cli ./pkg/cmd/grafana-cli\r\ngo run build.go -goarch arm64 -cc aarch64-linux-gnu-gcc build\r\nVersion: 5.1.0-pre1, Linux Version: 5.1.0, Package Iteration: 1522787259pre1\r\nrm -r ./bin/linux-arm64/grafana-server\r\nrm -r ./bin/linux-arm64/grafana-server.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/arm64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-arm64/grafana-server ./pkg/cmd/grafana-server\r\nrm -r ./bin/linux-arm64/grafana-cli\r\nrm -r ./bin/linux-arm64/grafana-cli.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/arm64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-arm64/grafana-cli ./pkg/cmd/grafana-cli\r\ngo run build.go -goos darwin -cc /tmp/osxcross/target/bin/o64-clang build\r\nVersion: 5.1.0-pre1, Linux Version: 5.1.0, Package Iteration: 1522787290pre1\r\nrm -r ./bin/darwin-amd64/grafana-server\r\nrm -r ./bin/darwin-amd64/grafana-server.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting darwin/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/darwin-amd64/grafana-server ./pkg/cmd/grafana-server\r\nrm -r ./bin/darwin-amd64/grafana-cli\r\nrm -r ./bin/darwin-amd64/grafana-cli.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting darwin/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/darwin-amd64/grafana-cli ./pkg/cmd/grafana-cli\r\ngo run build.go -goos windows -cc x86_64-w64-mingw32-gcc build\r\nVersion: 5.1.0-pre1, Linux Version: 5.1.0, Package Iteration: 1522787330pre1\r\nrm -r ./bin/windows-amd64/grafana-server.exe\r\nrm -r ./bin/windows-amd64/grafana-server.exe.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting windows/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/windows-amd64/grafana-server.exe ./pkg/cmd/grafana-server\r\nrm -r ./bin/windows-amd64/grafana-cli.exe\r\nrm -r ./bin/windows-amd64/grafana-cli.exe.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting windows/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/windows-amd64/grafana-cli.exe ./pkg/cmd/grafana-cli\r\ngo run build.go build\r\nVersion: 5.1.0-pre1, Linux Version: 5.1.0, Package Iteration: 1522787348pre1\r\nrm -r ./bin/linux-amd64/grafana-server\r\nrm -r ./bin/linux-amd64/grafana-server.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-amd64/grafana-server ./pkg/cmd/grafana-server\r\nrm -r ./bin/linux-amd64/grafana-cli\r\nrm -r ./bin/linux-amd64/grafana-cli.md5\r\ngo version\r\ngo version go1.10 linux/amd64\r\nTargeting linux/amd64\r\ngo build -ldflags -w -X main.version=5.1.0-pre1 -X main.commit=3efc5a1 -X main.buildstamp=1522786555 -o ./bin/linux-amd64/grafana-cli ./pkg/cmd/grafana-cli\r\n$ tree bin\r\nbin\r\n|-- darwin-amd64\r\n|   |-- grafana-cli\r\n|   |-- grafana-cli.md5\r\n|   |-- grafana-server\r\n|   `-- grafana-server.md5\r\n|-- linux-amd64\r\n|   |-- grafana-cli\r\n|   |-- grafana-cli.md5\r\n|   |-- grafana-server\r\n|   `-- grafana-server.md5\r\n|-- linux-arm64\r\n|   |-- grafana-cli\r\n|   |-- grafana-cli.md5\r\n|   |-- grafana-server\r\n|   `-- grafana-server.md5\r\n|-- linux-armv7\r\n|   |-- grafana-cli\r\n|   |-- grafana-cli.md5\r\n|   |-- grafana-server\r\n|   `-- grafana-server.md5\r\n`-- windows-amd64\r\n    |-- grafana-cli.exe\r\n    |-- grafana-cli.exe.md5\r\n    |-- grafana-server.exe\r\n    `-- grafana-server.exe.md5\r\n\r\n5 directories, 20 files\r\n$ file bin/*/*[^5]\r\nbin/darwin-amd64/grafana-cli:         Mach-O 64-bit x86_64 executable\r\nbin/darwin-amd64/grafana-server:      Mach-O 64-bit x86_64 executable\r\nbin/linux-amd64/grafana-cli:          ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=ffb43029877c9f0994e045bd0b82e2e89a80cbb8, not stripped\r\nbin/linux-amd64/grafana-server:       ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=228f006ab370146719b28259bc530f8711eed4da, not stripped\r\nbin/linux-arm64/grafana-cli:          ELF 64-bit LSB  executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0, BuildID[sha1]=921298ade40731df77505949819ebe053a3c188c, not stripped\r\nbin/linux-arm64/grafana-server:       ELF 64-bit LSB  executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0, BuildID[sha1]=a24659a44d19338270033a84a487bc51f8bed712, not stripped\r\nbin/linux-armv7/grafana-cli:          ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=6555b1807654ab02eb20ae12e06052739b8015a6, not stripped\r\nbin/linux-armv7/grafana-server:       ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=dc9db9519d90721b96ea4e34d01726dd6e46de66, not stripped\r\nbin/windows-amd64/grafana-cli.exe:    PE32+ executable (console) x86-64, for MS Windows\r\nbin/windows-amd64/grafana-server.exe: PE32+ executable (console) x86-64, for MS Windows\r\n```\r\n\r\nFor completeness, I didn't test all binaries, only amd64 (inside the builder container) and arm64 (inside arm64v8/debian:stretch-slim, with qemu). win64 was tested but on a slightly different build (a debian:stretch base image for the container and without build.go)"},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/380324033","html_url":"https://github.com/grafana/grafana/pull/11473#issuecomment-380324033","issue_url":"https://api.github.com/repos/grafana/grafana/issues/11473","id":380324033,"user":{"login":"torkelo","id":10999,"avatar_url":"https://avatars3.githubusercontent.com/u/10999?v=4","gravatar_id":"","url":"https://api.github.com/users/torkelo","html_url":"https://github.com/torkelo","followers_url":"https://api.github.com/users/torkelo/followers","following_url":"https://api.github.com/users/torkelo/following{/other_user}","gists_url":"https://api.github.com/users/torkelo/gists{/gist_id}","starred_url":"https://api.github.com/users/torkelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkelo/subscriptions","organizations_url":"https://api.github.com/users/torkelo/orgs","repos_url":"https://api.github.com/users/torkelo/repos","events_url":"https://api.github.com/users/torkelo/events{/privacy}","received_events_url":"https://api.github.com/users/torkelo/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T04:32:46Z","updated_at":"2018-04-11T04:32:46Z","author_association":"OWNER","body":"Thank you so much for your work on this!! "}}
{"actor":{"display_login":"torkelo"}}