Skip to content

Commit 019033d

Browse files
Fix the bug of loading shared libraries. (cztomczak#561)
* Prepend the package directory path to the "LD_LIBRARY_PATH" environment variable. * Fix the bug of getting "LD_LIBRARY_PATH" environment variable. * Fix loading shared libraries on Linux. Co-authored-by: Czarek Tomczak <[email protected]>
1 parent 2fcf395 commit 019033d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tools/installer/cefpython3.__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626

2727
package_dir = os.path.dirname(os.path.abspath(__file__))
2828

29-
# This loads the libcef.so library for the subprocess executable.
30-
# On Mac it works without setting library paths.
31-
os.environ["LD_LIBRARY_PATH"] = package_dir
29+
# This loads the libcef.so library for the subprocess executable on Linux.
30+
# TODO: Use -Wl,-rpath=\$$ORIGIN in Makefile.
31+
ld_library_path = os.environ.get("LD_LIBRARY_PATH")
32+
if ld_library_path and ld_library_path.strip():
33+
os.environ["LD_LIBRARY_PATH"] = package_dir + os.pathsep + ld_library_path
34+
else:
35+
os.environ["LD_LIBRARY_PATH"] = package_dir
3236

3337
# This env variable will be returned by cefpython.GetModuleDirectory().
3438
os.environ["CEFPYTHON3_PATH"] = package_dir

0 commit comments

Comments
 (0)