Skip to content

Commit

Permalink
Feed cefpythonapp before cef/cef_dll_wrapper to the linker (#230)...
Browse files Browse the repository at this point in the history
Update automate.py - disable NACL and use sysroot, as per instructions
in cef/AutomatedBuildSetup.md.

Disable sandboxing for the subprocesses.

Update build-instructions for Linux.
  • Loading branch information
cztomczak committed Jun 26, 2016
1 parent bc3b9aa commit 03e9515
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 28 deletions.
15 changes: 1 addition & 14 deletions docs/Build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,7 @@ __Linux__

* Install packages: `sudo apt-get install cmake g++`
* If building CEF from sources:
* Download and install cmake 2.8.12 or later (unless you already have a
proper version, check with cmake --version):
```
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
```
* Official binaries are build on Ubuntu 14.04 (cmake 2.8.12, g++ 4.8.4)
* Download [ninja](http://martine.github.io/ninja/) 1.7.1 or later
and copy it to /usr/bin and chmod 755.
* When building CEF from sources you will need to install many more packages
Expand All @@ -72,8 +61,6 @@ proper version, check with cmake --version):
* See also the Linux configuration for CEF automated
builds on the [cef/AutomatedBuildSetup.md](https://bitbucket.org/chromiumembedded/cef/wiki/AutomatedBuildSetup.md#markdown-header-linux-configuration)
wiki page.
* Building on Ubuntu 12.04 is supported up to branch 2526 (Chrome 47).
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),
Expand Down
5 changes: 3 additions & 2 deletions src/cefpython.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,8 @@ def Initialize(applicationSettings=None, commandLineSwitches=None):
if not "single_process" in applicationSettings:
applicationSettings["single_process"] = False

cdef CefRefPtr[CefApp] cefApp
cdef CefRefPtr[CefApp] cefApp = <CefRefPtr[CefApp]?>new CefPythonApp()

cefApp = <CefRefPtr[CefApp]?>new CefPythonApp()
IF UNAME_SYSNAME == "Windows":
cdef HINSTANCE hInstance = GetModuleHandle(NULL)
cdef CefMainArgs cefMainArgs = CefMainArgs(hInstance)
Expand All @@ -598,6 +597,8 @@ def Initialize(applicationSettings=None, commandLineSwitches=None):
g_applicationSettings[key] = copy.deepcopy(applicationSettings[key])

cdef CefSettings cefApplicationSettings
# No sandboxing for the subprocesses
cefApplicationSettings.no_sandbox = 1
SetApplicationSettings(applicationSettings, &cefApplicationSettings)

if commandLineSwitches:
Expand Down
1 change: 1 addition & 0 deletions src/cython_includes/cef_types.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ cdef extern from "include/internal/cef_types.h":
int persist_user_preferences
cef_string_t user_data_path
int windowless_rendering_enabled
int no_sandbox

ctypedef struct CefBrowserSettings:
cef_string_t accept_language_list
Expand Down
10 changes: 7 additions & 3 deletions src/linux/setup/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,22 @@ def CompileTimeConstants():

# http_authentication not implemented on Linux.
library_dirs=[
r'./../binaries_%s' % BITS,
r'./lib_%s' % BITS,
r'./../../client_handler/',
r'./../../subprocess/', # libcefpythonapp
r'./../../cpp_utils/'
],

libraries=[
'cef_dll_wrapper',
# 'v8function_handler',
'client_handler',
# Feed cefpythonapp before cef/cef_dll_wrapper to the linker,
# otherwise an "undefined symbol" error may occur when importing
# the cefpython .so module (Issue #230).
'cefpythonapp',
'client_handler',
'cpp_utils',
'cef',
'cef_dll_wrapper',
'gtk-x11-2.0',
],

Expand Down
11 changes: 5 additions & 6 deletions src/subprocess/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ INC = -I./../ -I/usr/include/gtk-2.0 \
-I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include

ifeq ($(UNAME_S), Linux)
LIB = -L./../linux/setup/lib_64bit -L./../linux/setup/lib_32bit \
-L./../linux/binaries_64bit -L./../linux/binaries_32bit
LIB = -L./../linux/binaries_64bit -L./../linux/binaries_32bit \
-L./../linux/setup/lib_64bit -L./../linux/setup/lib_32bit
else ifeq ($(UNAME_S), Darwin)
LIB = -L./../mac/setup/lib_64bit -L./../mac/setup/lib_32bit \
-L./../mac/binaries_64bit/ \
-L./../mac/binaries_32bit/
LIB = -L./../mac/binaries_64bit/ -L./../mac/binaries_32bit/ \
-L./../mac/setup/lib_64bit -L./../mac/setup/lib_32bit
endif

CCFLAGS = -g -Wall -Werror -DRENDERER_PROCESS $(CEF_CCFLAGS)
Expand All @@ -31,4 +30,4 @@ subprocess:
# -fPIC is required only for libraries included by Cython.
g++ $(CCFLAGS) $(INC) $(LIB) main.cpp cefpython_app.cpp \
v8function_handler.cpp v8utils.cpp javascript_callback.cpp \
-lcef_dll_wrapper -lcef -o subprocess -Wl,-rpath,.
-lcef -lcef_dll_wrapper -o subprocess -Wl,-rpath,.
7 changes: 4 additions & 3 deletions tools/automate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) 2016 CEF Python, see the Authors file. All rights reserved.

# TODO: add GYP_DEFINES: disable_nacl=1 use_sysroot=1 (AutomatedBuildSetup)
# TODO: run automate-git.py using Python 2.7 from depot_tools

"""Build CEF Python and use prebuilt CEF binaries or build CEF from sources.
Expand Down Expand Up @@ -447,8 +446,10 @@ def getenv():
env["GYP_GENERATORS"] = Options.gyp_generators
if platform.system() == "Windows":
env["GYP_MSVS_VERSION"] = Options.gyp_msvs_version
# Issue73 patch applied
env["GYP_DEFINES"] = "use_allocator=none"
# See cef/AutomatedBuildSetup.md for reference.
# Issue73 patch applied with "use_allocator=none"
# TODO: 32-bit gyp defines: host_arch=x86_64 target_arch=ia32
env["GYP_DEFINES"] = "disable_nacl=1 use_sysroot=1 use_allocator=none"
# To perform an official build set GYP_DEFINES=buildtype=Official.
# This will disable debugging code and enable additional link-time
# optimizations in Release builds.
Expand Down

0 comments on commit 03e9515

Please sign in to comment.