Retrieve an LD_LIBRARY_PATH value suitable for using the native linker to resolve our shared
libraries.
324201
public static String makeLdLibraryPath() {
    sSoSourcesLock.readLock().lock();
    try {
      assertInitialized();
      Log.d(TAG, "makeLdLibraryPath");
      ArrayList<String> pathElements = new ArrayList<>();
      SoSource[] soSources = sSoSources;
      for (int i = 0; i < soSources.length; ++i) {
        soSources[i].addToLdLibraryPath(pathElements);
      }
      String joinedPaths = TextUtils.join(":", pathElements);
      Log.d(TAG, "makeLdLibraryPath final path: " + joinedPaths);
      return joinedPaths;
    } finally {
      sSoSourcesLock.readLock().unlock();
    }
  }
821332
def get_static_lib_paths():
    
    libs = []
    is_linux = sys.platform.startswith('linux')
    if is_linux:
        libs += ['-Wl,--start-group']
    libs += get_raw_static_lib_path()
    if is_linux:
        libs += ['-Wl,--end-group']
    return libs
1313076
def _load_library(self):
        
        path = self._library_path()
        logger.info("Loading library from path {}".format(path))
        library_dir = os.path.dirname(path)
        if platform.system() == 'Windows':
            import win32api
            olddir = os.getcwd()
            os.chdir(library_dir)
            win32api.SetDllDirectory('.')

        result = cdll.LoadLibrary(path)

        if platform.system() == 'Windows':
            os.chdir(olddir)

        return result
669561
function resolvePath(_path, relativePath = currentWorkDir) {
  if (!isString(_path) || _path.startsWith('~')) {
    return _path;
  }
  const file = nativePath.relative(relativePath, _path);
  return nativePath.join(relativePath, file);
}
1116679
def getLinkerFlags(self, engineRoot, fmt, includeLibs=True):
		
		components = self.resolveRoot(self.ldFlags, engineRoot)
		if includeLibs == True:
			components.extend(self.prefixedStrings(self.linkerDirPrefix, self.linkDirs, engineRoot))
			components.extend(self.resolveRoot(self.libs, engineRoot))
		
		return Utility.join(fmt.delim, components, fmt.quotes)
686524
def load_library_handle(libname, path):
    """"""

    if path is None or path in ['None', 'none']:
        # Either could not find a library via ctypes or
        # user-configuration-file, or we could not find it in any of the
        # default locations, or possibly the user intentionally does not want
        # one of the libraries to load.
        return None

    try:
        if os.name == "nt":
            opj_lib = ctypes.windll.LoadLibrary(path)
        else:
            opj_lib = ctypes.CDLL(path)
    except (TypeError, OSError):
        msg = 'The {libname} library at {path} could not be loaded.'
        msg = msg.format(path=path, libname=libname)
        warnings.warn(msg, UserWarning)
        opj_lib = None

    return opj_lib
310421
def getThirdPartyLibIncludeDirs(self, libs):
		
		platformDefaults = True
		if libs[0] == '--nodefaults':
			platformDefaults = False
			libs = libs[1:]
		
		details = self.getThirdpartyLibs(libs, includePlatformDefaults=platformDefaults)
		return details.getIncludeDirectories(self.getEngineRoot(), delimiter='\n')
736883
def explicit_path(cls, ndivsm, kpath_bounds):
        """"""
        return cls._path(ndivsm, kpath_bounds=kpath_bounds, comment="Explicit K-path")
1133957
def get_lib(self, arch='x86'):
        
        if arch == 'x86':
            arch = ''
        if arch == 'x64':
            arch = 'amd64'
        lib = os.path.join(self.vc_dir, 'lib', arch)
        if os.path.isdir(lib):
            logging.info(_('using lib: %s'), lib)
            return [lib]
        logging.debug(_('lib not found: %s'), lib)
        return []
1152665
def _library_check(self):
        

        try:
            output = yield from gns3server.utils.asyncio.subprocess_check_output("ldd", self._path)
        except (FileNotFoundError, subprocess.SubprocessError) as e:
            log.warn("Could not determine the shared library dependencies for {}: {}".format(self._path, e))
            return

        p = re.compile("([\.\w]+)\s=>\s+not found")
        missing_libs = p.findall(output)
        if missing_libs:
            raise IOUError("The following shared library dependencies cannot be found for IOU image {}: {}".format(self._path,
                                                                                                                   ", ".join(missing_libs)))
