Skip to content
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

Linux native binary no longer works on ubuntu 18.04 and ubuntu 20.04 (and likely any linux with glibc < 2.34) #812

Closed
psiroky opened this issue Mar 13, 2023 · 3 comments · Fixed by #814
Milestone

Comments

@psiroky
Copy link
Contributor

psiroky commented Mar 13, 2023

As part of #801 I upgraded the ubuntu build image from ubuntu:18.04 to ubuntu:22.04, mainly because GitHub is removing the support for that old ubuntu image. With that I also inadvertently bumped the minimum requirement for the Glibc the native binary needs, which now seems to be 2.34.

Then I noticed the patch for Graal in the build script:

- name: 'Patch Graal libs for only requiring glibc 2.12'
  shell: bash
  run: |
          if [[ $OS == linux ]] && [[ $GRAALVM_HOME ]] && [[ -d "$GRAALVM_HOME/lib/static/linux-amd64/glibc" ]]; then
            mkdir -p client/target/graalvm-libs-for-glibc-2.12
            echo "memcpy memcpy@GLIBC_2.2.5" >client/target/glibc.redef
            echo "posix_spawn posix_spawn@GLIBC_2.2.5" >>client/target/glibc.redef
            find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a' | while IFS= read -r input; do
              output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
              objcopy --redefine-syms=client/target/glibc.redef -- "$input" "$output" 2>/dev/null
            done
            find /usr/lib -name libz.a | xargs -r -I {} objcopy --redefine-syms=client/target/glibc.redef {} client/target/graalvm-libs-for-glibc-2.12/libz.a
          fi

The patch suggests that mvnd should support glibc 2.12, which is no longer the case.

This the output I get when running on ubuntu 18.04 and ubuntu 20.04, with latest binaries from master:

/tmp/mvnd-test ❯ podman run -it -v .:/mvnd ubuntu:18.04 bash                                                                                                                                                                                                                                                          
root@542c2dc5feba:/# ./mvnd/maven-1.0.0-m5-SNAPSHOT-mvnd-m39-linux-amd64/bin/mvnd --version
./mvnd/maven-1.0.0-m5-SNAPSHOT-mvnd-m39-linux-amd64/bin/mvnd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./mvnd/maven-1.0.0-m5-SNAPSHOT-mvnd-m39-linux-amd64/bin/mvnd)
./mvnd/maven-1.0.0-m5-SNAPSHOT-mvnd-m39-linux-amd64/bin/mvnd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./mvnd/maven-1.0.0-m5-SNAPSHOT-mvnd-m39-linux-amd64/bin/mvnd)

Now, I am not sure about the intended supportability for different glibc versions. Ubuntu 18.04 is already pretty old and according to https://wiki.ubuntu.com/Releases, the end of standard support is like a month away. So maybe that one could be dropped? But then it seems like mvnd should still support at least ubuntu 20.04, which will be supported for another two years.

@gnodet
Copy link
Contributor

gnodet commented Mar 13, 2023

Note that this is only for the early access builds, as the release workflow is still referencing 18.04.
That, in itself, may be problematic and it would be preferable to use the same version imho.

Not sure about which glibc version we should support. What would be the requirement if we build on ubuntu 20.04 ?

@gzm55 any thoughts ?

@psiroky
Copy link
Contributor Author

psiroky commented Mar 13, 2023

Yeah, that's my bad. I should have updated both locations. I just tried building on ubuntu:20.04 and that seems to bring back the support for both 18.04 and 20.04, so I would go with that for now (see the linked PR).

psiroky added a commit to psiroky/maven-mvnd that referenced this issue Mar 13, 2023
 * building on ubuntu:22.04 produces binaries which require too recent glibc
   version (2.32+) and that means the binary no longer works on
   older ubuntu versions, like 20.04 and 18.04.

 * building on ubuntu:20.04 fixes the problem and the binary again works
   on ubuntu 18.04 and 20.04

 * also bumped the version in the release workflow which got forgotten
@gzm55
Copy link
Contributor

gzm55 commented Mar 13, 2023

not only ubuntu, the native binaries may also run on centos 6/7. if we cannot keep lower glibc requirements (like JDK), we would have to release for each OS major version.

glibc contains all version of its api. To avoid linking to high version glibc api, we should find the api requiring higher glibc, and append the lower name to glibc.redef.

@psiroky psiroky changed the title Linux native binary no longer works on ubuntu 18.04 and ubuntu 20.04 (and likely any linux with glibc < 2.32) Linux native binary no longer works on ubuntu 18.04 and ubuntu 20.04 (and likely any linux with glibc < 2.34) Mar 13, 2023
@gnodet gnodet added this to the 1.0.0-m5 milestone Mar 14, 2023
gnodet pushed a commit that referenced this issue Mar 15, 2023
* building on ubuntu:22.04 produces binaries which require too recent glibc
   version (2.32+) and that means the binary no longer works on
   older ubuntu versions, like 20.04 and 18.04.

 * building on ubuntu:20.04 fixes the problem and the binary again works
   on ubuntu 18.04 and 20.04

 * also bumped the version in the release workflow which got forgotten
oehme pushed a commit to oehme/maven-mvnd that referenced this issue Mar 30, 2023
* building on ubuntu:22.04 produces binaries which require too recent glibc
   version (2.32+) and that means the binary no longer works on
   older ubuntu versions, like 20.04 and 18.04.

 * building on ubuntu:20.04 fixes the problem and the binary again works
   on ubuntu 18.04 and 20.04

 * also bumped the version in the release workflow which got forgotten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants