Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

plugins

go

goland

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.

like image 317
hxysayhi Avatar asked Dec 04 '20 03:12

hxysayhi


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.

like image 163
hxysayhi Avatar answered Nov 02 '22 01:11

hxysayhi