I use a docker container with a centos7 image and build my shared libs there; https://github.com/ITRS-Group/cordial/blob/4f119f7893c67b817baaad23ed75b1ba134bf9c2/Dockerfile#L35
(pls don't judge my Dockerfile skills, it's a learning experience ;) ) On Thursday, 10 August 2023 at 11:12:23 UTC+1 fliter wrote: > I have a project that uses CGO. After compiling on an ubuntu 20.04 > compilation machine, it is distributed to other machines for execution, but > many of these machines have very low ubuntu versions, which may be ubuntu > 16.04 or ubuntu 18.04. > > In this way, when executing the binary file, an error similar to version > `GLIBC_2.29' not found will be reported. > > I try to use -a -ldflags '-extldflags "-static"' when go build. But it > seems that because of the use of cgo, it cannot be compiled successfully. > > Is there any good way, such as adding appropriate tags when go build, to > solve this problem? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0c9acea6-e6d0-4cd1-8045-c73604d63a48n%40googlegroups.com.