Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: libraries are not resolved with cgo_import_dynamic #39257
On Go -tip (bcda684), building the following two files:
Results in a DT_NEEDED entry being created for
This is due to the fact that
Under both Linux and OpenBSD, we end up with what are effectively duplicate DT_NEEDED entries:
This results in warnings/failures, at least on OpenBSD, as it attempts to load the library twice, triggering initialisation that cannot be repeated.
The issue can be worked around by specifying the full library version in the
The fix is likely to either implement an equivalent of ld(1)'s library resolution or somehow extracting this information from ld(1) (which I suspect would be the better option).
@ianlancetaylor @cherrymui - the back story is that I'm working on issue #36435, which means using
If I use
I can workaround the issue by using
Ah, well. That is what symbol versioning is for.
I guess OpenBSD systems have lots of different .so files, one for each soname?
If we need to support this for internal linking, then I think we'll need to use a special string in the
Or, we could require external linking on OpenBSD, which would not be so bad.