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

glibc version not found #104

Open
daveneeley opened this issue Dec 13, 2023 · 13 comments
Open

glibc version not found #104

daveneeley opened this issue Dec 13, 2023 · 13 comments

Comments

@daveneeley
Copy link

I've tried to download the switcher binary directly instead of using a package manager. It returned an error about a missing glibc version. Are there any steps that I've missed? I (perhaps naively) thought that Go apps didn't ever have external dependencies.

OS=linux
VERSION=0.8.0
curl -L -o switcher https://github.com/danielfoehrKn/kubeswitch/releases/download/${VERSION}/switcher_${OS}_amd64
chmod +x switcher
./switcher

produces this output

./switcher: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./switcher)
./switcher: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./switcher)

linux machine

uname -a
Linux myhostname 5.15.0-1042-azure #49~20.04.1-Ubuntu SMP Wed Jul 12 12:44:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
@hhue13
Copy link

hhue13 commented Jan 11, 2024

I'm facing the same issue on my RHEL v8.9 machine.

uname -a
Linux xxx 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Thu Nov 16 10:29:04 EST 2023 x86_64 x86_64 x86_64 GNU/Linux

The glibc version provided with RHEL v8.9 seems to be 2.28:

ldd --version ldd
ldd (GNU libc) 2.28
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.

Any chance to get switcher running on RHEL v8.9?

@danielfoehrKn
Copy link
Owner

Hi, thanks for reporting. I'll try to get it running on my Fedora box and report back (so far I have only tested on my OSX machine)

@ravaga
Copy link

ravaga commented Apr 30, 2024

Same issue for Ubuntu 20.04.6 LTS in Windows WSL

@cdenneen
Copy link

#102 This was my issue and had to downgrade. Is it possible for the Homebrew formula to be updated to compile similar to the kubernetes-cli one? This would hopefully avoid the binaries being built with different libc?

@danielfoehrKn
Copy link
Owner

Do you have a link to the kubernetes-cli homebrew formula where I could see how they do it? Thanks!

@cdenneen
Copy link

cdenneen commented May 14, 2024

I was able to get this to work.
I would have used your Makefile but it builds all the arch which isn't necessary when doing this way.

class Switcher < Formula
  desc "Providing the binary executable for the 'switch' script."
  homepage "https://github.com/danielfoehrKn/kubeswitch"
  url "https://github.com/danielfoehrKn/kubeswitch.git",
    tag: "0.9.1",
    revision: "9f82b5f75bbc51615d97d006df86f1b9939123fd"
  license "Apache-2.0"
  head "https://github.com/danielfoehrKn/kubeswitch.git", branch: "master"

  depends_on "bash" => :build
  depends_on "coreutils" => :build
  depends_on "go" => :build

  def install
    rm_rf ".brew_home"
    ldflags = %W[
      -w
      -X github.com/danielfoehrkn/kubeswitch/cmd/switcher.version=#{version}
      -X github.com/danielfoehrkn/kubeswitch/cmd/switcher.buildDate=#{time.iso8601}
    ]

    ENV.prepend_path "PATH", Formula["coreutils"].opt_libexec/"gnubin" # needs GNU date
    system "go", "build", *std_go_args(ldflags:), "./cmd/main.go"

    generate_completions_from_executable(bin/"switcher", "completion", base_name: "switcher")
  end

  def caveats
    <<~EOS
      To setup shell integration, add this to your shell configuration:
      # bash
      source <(switcher init bash)
      # zsh
      source <(switcher init zsh)
      # fish
      switcher init fish | source
    EOS
  end

  test do
    system "#{bin}/switcher", "-h"
  end
end

After that I didn't end up putting anything in bashrc since the completions were done.

switcher works... now if you want to use s or switch then you could do alias s=switcher or alias switch=switcher...

Hope this helps?

@cdenneen
Copy link

> more /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2025-06-30"

> switcher -v
switcher version 0.9.1

@cdenneen
Copy link

Do you have a link to the kubernetes-cli homebrew formula where I could see how they do it? Thanks!

https://github.com/Homebrew/homebrew-core/blob/master/Formula/k/kubernetes-cli.rb

@cdenneen
Copy link

After that I didn't end up putting anything in bashrc since the completions were done.

switcher works... now if you want to use s or switch then you could do alias s=switcher or alias switch=switcher...

Totally had forgotten you have 2 Homebrew formulas so I'm curious if the other switch one is necessary or not?
Also the completions should work for zsh as well with the above formula... I had your normal one working on my Mac but in Linux I ended up having to lock to 0.7.2 until I did this so not sure if I really need the switch (switch.sh) one at all or not since it seems its working without anything in my bashrc since it goes into homebrews completions directory

@danielfoehrKn
Copy link
Owner

danielfoehrKn commented May 15, 2024

Thanks! I will have to try this out before putting it in the formula.
The second homebrew formula is to configure switch.sh if you don't want to manually source switcher init zsh - though that's the recommended way.
I think at this point we can also just get rid of the second formula.

@cdenneen
Copy link

@danielfoehrKn I had to make one change for this to work when using a specific version of the formula like when extracting.

https://github.com/cdenneen/homebrew-taps/blob/main/Formula/switcher.rb

So that would work for latest and when you extract out a specific version like:
https://github.com/cdenneen/homebrew-taps/blob/main/Formula/switcher%400.9.1.rb

It's still works.

@vinibali
Copy link

vinibali commented May 29, 2024

same for me on Ubuntu 20.04 LTS

./switcher_linux_amd64: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./switcher_linux_amd64)
./switcher_linux_amd64: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./switcher_linux_amd64)

i had to rollback to version 0.7.2:
https://github.com/danielfoehrKn/kubeswitch/releases/tag/0.7.2

@mveroone
Copy link

Given GlibC is backward compatible, only Debian 12 and later will work with kubeswitch versions >= 0.7.2
image

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

No branches or pull requests

7 participants