Skip to content

How to compile on Raspberry Pi

Umberto Baldi edited this page Jan 25, 2021 · 12 revisions

How to compile on Raspberry Pi

  1. In order to compile the Agent yourself, first you have to install golang with sudo apt update && sudo apt install golang
  2. Then clone the repository with git clone https://github.com/arduino/arduino-create-agent.git
  3. Change directory to the newly created directory: cd arduino-create-agent/
  4. And finally to build use sudo go build -v -i -tags cli. The -i flag installs the packages that are dependencies of the target, while -tags cli flag is used to generate a binary that can be run headless without GUI or trayicon support.
  5. start the binary with ./arduino-create-agent. If all went well you should see something like this in the terminal window:
output
INFO[0000] Version:x.x.x-dev
INFO[0000] Hostname: raspberrypi
INFO[0000] Garbage collection is on using Standard mode, meaning we just let Golang determine when to garbage collect.
INFO[0000] You specified a serial port regular expression filter: usb|acm|com
INFO[0000] Your serial ports:
INFO[0000] 	There are no serial ports to list.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:	export GIN_MODE=release
 - using code:	gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /                         --> main.homeHandler (2 handlers)
[GIN-debug] GET    /certificate.crt          --> main.certHandler (2 handlers)
[GIN-debug] DELETE /certificate.crt          --> main.deleteCertHandler (2 handlers)
[GIN-debug] POST   /upload                   --> main.uploadHandler (2 handlers)
[GIN-debug] GET    /socket.io/               --> main.(*WsServer).ServeHTTP-fm (2 handlers)
[GIN-debug] POST   /socket.io/               --> main.(*WsServer).ServeHTTP-fm (2 handlers)
[GIN-debug] WS     /socket.io/               --> main.(*WsServer).ServeHTTP-fm (2 handlers)
[GIN-debug] WSS    /socket.io/               --> main.(*WsServer).ServeHTTP-fm (2 handlers)
[GIN-debug] GET    /info                     --> main.infoHandler (2 handlers)
[GIN-debug] POST   /killbrowser              --> main.killBrowserHandler (2 handlers)
[GIN-debug] POST   /pause                    --> main.pauseHandler (2 handlers)
[GIN-debug] POST   /update                   --> main.updateHandler (2 handlers)
[GIN-debug] GET    /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] POST   /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] PUT    /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] PATCH  /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] HEAD   /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] OPTIONS /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] DELETE /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] CONNECT /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] TRACE  /v2/*path                 --> github.com/gin-gonic/gin.WrapH.func1 (2 handlers)
[GIN-debug] Listening and serving HTTP on 127.0.0.1:8991

Bonus

To start the binary without having to allocate a full terminal window to it you can run with the & operator and nohup: nohup ./arduino-create-agent &:

  • & starts the program in the background
  • nohup cashes the hangup signal and when the parent process is killed (the shell) it changes the parent to 1 (the init process)
Clone this wiki locally