Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM Build instructions #6

Closed
jobenvil opened this issue Mar 23, 2020 · 7 comments
Closed

ARM Build instructions #6

jobenvil opened this issue Mar 23, 2020 · 7 comments

Comments

@jobenvil
Copy link

Mar 23 00:05:34 locky grafana-server[1269]: t=2020-03-23T00:05:34+0100 lvl=eror msg="Failed to start plugin" logger=plugins.backend pluginId=grafana-strava-datasource error="fork/exec /var/lib/grafana/plugins/grafana-strava-datasource/dist/strava-plugin_linux_arm: no such file or directory"

why is looking inside of dist/ for a architecture for that there is no build?

Plugin doesn't have compiled binaries for arm arch. If you want to run it with Raspberry Pi, you should build it for this arch first.

but how is the question?

I just tried that from here:


root@locky:/media/locky/grafana/plugins/grafana-strava-datasource# yarn install --pure-lockfile
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@icons/material/-/material-0.2.4.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/media/locky/grafana/plugins/grafana-strava-datasource/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
root@locky:/media/locky/grafana/plugins/grafana-strava-datasource# yarn install --pure-lockfile
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The engine "node" is incompatible with this module. Expected version "^8.16.0 || ^10.6.0 || >=11.0.0". Got "8.10.0"
[3/4] Linking dependencies...
warning "@grafana/runtime > @grafana/ui > @grafana/slate-react > slate-react-placeholder@0.2.9" has unmet peer dependency "slate-react@>=0.22.0".
[4/4] Building fresh packages...
Done in 400.01s.
root@locky:/media/locky/grafana/plugins/grafana-strava-datasource# yarn build
yarn run v1.22.4
$ webpack --config webpack/webpack.prod.conf.js
Hash: 0679b57eef11404f4828
Version: webpack 4.41.5
Time: 29353ms
Built at: 03/23/2020 12:51:09 AM
                                         Asset       Size  Chunks             Chunk Names
                                  CHANGELOG.md  484 bytes          [emitted]
                                     README.md   1.38 KiB          [emitted]
       dashboards/strava_athlete_dashboad.json   14.6 KiB          [emitted]
dashboards/strava_athlete_dashboad_modern.json   14.9 KiB          [emitted]
             dashboards/strava_datasource.json   8.78 KiB          [emitted]
         img/btn_strava_connectwith_orange.svg   11.3 KiB          [emitted]
                           img/strava_logo.svg  291 bytes          [emitted]
                                    index.html  182 bytes          [emitted]
                                     module.js   25.4 KiB       0  [emitted]  main
                                   plugin.json   1.24 KiB          [emitted]
Entrypoint main = module.js
[0] external "react" 42 bytes {0} [built]
[1] external "@grafana/ui" 42 bytes {0} [built]
[2] external "@grafana/data" 42 bytes {0} [built]
[3] external "emotion" 42 bytes {0} [built]
[4] external "@grafana/runtime" 42 bytes {0} [built]
[5] external "moment" 42 bytes {0} [built]
[6] ./module.tsx + 7 modules 53.4 KiB {0} [built]
    | ./module.tsx 670 bytes [built]
    | ./datasource.ts 16 KiB [built]
    | ./types.ts 1.15 KiB [built]
    | ./stravaApi.ts 12.4 KiB [built]
    | ./polyline.ts 1.18 KiB [built]
    |     + 3 hidden modules
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
       3 modules
Done in 34.40s.

but no binary created inside of dist/ . In fact, the other binaries inside of /dist were deleted.

Any suggestion how to compile the "strava-plugin_linux_arm" binary?

@BobMiles
Copy link

Hi,
I would be interested in this, too. Running Grafana on a raspian stretch rpi 3+b...

Any news on this issue?

Thank you so much,

Bob

@BobMiles
Copy link

BobMiles commented Apr 9, 2020

Hi,

i got it figured out:
On the raspberry:

  1. Open the Makefile and exchange every amd64 with arm
  2. yarn install --pure-lockfile
  3. yarn build --pure-lockfile
  4. make build
    Observe arm binary in dist folder

Then in my case chown everything to grafana, copy to plugins dir and restart grafana server. Authenticate strava and Save & Test.

Hope it'll help!

@devdavidkarlsson
Copy link

Something like below?

devdavidkarlsson@b981b3b

@jobenvil
Copy link
Author

@devdavidkarlsson definitely! much appreciated.

@jobenvil
Copy link
Author

I got following errors:

env GOOS=linux GOARCH=arm go build -mod=vendor -o ./dist/strava-plugin_linux_arm ./pkg
pkg/datasource.go:15:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/github.com/bitly/go-simplejson
pkg/datasource.go:16:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/github.com/grafana/grafana-plugin-model/go/datasource
pkg/dscache.go:12:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/github.com/hashicorp/go-hclog
pkg/models.go:8:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/github.com/hashicorp/go-plugin
pkg/datasource.go:17:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/github.com/patrickmn/go-cache
pkg/datasource.go:18:2: cannot find package "." in:
        /media/locky/grafana/plugins/grafana-strava-datasource/vendor/golang.org/x/net/context/ctxhttp
make: *** [Makefile:20: build-backend] Error 1

looks like a issue with the vendor module, which said me nothing.

just runned this inside /pkg without vendor flag:
env GOOS=linux GO111MODULE=on GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./strava-plugin_linux_arm

and went well. I google and the solution was to execute:

go mod vendor
I runned it again with the vendor flag:

env GOOS=linux GO111MODULE=on GOARCH=arm GOARM=7 go build -ldflags="-s -w" -mod=vendor -o ./dist/strava-plugin_linux_arm ./pkg

All went well again and the binary was built inside the /dist directory

Thanks and credits to @BobMiles @devdavidkarlsson -- happy straving!

@devdavidkarlsson
Copy link

I think you missed the GOARM=7 in the failing one.

For ARMv8 it is GOARCH=arm64, but Rpi3 should probably be ARMv7, like you did there. I did not have the possibility to try RPi3 🙈.

It is recommended to specify both GOARCH and GOARM:

Architecture Status GOARM value GOARCH value
ARMv4 and below not supported n/a n/a
ARMv5 supported GOARM=5 GOARCH=arm
ARMv6 supported GOARM=6 GOARCH=arm
ARMv7 supported GOARM=7 GOARCH=arm
ARMv8 supported n/a GOARCH=arm64

from: https://github.com/golang/go/wiki/GoArm

@alinjie
Copy link

alinjie commented Apr 21, 2020

Hi,

i got it figured out:
On the raspberry:

  1. Open the Makefile and exchange every amd64 with arm
  2. yarn install --pure-lockfile
  3. yarn build --pure-lockfile
  4. make build
    Observe arm binary in dist folder

Then in my case chown everything to grafana, copy to plugins dir and restart grafana server. Authenticate strava and Save & Test.

Hope it'll help!

Worked! Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants