Python Forum

Full Version: GLIBC dependency issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to use the open source toolkit, "Aequitas" (https://github.com/dssg/aequitas). One of the functions from the package has a GLIBC-2.29 dependency that my Posit environment won't support (RHEL 8 can only support up to 2.28 (https://access.redhat.com/solutions/38634)). Error follows:

Error:
OSError: /lib64/libm.so.6: version 'GLIBC_2.29' not found (required)'
I installed one of the gcc-toolset packages (gcc-toolset-9) available for RHEL 8 to attempt to access a more recent version of GLIBC and was able to download the tar.gz file and create a glibc-2.29/build folder. I have tried a few ways to link it but keep running into errors. Can anyone advise on code that can run in python to use the glibc-2.29 from the toolset for the necessary package? Code for installing a GCC toolset to download, build, and use glibc 2.29 locally follows:

! yum install gcc-toolset-9
import os
import subprocess
import sys

# Define paths
glibc_version = '2.29'
glibc_tarball_url = f'http://ftp.gnu.org/gnu/libc/glibc-{glibc_version}.tar.gz'
glibc_src_dir = f'glibc-{glibc_version}'
build_dir = f'{glibc_src_dir}/build'
install_dir = os.path.expanduser(f'~/glibc-{glibc_version}-install')

# Function to run shell commands
def run_command(command, cwd=None, check=True):
    print(f"Running command: {command}")
    result = subprocess.run(command, shell=True, cwd=cwd, check=check, text=True, capture_output=True)
    print(result.stdout)
    if result.stderr:
        print(f"Error: {result.stderr}", file=sys.stderr)
    return result

# Create a working directory
print(f"Creating working directory...")
run_command(f'mkdir -p ~/glibc-{glibc_version}', check=False)
# Download the glibc source code
print(f"Downloading glibc {glibc_version}...")
run_command(f'wget {glibc_tarball_url}', cwd=os.path.expanduser(f'~/glibc-{glibc_version}'), check=True)

# Extract the source code
print(f"Extracting glibc {glibc_version}...")
run_command(f'tar -xzf glibc-{glibc_version}.tar.gz', cwd=os.path.expanduser(f'~/glibc-{glibc_version}'), check=True)
# Create a build directory
print(f"Creating build directory...")
run_command(f'mkdir -p {build_dir}', cwd=os.path.expanduser(f'~/glibc-{glibc_version}'), check=True)

# Configure the build
print(f"Configuring the build...")
run_command(f'../configure --prefix={install_dir}', cwd=build_dir, check=True)
(Jul-29-2024, 06:21 PM)mackins Wrote: [ -> ]was able to download the tar.gz file and create a glibc-2.29/build folder
You created a build folder but at some point you must invoke make in order to build the libraries. This thread may help you compile glibc.

Obviously, you need the libm.so.6 library, I suppose this library is contained into the glibc that you will compile.

I'm not sure this will help you because I suspect that your Python interpreter is linked against your system's libm library which is not the glibc-2.29 one and you can't change that unless you build Python itself against your new glibc.