1371380
def _resolveCtypesImports(cbinaries):
    
    if is_unix:
        envvar = "LD_LIBRARY_PATH"
    elif is_darwin:
        envvar = "DYLD_LIBRARY_PATH"
    else:
        envvar = "PATH"

    def _setPaths():
        path = os.pathsep.join(PyInstaller.__pathex__)
        old = compat.getenv(envvar)
        if old is not None:
            path = os.pathsep.join((path, old))
        compat.setenv(envvar, path)
        return old

    def _restorePaths(old):
        if old is None:
            compat.unsetenv(envvar)
        else:
            compat.setenv(envvar, old)

    ret = []

    # Try to locate the shared library on disk. This is done by
    # executing ctypes.utile.find_library prepending ImportTracker's
    # local paths to library search paths, then replaces original values.
    old = _setPaths()
    for cbin in cbinaries:
        # Ignore annoying warnings like:
        # 'W: library kernel32.dll required via ctypes not found'
        # 'W: library coredll.dll required via ctypes not found'
        if cbin in ['coredll.dll', 'kernel32.dll']:
            continue
        ext = os.path.splitext(cbin)[1]
        # On Windows, only .dll files can be loaded.
        if os.name == "nt" and ext.lower() in [".so", ".dylib"]:
            continue
        cpath = find_library(os.path.splitext(cbin)[0])
        if is_unix:
            # CAVEAT: find_library() is not the correct function. Ctype's
            # documentation says that it is meant to resolve only the filename
            # (as a *compiler* does) not the full path. Anyway, it works well
            # enough on Windows and Mac. On Linux, we need to implement
            # more code to find out the full path.
            if cpath is None:
                cpath = cbin
            # "man ld.so" says that we should first search LD_LIBRARY_PATH
            # and then the ldcache
            for d in compat.getenv(envvar, '').split(os.pathsep):
                if os.path.isfile(os.path.join(d, cpath)):
                    cpath = os.path.join(d, cpath)
                    break
            else:
                text = compat.exec_command("/sbin/ldconfig", "-p")
                for L in text.strip().splitlines():
                    if cpath in L:
                        cpath = L.split("=>", 1)[1].strip()
                        assert os.path.isfile(cpath)
                        break
                else:
                    cpath = None
        if cpath is None:
            logger.warn("library %s required via ctypes not found", cbin)
        else:
            ret.append((cbin, cpath, "BINARY"))
    _restorePaths(old)
    return ret
294685
def _getImports_ldd(pth):
    
    rslt = set()
    if is_aix:
        # Match libs of the form 'archive.a(sharedobject.so)'
        # Will not match the fake lib '/unix'
        lddPattern = re.compile(r"\s+(.*?)(\(.*\))")
    else:
        lddPattern = re.compile(r"\s+(.*?)\s+=>\s+(.*?)\s+\(.*\)")

    for line in compat.exec_command('ldd', pth).strip().splitlines():
        m = lddPattern.search(line)
        if m:
            if is_aix:
                lib = m.group(1)
                name = os.path.basename(lib) + m.group(2)
            else:
                name, lib = m.group(1), m.group(2)
            if name[:10] in ('linux-gate', 'linux-vdso'):
                # linux-gate is a fake library which does not exist and
                # should be ignored. See also:
                # http://www.trilithium.com/johan/2005/08/linux-gate/
                continue

            if os.path.exists(lib):
                # Add lib if it is not already found.
                if lib not in rslt:
                    rslt.add(lib)
            else:
                logger.error('Can not find %s in path %s (needed by %s)',
                             name, lib, pth)
    return rslt
1373544
def get_jvm_path(self):
        
        for method in self._methods:
            try:
                jvm = method()

                # If found check the architecture 
                if jvm:
                    self.check(jvm)
            except NotImplementedError:
                # Ignore missing implementations
                pass
            except JVMNotFoundException:
                # Ignore not successful methods
                pass
            except JVMNotSupportedException:
                pass

            else:
                if jvm is not None:
                    return jvm

        else:
            raise JVMNotFoundException("No JVM shared library file ({0}) "
                                       "found. Try setting up the JAVA_HOME "
                                       "environment variable properly."
                                       .format(self._libfile))
884873
def glibc_version_string():
    ""

    # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
    # manpage says, "If filename is NULL, then the returned handle is for the
    # main program". This way we can let the linker do the work to figure out
    # which libc our process is actually using.
    process_namespace = ctypes.CDLL(None)
    try:
        gnu_get_libc_version = process_namespace.gnu_get_libc_version
    except AttributeError:
        # Symbol doesn't exist -> therefore, we are not linked to
        # glibc.
        return None

    # Call gnu_get_libc_version, which returns a string like "2.5"
    gnu_get_libc_version.restype = ctypes.c_char_p
    version_str = gnu_get_libc_version()
    # py2 / py3 compatibility:
    if not isinstance(version_str, str):
        version_str = version_str.decode("ascii")

    return version_str
629658
def get_stdlib_path():
    
    if sys.version_info >= (2, 7):
        import sysconfig
        return sysconfig.get_paths()['stdlib']
    else:
        return os.path.join(sys.prefix, 'lib')
451600
def get_glibc_version():
    
    # TODO: Look into a nicer way to get the version
    try:
        out = subprocess.Popen(['ldd', '--version'],
                               stdout=subprocess.PIPE).communicate()[0]
    except OSError:
        return
    match = re.search('([0-9]+)\.([0-9]+)\.?[0-9]*', out)
    try:
        return map(int, match.groups())
    except AttributeError:
        return
1059152
def _load_lib():
    """"""
    lib_path = libinfo.find_lib_path()
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
    # DMatrix functions
    lib.MXGetLastError.restype = ctypes.c_char_p
    return lib