@@ -276,37 +276,43 @@ def _detect_glibc_version() -> Optional[Tuple[int, int]]:
276276def _install_glibc_234 ():
277277 """Download and build glibc 2.34 into /tmp/glibc-2.34 if missing."""
278278 if GLIBC_LOADER .exists ():
279- logger .info ("[glibc] Found existing glibc-2.34 at %s" , GLIBC_ROOT )
279+ logger .info ("[glibc] Already installed at %s" , GLIBC_ROOT )
280280 return
281281
282- logger .info (
283- "[glibc] Installing glibc 2.34 into %s ... this may take a while" , GLIBC_ROOT
284- )
282+ logger .info ("[glibc] Installing glibc 2.34 into %s ..." , GLIBC_ROOT )
285283 url = "https://ftp.gnu.org/gnu/libc/glibc-2.34.tar.xz"
286284
287285 with tempfile .TemporaryDirectory () as tmpdir :
288286 tarball = pathlib .Path (tmpdir ) / "glibc-2.34.tar.xz"
287+ logger .info ("[glibc] Downloading %s" , url )
289288 urllib .request .urlretrieve (url , tarball )
290- logger .info ("[glibc] Downloaded %s" , url )
291- build_dir = pathlib .Path (tmpdir ) / "glibc-build"
292- src_dir = pathlib .Path (tmpdir ) / "glibc-2.34"
293- os .makedirs (build_dir , exist_ok = True )
289+ logger .info ("[glibc] Downloaded %s" , tarball )
294290
295- # Extract
296291 logger .info ("[glibc] Extracting source..." )
297292 with tarfile .open (tarball , "r:xz" ) as tf :
298293 tf .extractall (path = tmpdir )
299294
300- # Configure and build
301- logger .info ("[glibc] Configuring build..." )
302- subprocess .check_call (
303- ["../glibc-2.34/configure" , f"--prefix={ GLIBC_ROOT } " ],
304- cwd = build_dir ,
305- )
306- logger .info ("[glibc] Building (this may take several minutes)..." )
307- subprocess .check_call (["make" , "-j" , str (os .cpu_count ())], cwd = build_dir )
308- logger .info ("[glibc] Installing..." )
309- subprocess .check_call (["make" , "install" ], cwd = build_dir )
295+ build_dir = pathlib .Path (tmpdir ) / "glibc-build"
296+ os .makedirs (build_dir , exist_ok = True )
297+
298+ env = os .environ .copy ()
299+ # Remove LD_LIBRARY_PATH to satisfy configure checks
300+ env .pop ("LD_LIBRARY_PATH" , None )
301+
302+ # Configure
303+ cmd = ["../glibc-2.34/configure" , f"--prefix={ GLIBC_ROOT } " ]
304+ logger .info ("[glibc] Running: %s" , " " .join (cmd ))
305+ subprocess .check_call (cmd , cwd = build_dir , env = env )
306+
307+ # Build
308+ cmd = ["make" , "-j" , str (os .cpu_count ())]
309+ logger .info ("[glibc] Running: %s" , " " .join (cmd ))
310+ subprocess .check_call (cmd , cwd = build_dir , env = env )
311+
312+ # Install
313+ cmd = ["make" , "install" ]
314+ logger .info ("[glibc] Running: %s" , " " .join (cmd ))
315+ subprocess .check_call (cmd , cwd = build_dir , env = env )
310316
311317 if GLIBC_LOADER .exists ():
312318 logger .info ("[glibc] Successfully installed glibc 2.34 at %s" , GLIBC_ROOT )
0 commit comments