Problems with Golang plugins in Go 1.19 (versus Go 1.15)

185 views
Skip to first unread message

William Ivory

unread,
Mar 26, 2024, 12:36:31 PM3/26/24
to golan...@googlegroups.com

Hi,

Wondering if anyone can help me with a golang plugin problem. Apologies for not being able to provide a simple reproduction - the problem is all bound up in the Debian (dh-golang) build system.

Anyway, our product is based on Debian. We have code using plugins that has been working fine with golang 1.11 (Debian10) and golang 1.15 (Debian11). For the plugin user, we use dh-golang in the debian/rules file which adds '-trimpath', and when building the plugin, we explicitly build with '-trimpath -buildmode=plugin'. Now that we have upgraded to Debian12 (golang 1.19), every attempt to load a plugin results in the following error:

'plugin.Open("<plugin-name>"): plugin was built with a different version of package plugin'

If I remove '-trimpath' from one half of the build (plugin user, or plugin), I start getting a (seemingly) random assortment of packages being listed, but with trimpath specified, it is 'package plugin' every single time. This makes me think the problem is different to the usual one where we have managed to get mismatches due to the lack of trimpath in one half of the build previously.

I've tried going back from dh-golang version 1.59 (Debian12) to 1.51 (Debian11) but no joy. I'm currently trying to step back through Go 1.18 - Go 1.15 to see when it starts working again, but that's proving tricky.

Has anyone seen anything similar / got any suggestions?

Thanks,

William

wji...@gmail.com

unread,
Mar 27, 2024, 1:15:49 PM3/27/24
to golang-nuts
I've narrowed it down somewhat. With Go 1.17.13 it works. With Go1.18 RC it fails. So something in the first release of Go 1.18 seems to have changed how trimpath / plugin version matching works, and has broken previously working functionality for us (I'm compiling exactly the same code - the *only* difference is the compiler version).
Reply all
Reply to author
Forward
0 new messages