Rovango / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

Linux installers: setup.py and .deb package issues - dependencies and libudev.so.0 #145

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Both setup.py and debian package have some issues, not everything work out of 
the box.

Get rid of steps 2 and 3 from README.txt. Automate it by adding new code that 
does these steps to setup.py > my_post_install(). That install hook already 
does some stuff like setting write/execute permissions for files. See: 
https://code.google.com/p/cefpython/source/browse/cefpython/cef3/linux/installer
/setup.py.template

Debian package runs setup.py and my_post_install() as well, so fixing it in 
setup.py will fix problem in deb package as well.

Steps 2 and 3 from README.txt:
(https://code.google.com/p/cefpython/source/browse/cefpython/cef3/linux/installe
r/README.txt.template)

    2. It may also be required to install "libnss3" and "libnspr4" dependencies:

       sudo apt-get install libnss3-1d libnspr4-0d

    3. On Ubuntu 12 everything should work out of the box. But on Ubuntu 13,
       Ubuntu 14, Fedora 20 and possibly some other OS'es there may be issues
       with wrong version of libudev library. For example to fix it on Ubuntu
       64bit it is required to create a symbolic link "libudev.so.0" to
       the "libudev.so.1" library with this command:

       cd /lib/x86_64-linux-gnu/
       sudo ln -sf libudev.so.1 libudev.so.0

       The path to libudev.so.1 may be different on other OS'es, see:
       * Ubuntu, Xubuntu, Mint - /lib/x86_64-linux-gnu/
       * SUSE, Fedora - /usr/lib64/
       * Arch, Fedora 32bit - /usr/lib/
       * Ubuntu 32bit - /lib/i386-linux-gnu/

Add code like this for steps 2 and 3:

    subprocess.call("sudo apt-get install libnss3-1d libnspr4-0d", shell=True)
    dirs = ["/lib/x86_64-linux-gnu", "/usr/lib64", "/usr/lib", "/lib/i386-linux-gnu"]
    for dir in dirs:
        if os.path.exists(dir+"/libudev.so.1") and not os.path.exists(dir+"/libudev.so.0"):
            os.chdir(dir)
            subprocess.call("sudo ln -sf libudev.so.1 libudev.so.0", shell=True)

Original issue reported on code.google.com by czarek.t...@gmail.com on 1 Dec 2014 at 10:02

GoogleCodeExporter commented 8 years ago

Original comment by czarek.t...@gmail.com on 1 Dec 2014 at 10:03

GoogleCodeExporter commented 8 years ago

Original comment by czarek.t...@gmail.com on 1 Dec 2014 at 3:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If steps 2 and 3 are added to my_post_install() in setup.py, will it work with 
Egg/Wheel packages? These steps require to run commands through "sudo". Will it 
ask for password when running "pip install cefpython3"?

Original comment by czarek.t...@gmail.com on 2 Dec 2014 at 9:10

GoogleCodeExporter commented 8 years ago
The libudev.so.0 solution on node-webkit wiki suggests creating .sh script to 
run application. That shell script adds app directory to LD_LIBRARY_PATH. In 
app directory "libudev.so.0" symlink is created. In cefpython3/__init__.py 
there is already package directory being added to LD_LIBRARY_PATH, see:

  # This will allow the subprocess executable to load the libcef.so
  # and libffmpeg.so libraries.
  os.environ["LD_LIBRARY_PATH"] = package_dir

So it should be enough to create libudev.so.0 symlink in cefpython3 package 
directory.

Original comment by czarek.t...@gmail.com on 2 Dec 2014 at 9:14

GoogleCodeExporter commented 8 years ago
Step 2 installing "libnss3-1d libnspr4-0d" should not be added to 
my_post_install(), as APT-GET tool is not guaranteed to be available on all 
linux distributions. For example Fedora uses a different "yum" package manager. 
Instructions on installing dependencies should be put on both PyPI site and 
Download wiki page.

Original comment by czarek.t...@gmail.com on 2 Dec 2014 at 10:49

GoogleCodeExporter commented 8 years ago
libnss3-1d and libnspr4-0d dependencies are no more required in branch 1650.

Original comment by czarek.t...@gmail.com on 3 Dec 2014 at 4:27

GoogleCodeExporter commented 8 years ago
libudev fixed in revision 20d38e80cb38.

Original comment by czarek.t...@gmail.com on 3 Dec 2014 at 5:04

GoogleCodeExporter commented 8 years ago
For debian package a separate fix was required for libudev issue, see revision 
78f7a94b21f0.

Original comment by czarek.t...@gmail.com on 3 Dec 2014 at 5:57

GoogleCodeExporter commented 8 years ago
Below is the code that creates libudev symlink in google chrome. It is created 
in app directory. Unfortunately this didn't work with CEF, as I've tried. I've 
modified rpath ./ in libcef.so, but it still couldn't find it. In Python script 
you cannot change LD_LIBRARY_PATH during runtime, it does not apply when 
calling ctypes.CDLL. Code taken from postinstall script from google chrome deb 
package:

    # Fedora 18 now has libudev.so.1. http://crbug.com/145160
    # Same for Ubuntu 13.04. http://crbug.com/226002
    LIBUDEV_0=libudev.so.0
    LIBUDEV_1=libudev.so.1

    add_udev_symlinks() {
      get_lib_dir
      if [ -f "/$LIBDIR/$LIBUDEV_0" -o -f "/usr/$LIBDIR/$LIBUDEV_0" -o -f "/lib/$LIBUDEV_0" ]; then
        return 0
      fi

      if [ -f "/$LIBDIR/$LIBUDEV_1" ]; then
        ln -snf "/$LIBDIR/$LIBUDEV_1" "/opt/google/chrome/$LIBUDEV_0"
      elif [ -f "/usr/$LIBDIR/$LIBUDEV_1" ];
      then
        ln -snf "/usr/$LIBDIR/$LIBUDEV_1" "/opt/google/chrome/$LIBUDEV_0"
      else
        echo "$LIBUDEV_1" not found in "$LIBDIR" or "/usr/$LIBDIR".
        exit 1
      fi
    }

Original comment by czarek.t...@gmail.com on 4 Dec 2014 at 3:28

GoogleCodeExporter commented 8 years ago
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/cefpython/issues/145

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 6:41