| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Table of contents:
These instructions are for the new releases of CEF Python v50+. For the old v31 release see the build instructions on Wiki pages.
If you would like to quickly build cefpython then see the Quick build instructions for Windows and Quick build instructions for Linux sections. These instructions are complete meaning you don't need to read anything more from this document. Using these quick instructions you should be able to build cefpython in less than 10 minutes.
There are several types of builds described in this document:
Before you can build CEF Python or CEF you must satisfy requirements listed on this page.
Complete steps for building CEF Python v50+ with Python 2.7 using prebuilt binaries and libraries from GitHub Releases:
Tested and works fine on Windows 7 64-bit
Download ninja 1.7.2 or later and add it to PATH.
Download cmake and add it to PATH.
For Python 2.7 Install "Visual C++ Compiler for Python 2.7" from here
For Python 2.7 and when using using "Visual C++ compiler for Python 2.7" you have to install "Visual C++ 2008 Redistributable Package (x64)" from here
Clone cefpython and create a build/ directory and enter it:
git clone https://github.com/cztomczak/cefpython.git cd cefpython/ mkdir build/ cd build/
pip install --upgrade -r ../tools/requirements.txt
Download Windows binaries and libraries from GH releases tagged e.g. 'v55-upstream' when building v55. The version of the binaries must match exactly the CEF version from the "cefpython/src/version/cef_version_win.h" file (the CEF_VERSION constant).
Extract the archive in the "build/" directory.
Build cefpython and run examples (xx.x is version number):
python ../tools/build.py xx.x
Complete steps for building CEF Python v50+ using prebuilt binaries and libraries from GitHub Releases:
Tested and works fine on Ubuntu 14.04 64-bit
Download ninja 1.7.1 or later and copy it to /usr/bin and chmod 755.
Install required packages (tested and works with: cmake 2.8.12 and g++ 4.8.4):
sudo apt-get install python-dev cmake g++ libgtk2.0-dev
git clone https://github.com/cztomczak/cefpython.git cd cefpython/ mkdir build/ cd build/
sudo pip install --upgrade -r ../tools/requirements.txt
Download Linux binaries and libraries from GH releases tagged e.g. 'v55-upstream' when building v55. The version of the binaries must match exactly the CEF version from the "cefpython/src/version/cef_version_linux.h" file (the CEF_VERSION constant).
Extract the archive in the build/ directory and rename the extracted directory to "cef_linux64/".
Build cefpython and run examples (xx.x is version number):
cd ../src/linux/ python compile.py xx.x
Below are platform specific requirements. Do these first before following instructions in the "All platforms" section that lists requirements common for all platforms.
git clone https://github.com/cztomczak/cefpython.git cd cefpython/ mkdir build/ cd build/
Download binaries and libraries from GH releases tagged eg. 'v55-upstream' when building v55. The version of the binaries must match exactly the CEF version from the "cefpython/src/version/" directory (look for CEF_VERSION constant in .h file).
Extract the downloaded archive eg. "cef55_3.2883.1553.g80bd606_win32.zip" in the "build/" directory (using "extract here" option)
Run the build.py tool (xx.x is version number):
python ../tools/build.py xx.x
git clone https://github.com/cztomczak/cefpython.git cd cefpython/ mkdir build/ cd build/
Download CEF binaries from Spotify Automated Builds. The version of the binaries must match exactly the CEF version from the "cefpython/src/version/" directory (look for CEF_VERSION constant in .h file).
Extract the downloaded archive eg. "cef_binary_3.2883.1553.g80bd606_windows32.tar.bz2" in the build/ directory (using "extract here" option)
Run the automate.py tool. After it completes you should see a new directory eg. "cef55_3.2883.1553.g80bd606_win32/".
python ../tools/automate.py --prebuilt-cef
python ../tools/build.py xx.x
Building CEF from sources is a very long process that can take several hours depending on your CPU speed and the platform you're building on. To speed up the process you can pass the --fast-build flag, however in such case result binaries won't be optimized. You can optionally set how many parallel ninja jobs to run (by default cores/2) with the --ninja-jobs flag passed to automate.py.
To build CEF from sources run the automate.py tool using the --build-cef flag. The automate script will use version information from the "cefpython/src/version/" directory. If you would like to use a custom CEF branch then use the --cef-branch flag, but note that this is only for advanced users as this will require updating cefpython's C++/Cython code.
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 options.
Remember to always upgrade packages listed in Requirements section each time you update to newer CEF.
On Linux if there are errors about missing packages or others, then see solutions in the Possible errors section.
The commands below will build CEF from sources with custom CEF Python patches applied and then build the CEF Python package. "xx.x" is version number and "ninja-jobs 4" means to run 4 parallel jobs for compiling, increase it if you have more CPU cores and want things to build faster:
git clone https://github.com/cztomczak/cefpython.git cd cefpython/ mkdir build/ cd build/ python ../tools/automate.py --build-cef --ninja-jobs 4 python ../tools/build.py xx.x
The automate.py tool should create eg. "cef55_3.2883.1553.g80bd606_win32/" directory when it's done. Then the build.py tool will build the cefpython module, make installer package, install the package and run unit tests and examples. See the notes for commands for creating package installer and/or wheel package for distribution.
Debug_GN_arm/ configuration error (Linux): Even though building on Linux for Linux, Chromium still runs ARM configuration files. If there is an error showing that pkg-config fails with GTK 3 library then see solution in the third post in this topic on CEF Forum: Debug_GN_arm error when building on Linux, not arm.
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-chromeos-fonts --no-nacl --no-arm
After dependencies are satisifed re-run automate.py.
CEF Python official binaries come with custom CEF binaries with a few patches applied for our use case, see the Notes section further down on this page.
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.
There are two sites that provide automated CEF builds:
If you would like to update CEF version in cefpython then see complete instructions provided in Issue #264.
When building for multiple Python versions on Linux/Mac use pyenv to manage multiple Python installations, see Issue #249 for details.
Command for making installer package is (xx.x is version number):
cd cefpython/build/ python ../tools/make_installer.py xx.x
To create a wheel package type:
cd cefpython/build/ python ../tools/make_installer.py xx.xx --wheel --universal cd cefpython3_*/dist/ ls
Additional flags when using --wheel flag:
CEF Python binaries are build using similar configuration as described on the "Automated Build Setup" wiki page in upstream CEF. The automate.py tool incorporates most of of the flags from these configurations.
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 ceftests
Official CEF Python binaries may come with additional patches applied to CEF/Chromium depending on platform. These patches can be found in the "cefpython/patches/" directory. Whether you need these patches depends on your use case, they may not be required and thus you could use the Spotify Automated Builds. Spotify builds have the issue73 patch (no tcmalloc) applied.
Currently (February 2017) only Linux releases have the custom patches applied. Windows and Mac releases use CEF binaries from Spotify Automated Builds.
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 and ignore git index:
patch -p0 < issue251.patch
Apply a patch in current directory and do not ignore git index:
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
| Back | FazBrowse Home | New Git URL |