···
index 0c2510e161..7fb98af308 100644
14
-
@@ -100,53 +100,7 @@ def _is_elf(filename):
15
-
return thefile.read(4) == elf_header
17
-
def _findLib_gcc(name):
18
-
- # Run GCC's linker with the -t (aka --trace) option and examine the
19
-
- # library name it prints out. The GCC command will fail because we
20
-
- # haven't supplied a proper program with main(), but that does not
22
-
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
24
-
- c_compiler = shutil.which('gcc')
25
-
- if not c_compiler:
26
-
- c_compiler = shutil.which('cc')
27
-
- if not c_compiler:
28
-
- # No C compiler available, give up
31
-
- temp = tempfile.NamedTemporaryFile()
33
-
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
35
-
- env = dict(os.environ)
36
-
- env['LC_ALL'] = 'C'
39
-
- proc = subprocess.Popen(args,
40
-
- stdout=subprocess.PIPE,
41
-
- stderr=subprocess.STDOUT,
43
-
- except OSError: # E.g. bad executable
46
-
- trace = proc.stdout.read()
50
-
- except FileNotFoundError:
51
-
- # Raised if the file was already removed, which is the normal
52
-
- # behaviour of GCC if linking fails
54
-
- res = re.findall(expr, trace)
59
-
- # Check if the given file is an elf file: gcc can report
60
-
- # some files that are linker scripts and not actual
61
-
- # shared objects. See bpo-41976 for more details
62
-
- if not _is_elf(file):
64
-
- return os.fsdecode(file)
68
-
if sys.platform == "sunos5":
@@ -268,34 +222,7 @@ def find_library(name, is64 = False):