New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run fcct 04.0 standalone binary in alpine container #87
Comments
in the latest alpine 3.12, 6th release of fcct, still not working. ct-*-x86_64-unknown-linux-gnu was working well |
So I just stumbled across this as well – for some reason the releases are all dynamically linked instead of statically linked: $ ldd butane
./butane: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./butane)
linux-vdso.so.1 (0x00007ffd19c9d000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f575bd9b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f575bba9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f575bdd1000)
$ file butane
butane: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=c987d3e8e9b404120c192a4b8cac59d452e252dd, stripped This is something of a problem because the required glibc version is not available on for example Ubuntu 20.04 (the latest LTS version) out of the box: butane: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./butane) However, when building the project locally (current latest version) on Ubuntu 20.04.1 using the provided build script, the output is a statically linked binary: $ uname -a
Linux ubuntuvm 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ go version
go version go1.16.2 linux/amd64
$ git rev-parse HEAD
97c6866efaafc46729640a24cd2336245890b63d
$ ./build
$ ldd bin/amd64/butane
not a dynamic executable
$ file bin/amd64/butane
bin/amd64/butane: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=Ye0UWPX393ytSs0asjB3/hgozWMFdOTbSH1gaTEl6/5XqYckPOUWu_TSHtzDm6/ZWXu_yBiboj_afAS-L8R, not stripped While having a dynamically linked binary is not a dealbreaker on its own, it makes using butane considerably more painful than it needs to – specifically on only slightly older but otherwise well supported distributions such as Ubuntu 20.04. Could a maintainer have another look at the build chain and check whether producing statically linked prebuilt binaries (again) is feasible? Edit: just saw #221 exists as well but was closed without a fix, saying that running butane via podman is preferred. While that might be true, I don't believe that should be the official fix when building a statically linked butane release looks to be possible/feasible. |
@bgilbert I really don't want to be a bother about this but having statically linked butane executables would be a huge boon and in case this isn't possible I would very much like to understand why. Could you or another maintainer chime in here and maybe provide some additional information? |
@Okeanos This hasn't been a priority for us, but if you'd like to dig into the build script and send a PR, or even just a writeup of what you find, that'd be very helpful. |
As I stated in the previous comment: the included |
Whoops, yeah, sorry, I know what's going on. For policy reasons, our release binaries are built in Koji from the Fedora specfile, and of course the Fedora build macros produce dynamically-linked binaries. Probably the right approach is to extend the |
@bgilbert thank you for the pointers; I had another look at this: The butane.spec relies on go-rpm-macros and specifically uses the The option you proposed appears to be the easiest right now, i.e. add additional As I don't have a Fedora account, I am not sure I can contribute these changes right now. |
Thanks for digging into that.
If you're interested, you should be able to just sign up for a Fedora account. I don't think you need any special permissions to submit a PR. |
I can do that – before I do that, I'd like to clarify the scope of the changes to the butane.spec file, though. As far as I understand it the %build
#...
echo "Building Linux Butane with static linking..."
CGO_ENABLED=0 GOARCH=arm64 GOOS=linux %gocrossbuild -o butane-aarch64-unknown-linux-gnu-static internal/main.go
CGO_ENABLED=0 GOARCH=ppc64le GOOS=linux %gocrossbuild -o butane-ppc64le-unknown-linux-gnu-static internal/main.go
CGO_ENABLED=0 GOARCH=s390x GOOS=linux %gocrossbuild -o butane-s390x-unknown-linux-gnu-static internal/main.go
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux %gocrossbuild -o butane-x86_64-unknown-linux-gnu-static internal/main.go
#...
%install
#...
install -p -m 0644 ./butane-aarch64-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane
install -p -m 0644 ./butane-ppc64le-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane
install -p -m 0644 ./butane-s390x-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane
install -p -m 0644 ./butane-x86_64-apple-darwin %{buildroot}%{_datadir}/butane
install -p -m 0644 ./butane-x86_64-pc-windows-gnu.exe %{buildroot}%{_datadir}/butane
install -p -m 0644 ./butane-x86_64-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane
#....
%files
#...
%{_datadir}/butane/butane-aarch64-unknown-linux-gnu-static
%{_datadir}/butane/butane-ppc64le-unknown-linux-gnu-static
%{_datadir}/butane/butane-s390x-unknown-linux-gnu-static
%{_datadir}/butane/butane-x86_64-unknown-linux-gnu-static
#... Open questions from my side are mainly:
Technically, I think adding A test run with these changes on Fedora 34 using a modified spec file and calling |
@bgilbert I created a pull request similar to what I outlined above shortly after that message. Is there any chance you or someone else from the project has some time to review it and give me some feedback? Is there process that I have to follow and didn't see? On an unrelated note, I am somewhat irritated by the fedoraproject platform not allowing people to use SSH unless they are … members of a particular group? That really wasn't fun to work around. |
Yup, it's on my radar and I'll take a look when I can. Thanks for the PR. |
Any update on this issue and related PR on Pagure? I ran into today running on the latest version of Proxmox VE, which runs glibc 2.31. |
What workaround is possible for proxmox? |
The workaround is: build it locally using the supplied build script. |
Trying to install butane in an alpine linux image (we require butane specifically within that image). Thus using the release butane container is no option. Opting for local build within container. |
Fixed in https://src.fedoraproject.org/rpms/butane/pull-request/5 for the next release. Thanks @Okeanos! |
Hi,
I cannot run the latest release 0.4.0 binary inside an alpine container:
After installing
file
(usingapk --update-cache --upgrade add file
) it turns out the 0.4.0 release is a dynamically linked binary, not a static binary.Yet there aren't any linker issues:
Shouldn't the 0.4.0 release also be a statically linked binary? The 0.2.0 release is, and I can run that one just fine.
The text was updated successfully, but these errors were encountered: