Failed in error “plugin was built with a different version of package” while debugging

Viewed 1145

I built my .so file:

go build -buildmode=plugin -o test.so

and run debug with Goland, then I get the error:

Error running agent: could not initialize input inputs.plugin_input: plugin.Open("./plugins_lib/test1"): plugin was built with a different version of package runtime/internal/sys

But I can build my main program in my terminal and it will work well.

1 Answers

The plugin should be compiled with the same flags as the main application.

If the application is compiled using the IDE already, then add the -gcflags="all=-N -l" to the above go build ... command.

go build -buildmode=plugin -gcflags="all=-N -l" -o test.so

In addition,if the IDE is Goland, the build command of the main application can be found at the debug console of Goland.

Related