[go-nuts] Re: Is there a good way to make binary files compiled on a high-version machine run on a low-version machine?

2023-08-12 Thread fliter
Thanks. It is indeed a good solution to use containers

在2023年8月11日星期五 UTC+8 15:38:02 写道:

> 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/49793400-ae98-493b-b4be-f1d1711a8b71n%40googlegroups.com.


[go-nuts] Re: Is there a good way to make binary files compiled on a high-version machine run on a low-version machine?

2023-08-11 Thread Peter Galbavy
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.