Compiling Grafana plugins on FreeBSD

Hello,

I am trying to compile a plugin on FreeBSD (the OpenSearch plugin) but the build process insists on producing binaries for Linux and Darwin.

I am sure I am missing something stupid. Any hints? I have go 1.19.5 and the required bits. And the compilation works, apparently, but it is actually cross compiling.

Thanks!

Well, success after some clueless frobulation.

Hope this can be useful for someone!

I installed Go, Mage and Yarn. Grafana 9 of course. All of them from the FreeBSD ports.

I downloaded the latest release of the plugin source from Github. Unpacked the directory and ran:

go mod tidy

Once all the Go dependencies were downlodaded I patched:

~/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.138.0/build/common.go in order to include a FreeBSD build configuration.

Just adding the lines:

// FreeBSDAMD64 builds the back-end plugin for OSX on ARM (M1).
func (Build) FreeBSDAMD64() error {
        return buildBackend(newBuildConfig("freebsd", "amd64"))
}

below the definition for Darwin, and adding FreeBSDAMD64 to the list of targets to build below:

        mg.Deps(b.Linux, b.Windows, b.Darwin, b.DarwinARM64, b.LinuxARM64, b.LinuxARM, b.FreeBSDAMD64)

Done that, mage compiled everything neatly.

After that, yarn install and yarn build.

I zipped the whole directory, copied it to a web server and the installation with
grafana-cli plugin using the --pluginUrl worked.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.