Skip to content

How to compile on Raspberry Pi

per1234 edited this page Mar 5, 2024 · 12 revisions

Compile without systray support

  1. In order to compile the Agent yourself, first you have to install golang.
    Please use version 1.14.15
  2. Then clone the repository with the following command:
    git clone https://github.com/arduino/arduino-create-agent.git
    
  3. Use the following command to change directory to the newly created one:
    cd arduino-create-agent/
    
  4. Use the following command to build:
    go build -v -tags cli
    
    The -tags cli flag is used to generate a binary that can be run headless without GUI or trayicon support.
  5. Start the binary with the following command:
    ./arduino-create-agent
    

If all went well you should see something like this in the terminal window:

Click to expand
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

Compile with systray support

Is possible to build also with tray icon support. In order to do so, you have to install first the libraries required for the tray icon with the following command:

sudo apt install libappindicator3-dev gir1.2-appindicator3-0.1 libgtk-3-dev

Then use the following command to build instead of step 4 in the previous section:

sudo go build -v

Bonus

To start the binary without having to allocate a full terminal window to it you can run it with the following command:

nohup ./arduino-create-agent &
  • & starts the program in the background
  • nohup catches 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