Skip to content

Commit

Permalink
Update build instructions and add a new patch for Linux...
Browse files Browse the repository at this point in the history
Add patch for CMakeLists.txt.in for Ubuntu 12 compile errors.
Update patches.
  • Loading branch information
cztomczak committed Jun 22, 2016
1 parent 6e0dd2a commit 2f157af
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 91 deletions.
72 changes: 52 additions & 20 deletions docs/Build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Table of contents:
* [Build CEF Python using prebuilt CEF binaries](#build-cefpython-using-prebuilt-cef-binaries)
* [Build both CEF Python and CEF from sources](#build-both-cefpython-and-cef-from-sources)
* [Build CEF manually](#build-cef-manually)
* [CEF automated builds](#cef-automated-builds)
* [How to patch](#how-to-patch)
* [Ninja build slows down computer](#ninja-build-slows-down-computer)


## Requirements
Expand Down Expand Up @@ -50,9 +50,18 @@ __Windows__

__Linux__

* Install required packages using apt-get or similar:
* Install packages: cmake, g++ 4.6.3+, libgtkglext1-dev
* Download and install cmake 2.8.12 or later (unless you already have a
proper version, check with cmake --version):
```
sudo apt-get install cmake g++ pkg-config gtk+-2.0 libgtkglext1-dev
cd build/
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
tar xzf cmake-2.8.12.2.tar.gz
cd cmake-2.8.12.2
./configure
make
sudo make install
# restart terminal, so that new cmake is used
```
* Download [ninja](http://martine.github.io/ninja/) 1.7.1 or later
and copy it to /usr/bin and chmod 755.
Expand All @@ -63,7 +72,8 @@ sudo apt-get install cmake g++ pkg-config gtk+-2.0 libgtkglext1-dev
For branches 2623 (Chrome 49) or later Ubuntu 14.04+ is required.
* To build on Debian 7 see
[cef/BuildingOnDebian7.md](https://bitbucket.org/chromiumembedded/cef/wiki/BuildingOnDebian7.md) and
[cef/#1575](https://bitbucket.org/chromiumembedded/cef/issues/1575)
[cef/#1575](https://bitbucket.org/chromiumembedded/cef/issues/1575),
and [cef/#1697](https://bitbucket.org/chromiumembedded/cef/issues/1697)
* To perform a 32-bit Linux build on a 64-bit Linux system see
[cef/#1804](https://bitbucket.org/chromiumembedded/cef/issues/1804)

Expand All @@ -78,32 +88,42 @@ __All platforms__

## Build CEF Python using prebuilt CEF binaries

Run the automate.py tool using the --prebuilt-cef flag:
Prebuilt binaries are available on
[GitHub Releases](https://github.com/cztomczak/cefpython/releases)
tagged 'cefXX'.

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

__NOTE__: The --prebuilt-cef flag is not implemented yet - you need to
download manually from GitHub Releases and put files to
cefpython/build/linux64/ (rename cef47_xxx_linux64/ to linux64/).
```
cd tools/
python automate.py --prebuilt-cef
```

You should be fine by running it with the default options, but if you
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. Specify cef branch
and optionally how many parallel ninja jobs to run (by default cores/2).
If building on Linux see the Important note futher down.

```
cd tools/
python automate.py --build-cef --cef-branch 2526 --ninja-jobs 6
```

__IMPORTANT__: On Linux it will fail on first run. After the chromium
__IMPORTANT NOTE (Linux)__: On Linux it will fail on first run. After the chromium
sources are downloaded, it will try to build cef projects and fail
due to missing packages. You will need to run the install-build-deps.sh
script (intended for Ubuntu systems). When the "ttf-mscorefonts-installer"
graphical installer pops up you can deny EULA and not install these fonts
(might deteriorate UX on some systems, experienced on Ubuntu 12.04 32-bit).
graphical installer pops up don't install it - deny EULA.

```
cd build/chromium/src/build/
Expand All @@ -113,7 +133,7 @@ sudo ./install-build-deps.sh --no-arm --no-chromeos-fonts --no-nacl

After dependencies are satisifed re-run automate.py.

You should be fine by running it with the default options, but if you
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.


Expand All @@ -137,6 +157,28 @@ 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:
* Spotify - http://opensource.spotify.com/cefbuilds/index.html
* This is a new build system
* Since 07/06/2016 all builds are without tcmalloc, see
[cefpython/#76](https://github.com/cztomczak/cefpython/issues/73)
and [cef/#1827](https://bitbucket.org/chromiumembedded/cef/issues/1827)
* Adobe - https://cefbuilds.com/
* This is an old build system. It probably still builds with tcmalloc
(see above)

Official CEF Python binaries come with additional patches to CEF/Chromium,
see the [patches/](../../../tree/master/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. As of this writing there are
three patches:
* issue73 patch - tcmalloc issues, Spotify builds already apply it
* issue125 patch - for https cache problems when using private certificates
* issue218 patch - not required when running GTK or Kivy examples


## How to patch

Create a patch from unstaged changes in current directory:
Expand All @@ -150,13 +192,3 @@ Apply a patch in current directory:
cd chromium/src/cef/
git apply cef.gyp.patch
```


## Ninja build slows down computer

If ninja slows down your computer too much (6 parallel jobs by default),
build manually with this command (where -j2 means to run 2 jobs in parallel):
```
cd chromium/src
ninja -v -j2 -Cout\Release cefclient
```
41 changes: 41 additions & 0 deletions patches/CMakeLists.txt.in_linux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git CMakeLists.txt.in CMakeLists.txt.in
index 54d6c2d..7d9f923 100644
--- CMakeLists.txt.in
+++ CMakeLists.txt.in
@@ -204,7 +204,7 @@ if(OS_LINUX)
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
- set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wsign-compare")
+ set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare")
# -O0 = Disable optimizations
# -g = Generate debug information
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
@@ -237,18 +237,6 @@ if(OS_LINUX)
set(CEF_C_COMPILER_FLAGS "${CEF_C_COMPILER_FLAGS} -Wno-unused-local-typedefs")
endif()

- # -Wno-literal-suffix = Don't warn about invalid suffixes on literals
- CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
- if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
- set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-literal-suffix")
- endif()
-
- # -Wno-narrowing = Don't warn about type narrowing
- CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
- if(COMPILER_SUPPORTS_NO_NARROWING)
- set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-narrowing")
- endif()
-
if(PROJECT_ARCH STREQUAL "x86_64")
# 64-bit architecture.
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -m64 -march=x86-64")
@@ -333,7 +321,7 @@ if(OS_MACOSX)
# -O3 = Optimize for maximum speed plus a few extras
set(CEF_COMPILER_FLAGS_RELEASE "-O3")
# -Wl,-search_paths_first = Search for static or shared library versions in the same pass
- # -Wl,-ObjC = Support creation of creation of ObjC static libraries
+ # -Wl,-ObjC = Support creation of creation of ObjC static libraries
# -Wl,-pie = Generate position-independent code suitable for executables only
set(CEF_LINKER_FLAGS "-Wl,-search_paths_first -Wl,-ObjC -Wl,-pie")
# -Wl,-dead_strip = Strip dead code
File renamed without changes.
5 changes: 0 additions & 5 deletions patches/issue125_win_mac_linux

This file was deleted.

1 change: 1 addition & 0 deletions patches/issue73_linux
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Patch to CEF. Fixes tcmalloc issue on Linux:
https://github.com/cztomczak/cefpython/issues/73

Copy the "include.gypi" file to the ~/.gyp/ directory.
The automate.py script applies this patch by setting GYP_DEFINES env var.
16 changes: 14 additions & 2 deletions patches/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
"linux" if platform.system() == "Linux" else
"mac" if platform.system() == "Darwin" else "unknown")

# ALL PLATFORMS
patches.append(
{
# Fixes HTTPS cache problems on sites with certificate errors
'name': 'issue125_win_mac_linux',
# Fixes HTTPS cache problems with private certificates
'name': 'issue125',
'path': '../net/http/',
},
)

# LINUX
if OS_POSTFIX == "linux":
patches.append(
{
# Fix compile error on Ubuntu 12:
# cc1plus: error: unrecognized command line option '-std=gnu++11'
'name': 'CMakeLists.txt.in_linux',
'path': './',
},
)
Loading

0 comments on commit 2f157af

Please sign in to comment.