Skip to content

Commit

Permalink
Fix the bug of loading shared libraries. (#561)
Browse files Browse the repository at this point in the history
* 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 <cztomczak@users.noreply.github.com>
  • Loading branch information
Xianguang-Zhou and cztomczak committed Feb 14, 2021
1 parent 2fcf395 commit 019033d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/installer/cefpython3.__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@

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

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

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

0 comments on commit 019033d

Please sign in to comment.