Skip to content

Latest commit

 

History

History
258 lines (197 loc) · 10.3 KB

Build-instructions.md

File metadata and controls

258 lines (197 loc) · 10.3 KB

Build instructions

IMPORTANT NOTE: These instructions are for the new releases of CEF Python (Chrome v51 and later). Currently only Linux platform is being tested. For the old v31 release that is supported on all platforms, see build instructions on the wiki pages.

There are several types of builds you can perform:

  1. You can build CEF Python using prebuilt CEF binaries that were uploaded to GH releases (tagged eg. v51-upstream)
  2. You can build both CEF Python and CEF from sources, but note that Building CEF is a long process that can take hours. In the tools/ directory there is the automate.py script that automates building CEF.
  3. You may also use prebuilt binaries from Spotify automated builds, see the CEF automated builds section.

Before you can build CEF Python or CEF you must satisfy requirements listed on this page.

Table of contents:

Build CEF Python on Linux

Complete steps for building CEF Python 55 using prebuilt binaries from GitHub releases:

  1. Tested and works fine on Ubuntu 14.04 64-bit (cmake 2.8.12 and g++ 4.8.4)

  2. Download ninja 1.7.1 or later and copy it to /usr/bin and chmod 755.

  3. Install packages: sudo apt-get install python-dev cmake g++ libgtk2.0-dev

  4. Install python dependencies by executing: cd cefpython/tools/ && sudo pip install -r requirements.txt (Cython version from requirements.txt must match exactly)

  5. Download 64-bit Linux binaries and libraries from GH releases tagged 'v55-upstream'.

  6. Extract it in the cefpython/build/ directory and rename the extracted directory to "cef_linux64".

  7. Build cefpython and run examples:

cd cefpython/src/linux/
python compile.py 55.0

Requirements

Below are platform specific requirements. Do these first before following instructions in the "All platforms" section that lists requirements common for all platforms.

Windows

Linux

  • Install packages: sudo apt-get install python-dev cmake g++ libgtk2.0-dev
  • If using prebuilt binaries from Spotify automated builds and want to build cefclient/cefsimple you need to install these packages: sudo apt-get install libgtkglext1-dev
  • If building CEF from sources:
    • Official binaries are built on Ubuntu 14.04 (cmake 2.8.12, g++ 4.8.4)
    • Download ninja 1.7.1 or later and copy it to /usr/bin and chmod 755.
    • Install required packages using one of the three methods below:
      1. Type command: sudo apt-get install bison build-essential cdbs curl devscripts dpkg-dev elfutils fakeroot flex g++ git-core git-svn gperf libapache2-mod-php5 libasound2-dev libav-tools libbrlapi-dev libbz2-dev libcairo2-dev libcap-dev libcups2-dev libcurl4-gnutls-dev libdrm-dev libelf-dev libexif-dev libffi-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev openbox patch perl php5-cgi pkg-config python python-cherrypy3 python-crypto python-dev python-psutil python-numpy python-opencv python-openssl python-yaml rpm ruby subversion ttf-dejavu-core ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho fonts-thai-tlwg wdiff zip
      2. See the list of packages on the cef/AutomatedBuildSetup.md wiki page.
      3. Run the install-build-deps.sh script - instructions provided further down on this page.
    • To build on Debian 7 see cef/BuildingOnDebian7.md and cef/#1575, and cef/#1697
    • To perform a 32-bit Linux build on a 64-bit Linux system see Linux configuration in upstream cef/AutomatedBuildSetup.md. See also cef/#1804.

All platforms

  • Install dependencies for the automate.py tool by executing: cd tools/ && pip install -r requirements.txt (on Linux use sudo). This will install some PyPI packages including Cython. On Windows installing Cython requires a VS compiler - see instructions above for Windows.

Build CEF Python using prebuilt CEF binaries

NOT WORKING YET

Prebuilt binaries are available on GitHub Releases and tagged eg. 'v51-upstream'.

Run the automate.py tool using the --prebuilt-cef flag that will download prebuilt binaries from GitHub Releases using version information from the "src/version/" directory.

cd tools/
python automate.py --prebuilt-cef

You should be fine by running automate.py with the default options, but if you need to customize the build then use the --help flag to see more.

Build both CEF Python and CEF from sources

Run the automate.py tool using the --build-cef flag. You can optionally set how many parallel ninja jobs to run (by default cores/2) with the --ninja-jobs flag.

The automate script will use version information from the "src/version/" directory. If you would like to use a custom CEF branch then you can use the --cef-branch flag - but note that this is only for advanced users as this will require updating cefpython's C++/Cython code.

If building on Linux and there are errors, see the MISSING PACKAGES note futher down.

You should be fine by running automate.py with the default options, but if you need to customize the build then use the --help flag to see more.

cd ~/cefpython/
mkdir build/ && cd build
python ../tools/automate.py --build-cef --ninja-jobs 6
mv cef*_*_linux64/ cef_linux64/
cd ../../../src/linux/
python compile.py 55.0

MISSING PACKAGES (Linux): After the chromium sources are downloaded, it will try to build cef projects and if it fails due to missing packages make sure you've installed all the required packages listed in the Requirements section further up on this page. If it still fails, you can fix it by running the install-build-deps.sh script (intended for Ubuntu systems, but you could edit it). When the "ttf-mscorefonts-installer" graphical installer pops up don't install it - deny EULA.

cd build/chromium/src/build/
chmod 755 install-build-deps.sh
sudo ./install-build-deps.sh --no-lib32 --no-arm --no-chromeos-fonts --no-nacl

After dependencies are satisifed re-run automate.py.

Build CEF manually

CEF Python official binaries come with custom CEF binaries with a few patches applied for our use case. These patches are in the patches/ directory.

On Linux before running any of CEF tools apply the issue73 patch first.

To build CEF follow the instructions on the Branches and Building CEF wiki page: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding

After it is successfully built - apply patches, rebuild and remake distribs.

Note that CEF patches must be applied in the "download_dir/chromium/src/cef/" directory, not in the "download_dir/cef/" directory.

CEF automated builds

There are two sites that provide latest builds of CEF:

To build the "libcef_dll_wrapper" library type these commands:

cd cef_binary/
mkdir build
cd build/
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ..
ninja libcef_dll_wrapper

To build CEF sample applications type ninja cefclient cefsimple.

Official CEF Python binaries come with additional patches to CEF/Chromium, see the patches/ directory. Whether you need these patches depends on your use case, they may not be required and thus you could use the Spotify binaries. Spotify builds have the issue73 patch (no tcmalloc) applied.

How to patch

Create a patch from unstaged changes in current directory:

cd chromium/src/cef/
git diff --no-prefix --relative > issue251.patch

Apply a patch in current directory:

cd chromium/src/cef/
git apply -v -p0 issue251.patch

To create a patch from last two commits (no --relative flag available in this case, so must be in root CEF dir):

git format-patch --no-prefix -2 HEAD --stdout > issue251.patch