'Returns gcc ABI compatibility info by getting the library version of
a compiler\'s libstdc++ or libgcc_s'

@memoized
def _gcc_get_libstdcxx_version(self, version):

    spec = CompilerSpec('gcc', version)
    compilers = spack.compilers.compilers_for_spec(spec)
    if (not compilers):
        return None
    compiler = compilers[0]
    rungcc = None
    libname = None
    output = None
    if compiler.cxx:
        rungcc = Executable(compiler.cxx)
        libname = ('libstdc++.' + dso_suffix)
    elif compiler.cc:
        rungcc = Executable(compiler.cc)
        libname = ('libgcc_s.' + dso_suffix)
    else:
        return None
    try:
        if (Clang.default_version(rungcc.exe[0]) != 'unknown'):
            return None
        output = rungcc(('--print-file-name=%s' % libname), output=str)
    except ProcessError:
        return None
    if (not output):
        return None
    libpath = os.readlink(output.strip())
    if (not libpath):
        return None
    return os.path.basename(libpath)
