我建立了我的 .so 文件:go build -buildmode=plugin -o test.so并使用 Goland 運行調試,然后我收到錯誤: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但是我可以在終端中構建我的主程序,它會運行良好。
1 回答

瀟湘沐
TA貢獻1816條經(jīng)驗 獲得超6個贊
該插件應使用與主應用程序相同的標志進行編譯。
如果已經(jīng)使用 IDE 編譯了應用程序,則將其添加-gcflags="all=-N -l"
到上述go build ...
命令中。
go build -buildmode=plugin -gcflags="all=-N -l" -o test.so
另外,如果IDE是Goland,可以在Goland的調試控制臺找到主應用的構建命令。
- 1 回答
- 0 關注
- 331 瀏覽
添加回答
舉報
0/150
提交
取消