You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are issues running cefpython when using Python.org binaries (the .pkg installer) for Mac, the CEF browser loads, but the window is blank. This issue was originally reported on the Forum in this topic. It might be caused (this still needs to be investigated further and confirmed) because these binaries are built with gcc 4.2 and cefpython module is built with clang and links against stdlib libc++. The solution might be to build the cefpython module with gcc compiler instead of clang/libc++. The required modifications would need to be done in the build.py and cython_setup.py tools.
In build.py here:
# Compile against libc++ otherwise error "symbol not found"
# with cef::logging::LogMessage symbol. Also include -lc++
# and -lc++abi libraries.
os.environ["CEF_CCFLAGS"] += " -stdlib=libc++"
# See compile/link flags in upstream cefclient
os.environ["CEF_CCFLAGS"] += (
" -fno-strict-aliasing"
" -fno-rtti"
" -fno-threadsafe-statics"
" -fobjc-call-cxx-cdtors"
" -fvisibility=hidden"
" -fvisibility-inlines-hidden"
)
os.environ["CEF_LINK_FLAGS"] += (
" -lc++"
" -lc++abi"
" -Wl,-search_paths_first"
" -Wl,-ObjC"
" -Wl,-pie"
" -Wl,-dead_strip"
)
# Compile against libc++ otherwise error "symbol not found"
In cython_setup.py here:
extra_compile_args.extend([
# Compile against libc++ otherwise error "symbol not found"
# with cef::logging::LogMessage symbol. Also include -lc++
# and -lc++abi libraries.
"-stdlib=libc++",
"-Wno-return-type-c-linkage",
"-Wno-constant-logical-operand",
])
See also this post on the Forum that explains the clang/libc++ linking in some more details:
There seem to be two signifcant differences between that I think might be the cause of the issue:
I think the issue might be caused because the cefpython module was built using clang and linked against libc++ and the Python.org package is built with an old version of gcc 4.2. It seems that Python.org package is built with gcc 4.2 compiler while system Python 2.7 is built with clang compiler. I've checked also Homebrew Python that works fine with cefpython and it seems that it is also built with clang compiler (it checks for ENV.compiler option). I think that Chromium/CEF can work with both gcc and clang compilers, however I've had problems with making it work with gcc compiler. So the cefpython module links against libc++. Since Chromium v56 the minimum OS supported is MacOS 10.9+. MacOS 10.9+ no longer uses GCC/libstdc++, but uses libc++ and Clang. So it is okay for cefpython to be built with clang and linked against libc++, as the minimum requirements for Chromium do support this (Mac OS 10.9+).
I wonder if the --enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk flag is causing any issue, but it's a little chance I think.
I think that the issue can be resolved if you build Python yourself. Download Python sources from Python.org and build it with the --enable-framework flag. Make sure that Python builds with clang. If you're using Mac OS 10.9 or higher that should be the default. The Python.org binaries that you've installed were built with gcc 4.2, so that it supports old OSes (Mac OS 10.6+).
I am not sure if anything can be done (and should) the cefpython side. It is how things work on Mac. They replaced the default compiler to clang/libc++ on Mac OS 10.9. And Mac OS 10.9 is the minimum requirement for cefpython/CEF/Chromium. The minimum supported version of gcc supported by Chromium is gcc 4.8+.
CEF Python works fine on these Python configurations
CEF Python works fine when running system Python on Mac (the preinstalled Python on a fresh Mac OS).
CEF Python also works fine running Python 3 installed with the Homebrew package manager.
CEF Python should also run fine with Python built using Python.org sources on Mac OS 10.9+ when built using clang compiler and the --enable-framework flag.
To build with gcc the error "symbol not found" with cef::logging::LogMessage symbol needs to be resolved. Related issue for this error: Issue #230 ("Error when importing the CEF Python 47 module: undefined symbol: cef::logging::LogMessage").
The issue is caused when including the src/include/base/cef_logging.h header file. A possible solution for this "symbol not found" error might be to create cef_logging.cpp in "src/client_handler/" directory and include it when building/linking the cefpython module, so that no required symbols are stripped during compile/link operations.
cztomczak
changed the title
Mac: Make cefpython work with the Python.org .pkg installer
[Mac] Make cefpython work with the Python.org pkg installer
Aug 23, 2017
There are issues running cefpython when using Python.org binaries (the .pkg installer) for Mac, the CEF browser loads, but the window is blank. This issue was originally reported on the Forum in this topic. It might be caused (this still needs to be investigated further and confirmed) because these binaries are built with gcc 4.2 and cefpython module is built with clang and links against stdlib libc++. The solution might be to build the cefpython module with gcc compiler instead of clang/libc++. The required modifications would need to be done in the build.py and cython_setup.py tools.
In build.py here:
Ref:
cefpython/tools/build.py
Line 292 in 62fffaf
In cython_setup.py here:
Ref:
cefpython/tools/cython_setup.py
Line 206 in 824d7ce
See also this post on the Forum that explains the clang/libc++ linking in some more details:
Ref: https://groups.google.com/d/msg/cefpython/NxqAmhuSQPM/KIBJ4pvAAgAJ
CEF Python works fine on these Python configurations
Config flags for Python.org binaries 3.5.1
Config flags for system Python 2.7
Config flags for Homebrew Python
See https://github.com/Homebrew/homebrew-core/blob/master/Formula/python3.rb
The text was updated successfully, but these errors were encountered: