Skip to content

Commit 2f157af

Browse files
committed
Update build instructions and add a new patch for Linux...
Add patch for CMakeLists.txt.in for Ubuntu 12 compile errors. Update patches.
1 parent 6e0dd2a commit 2f157af

File tree

7 files changed

+256
-91
lines changed

7 files changed

+256
-91
lines changed

docs/Build-instructions.md

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Table of contents:
1515
* [Build CEF Python using prebuilt CEF binaries](#build-cefpython-using-prebuilt-cef-binaries)
1616
* [Build both CEF Python and CEF from sources](#build-both-cefpython-and-cef-from-sources)
1717
* [Build CEF manually](#build-cef-manually)
18+
* [CEF automated builds](#cef-automated-builds)
1819
* [How to patch](#how-to-patch)
19-
* [Ninja build slows down computer](#ninja-build-slows-down-computer)
2020

2121

2222
## Requirements
@@ -50,9 +50,18 @@ __Windows__
5050

5151
__Linux__
5252

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

@@ -78,32 +88,42 @@ __All platforms__
7888

7989
## Build CEF Python using prebuilt CEF binaries
8090

81-
Run the automate.py tool using the --prebuilt-cef flag:
91+
Prebuilt binaries are available on
92+
[GitHub Releases](https://github.com/cztomczak/cefpython/releases)
93+
tagged 'cefXX'.
94+
95+
Run the automate.py tool using the --prebuilt-cef flag that will download
96+
prebuilt binaries from GitHub Releases using version information from
97+
src/version/.
98+
99+
__NOTE__: The --prebuilt-cef flag is not implemented yet - you need to
100+
download manually from GitHub Releases and put files to
101+
cefpython/build/linux64/ (rename cef47_xxx_linux64/ to linux64/).
82102
```
83103
cd tools/
84104
python automate.py --prebuilt-cef
85105
```
86106

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

90110

91111
## Build both CEF Python and CEF from sources
92112

93113
Run the automate.py tool using the --build-cef flag. Specify cef branch
94114
and optionally how many parallel ninja jobs to run (by default cores/2).
115+
If building on Linux see the Important note futher down.
95116

96117
```
97118
cd tools/
98119
python automate.py --build-cef --cef-branch 2526 --ninja-jobs 6
99120
```
100121

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

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

114134
After dependencies are satisifed re-run automate.py.
115135

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

119139

@@ -137,6 +157,28 @@ Note that CEF patches must be applied in the "download_dir/chromium/src/cef/"
137157
directory, not in the "download_dir/cef/" directory.
138158

139159

160+
## CEF automated builds
161+
162+
There are two sites that provide latest builds of CEF:
163+
* Spotify - http://opensource.spotify.com/cefbuilds/index.html
164+
* This is a new build system
165+
* Since 07/06/2016 all builds are without tcmalloc, see
166+
[cefpython/#76](https://github.com/cztomczak/cefpython/issues/73)
167+
and [cef/#1827](https://bitbucket.org/chromiumembedded/cef/issues/1827)
168+
* Adobe - https://cefbuilds.com/
169+
* This is an old build system. It probably still builds with tcmalloc
170+
(see above)
171+
172+
Official CEF Python binaries come with additional patches to CEF/Chromium,
173+
see the [patches/](../../../tree/master/patches) directory. Whether you
174+
need these patches depends on your use case, they may not be required
175+
and thus you could use the Spotify binaries. As of this writing there are
176+
three patches:
177+
* issue73 patch - tcmalloc issues, Spotify builds already apply it
178+
* issue125 patch - for https cache problems when using private certificates
179+
* issue218 patch - not required when running GTK or Kivy examples
180+
181+
140182
## How to patch
141183

142184
Create a patch from unstaged changes in current directory:
@@ -150,13 +192,3 @@ Apply a patch in current directory:
150192
cd chromium/src/cef/
151193
git apply cef.gyp.patch
152194
```
153-
154-
155-
## Ninja build slows down computer
156-
157-
If ninja slows down your computer too much (6 parallel jobs by default),
158-
build manually with this command (where -j2 means to run 2 jobs in parallel):
159-
```
160-
cd chromium/src
161-
ninja -v -j2 -Cout\Release cefclient
162-
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git CMakeLists.txt.in CMakeLists.txt.in
2+
index 54d6c2d..7d9f923 100644
3+
--- CMakeLists.txt.in
4+
+++ CMakeLists.txt.in
5+
@@ -204,7 +204,7 @@ if(OS_LINUX)
6+
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
7+
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
8+
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
9+
- set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wsign-compare")
10+
+ set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare")
11+
# -O0 = Disable optimizations
12+
# -g = Generate debug information
13+
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
14+
@@ -237,18 +237,6 @@ if(OS_LINUX)
15+
set(CEF_C_COMPILER_FLAGS "${CEF_C_COMPILER_FLAGS} -Wno-unused-local-typedefs")
16+
endif()
17+
18+
- # -Wno-literal-suffix = Don't warn about invalid suffixes on literals
19+
- CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
20+
- if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
21+
- set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-literal-suffix")
22+
- endif()
23+
-
24+
- # -Wno-narrowing = Don't warn about type narrowing
25+
- CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
26+
- if(COMPILER_SUPPORTS_NO_NARROWING)
27+
- set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-narrowing")
28+
- endif()
29+
-
30+
if(PROJECT_ARCH STREQUAL "x86_64")
31+
# 64-bit architecture.
32+
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -m64 -march=x86-64")
33+
@@ -333,7 +321,7 @@ if(OS_MACOSX)
34+
# -O3 = Optimize for maximum speed plus a few extras
35+
set(CEF_COMPILER_FLAGS_RELEASE "-O3")
36+
# -Wl,-search_paths_first = Search for static or shared library versions in the same pass
37+
- # -Wl,-ObjC = Support creation of creation of ObjC static libraries
38+
+ # -Wl,-ObjC = Support creation of creation of ObjC static libraries
39+
# -Wl,-pie = Generate position-independent code suitable for executables only
40+
set(CEF_LINKER_FLAGS "-Wl,-search_paths_first -Wl,-ObjC -Wl,-pie")
41+
# -Wl,-dead_strip = Strip dead code

patches/issue125_win_mac_linux

Lines changed: 0 additions & 5 deletions
This file was deleted.

patches/issue73_linux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Patch to CEF. Fixes tcmalloc issue on Linux:
22
https://github.com/cztomczak/cefpython/issues/73
33

44
Copy the "include.gypi" file to the ~/.gyp/ directory.
5+
The automate.py script applies this patch by setting GYP_DEFINES env var.

patches/patch.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@
99
"linux" if platform.system() == "Linux" else
1010
"mac" if platform.system() == "Darwin" else "unknown")
1111

12+
# ALL PLATFORMS
1213
patches.append(
1314
{
14-
# Fixes HTTPS cache problems on sites with certificate errors
15-
'name': 'issue125_win_mac_linux',
15+
# Fixes HTTPS cache problems with private certificates
16+
'name': 'issue125',
1617
'path': '../net/http/',
1718
},
1819
)
20+
21+
# LINUX
22+
if OS_POSTFIX == "linux":
23+
patches.append(
24+
{
25+
# Fix compile error on Ubuntu 12:
26+
# cc1plus: error: unrecognized command line option '-std=gnu++11'
27+
'name': 'CMakeLists.txt.in_linux',
28+
'path': './',
29+
},
30+
)

0 commit comments

Comments
 (0)