techknowlogick / xgo

Go CGO cross compiler
MIT License
478 stars 79 forks source link

The compiled binary relies on GLIBC_2.28 to work correctly. #223

Open TENX-S opened 1 year ago

TENX-S commented 1 year ago

We are unable to run the binary compiled with xgo-1.21.1 on an older system (glibc 2.27). Is there any workaround to resolve this issue? Thank you! image

techknowlogick commented 1 year ago

Thanks for the report @TENX-S which OS and version are you attempting to run the binary on? Can you provide the full build command you are using including the ldflags?

TENX-S commented 1 year ago

which OS and version are you attempting to run the binary on?

root@bd2093:~# ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.2) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
root@bd2093:~# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
root@bd2093:~# uname -a
Linux bd2093 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Can you provide the full build command you are using including the ldflags?

xgo --targets=linux/arm-7 -ldflags='-s -w'  -go go-1.21.1 -x -v -dest=. -pkg="." -out=$1 .
xgo --targets=linux/arm64 -ldflags='-s -w'  -go go-1.21.1 -x -v -dest=. -pkg="." -out=$1 .
xgo --targets=linux/amd64 -ldflags='-s -w'  -go go-1.21.1 -x -v -dest=. -pkg="." -out=$1 .
TENX-S commented 1 year ago

Is there any workaround at this moment?