You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not. Purego dynamically links to dlopen and other libc functions which it uses to get access to C functions. There is no way to access those symbols unless you want to rewrite the dynamic linker in Go. However, such a feat would only be beneficial on Linux since macOS and Windows require you to use the system linker. This rewrite would be difficult and error prone which is why I did not go that route.
As for why you are getting linking errors when using an external linker with CGO_ENABLED=0. This is because the way purego links the dynamic symbols is with go:cgo_import_dynamic which only affects the internal linker. To make it work for the external linker you'd have to use cgo_import_static and an undocumented flag to build it. Using undocumented features is not user friendly. Therefore it is recommended that you enable Cgo when using an external linker and purego.
I am finding that its not possible to build static binaries with the purego linked in and CGO disabled.
Trying to use an external linker causes relocation and symbol lookup errors.
Is it possible to eliminate the linkages to libc, libpthread, libdl, etc... either through a musl CC or other techniques?
The text was updated successfully, but these errors were encountered: