linux:chromium:cef

文書の過去の版を表示しています。


Chromium Embedded Framework

Chromium Embedded Framework(CEF)は、Chromiumベースのブラウザを他のアプリケーションに埋め込むための単純なフレームワークである。

chromiumembedded / cef — Bitbucket の Binary Distributions - CEF Automated Builds より cef_binary_3.3626.1886.g162fdec_linux64.tar.bz2(フレームワークのバイナリディストリビューション)をダウンロードする。

クロスプラットフォームのオープンソースビルドシステム CMake をインストールする。バージョン2.8.12.1以降が必要。

$ sudo dnf install cmake

Python をインストールする。バージョン 2.x が必要。

$ sudo dnf install python3

プラットフォーム固有のビルドツールをインストールする。

$ sudo dnf groupinstall "Development Tools"
$ sudo dnf install gcc-c++ gtk2-devel gtkglext-devel

ダウンロードページから、Git コマンドラインツールを使用して、cef-project のソースコードをダウンロードする。

$ git clone https://bitbucket.org/chromiumembedded/cef-project.git

Chromium Embedded Framework (CEF) のバイナリディストリビューションを解凍する。

$ tar jxvf cef_binary_3.3626.1886.g162fdec_linux64.tar.bz2

Makefile を生成する。

$ cd cef_binary_3.3626.1886.g162fdec_linux64
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:187 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable CEF_ROOT is set to:

    /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS
-- Performing Test COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS - Success
-- Performing Test COMPILER_SUPPORTS_NO_LITERAL_SUFFIX
-- Performing Test COMPILER_SUPPORTS_NO_LITERAL_SUFFIX - Success
-- Performing Test COMPILER_SUPPORTS_NO_NARROWING
-- Performing Test COMPILER_SUPPORTS_NO_NARROWING - Success
-- *** CEF CONFIGURATION SETTINGS ***
-- Generator:                    Unix Makefiles
-- Platform:                     Linux
-- Project architecture:         x86_64
-- Build type:                   Debug
-- Binary distribution root:     /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64
-- CEF sandbox:                  ON
-- Standard libraries:           X11
-- Compile defines:              __STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;_FILE_OFFSET_BITS=64;CEF_USE_SANDBOX
-- Compile defines (Debug):      
-- Compile defines (Release):    NDEBUG
-- C compile flags:              -fno-strict-aliasing;-fPIC;-fstack-protector;-funwind-tables;-fvisibility=hidden;--param=ssp-buffer-size=4;-pipe;-pthread;-Wall;-Werror;-Wno-missing-field-initializers;-Wno-unused-parameter;-Wno-error=comment;-Wno-comment;-m64;-march=x86-64 -std=c99;-Wno-unused-local-typedefs
-- C compile flags (Debug):      -O0;-g 
-- C compile flags (Release):    -O2;-fdata-sections;-ffunction-sections;-fno-ident;-U_FORTIFY_SOURCE;-D_FORTIFY_SOURCE=2 
-- C++ compile flags:            -fno-strict-aliasing;-fPIC;-fstack-protector;-funwind-tables;-fvisibility=hidden;--param=ssp-buffer-size=4;-pipe;-pthread;-Wall;-Werror;-Wno-missing-field-initializers;-Wno-unused-parameter;-Wno-error=comment;-Wno-comment;-m64;-march=x86-64 -fno-exceptions;-fno-rtti;-fno-threadsafe-statics;-fvisibility-inlines-hidden;-std=gnu++11;-Wsign-compare;-Wno-literal-suffix;-Wno-narrowing
-- C++ compile flags (Debug):    -O0;-g 
-- C++ compile flags (Release):  -O2;-fdata-sections;-ffunction-sections;-fno-ident;-U_FORTIFY_SOURCE;-D_FORTIFY_SOURCE=2 
-- Exe link flags:               -fPIC;-pthread;-Wl,--disable-new-dtags;-Wl,--fatal-warnings;-Wl,-rpath,.;-Wl,-z,noexecstack;-Wl,-z,now;-Wl,-z,relro;-m64 
-- Exe link flags (Debug):        
-- Exe link flags (Release):     -Wl,-O1;-Wl,--as-needed;-Wl,--gc-sections 
-- Shared link flags:            -fPIC;-pthread;-Wl,--disable-new-dtags;-Wl,--fatal-warnings;-Wl,-rpath,.;-Wl,-z,noexecstack;-Wl,-z,now;-Wl,-z,relro;-m64 
-- Shared link flags (Debug):     
-- Shared link flags (Release):  -Wl,-O1;-Wl,--as-needed;-Wl,--gc-sections 
-- CEF Binary files:             chrome-sandbox;libcef.so;libEGL.so;libGLESv2.so;natives_blob.bin;snapshot_blob.bin;v8_context_snapshot.bin;swiftshader
-- CEF Resource files:           cef.pak;cef_100_percent.pak;cef_200_percent.pak;cef_extensions.pak;devtools_resources.pak;icudtl.dat;locales
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64

CEF をビルドする。

$ make
In file included from /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/value_ctocpp.h:25,
                 from /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/cpptoc/accessibility_handler_cpptoc.cc:16:
/home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/ctocpp_ref_counted.h:78:27: エラー: ‘cfi-icall’ attribute directive ignored [-Werror=attributes]
   void UnderlyingAddRef() const {
                           ^~~~~
/home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/ctocpp_ref_counted.h:86:28: エラー: ‘cfi-icall’ attribute directive ignored [-Werror=attributes]
   bool UnderlyingRelease() const {
                            ^~~~~
/home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/ctocpp_ref_counted.h:95:30: エラー: ‘cfi-icall’ attribute directive ignored [-Werror=attributes]
   bool UnderlyingHasOneRef() const {
                              ^~~~~
/home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/ctocpp_ref_counted.h:104:37: エラー: ‘cfi-icall’ attribute directive ignored [-Werror=attributes]
   bool UnderlyingHasAtLeastOneRef() const {
                                     ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/build.make:219: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/cpptoc/accessibility_handler_cpptoc.cc.o] エラー 1
make[1]: *** [CMakeFiles/Makefile2:91: libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/all] エラー 2
make: *** [Makefile:84: all] エラー 2

ビルドエラーが発生してコンパイルが停止してしまった。
CEF Forum • Building new version fails with attribute directive ignored に同じケースのエラーの対処が載っていたので、それを参考に cmake/cef_variables.cmake を修正する。

$ vi cmake/cef_variables.cmake
cmake/cef_variables.cmake
#
# Linux configuration.
#
 
if(OS_LINUX)
  # Platform-specific compiler/linker flags.
  set(CEF_LIBTYPE SHARED)
  list(APPEND CEF_COMPILER_FLAGS
    -fno-strict-aliasing            # Avoid assumptions regarding non-aliasing of objects of different types
    -fPIC                           # Generate position-independent code for shared libraries
    -fstack-protector               # Protect some vulnerable functions from stack-smashing (security feature)
    -funwind-tables                 # Support stack unwinding for backtrace()
    -fvisibility=hidden             # Give hidden visibility to declarations that are not explicitly marked as visible
    --param=ssp-buffer-size=4       # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
    -pipe                           # Use pipes rather than temporary files for communication between build stages
    -pthread                        # Use the pthread library
    -Wall                           # Enable all warnings
#    -Werror                         # Treat warnings as errors
    -Wno-missing-field-initializers # Don't warn about missing field initializers
    -Wno-unused-parameter           # Don't warn about unused parameters
    -Wno-error=comment              # Don't warn about code in comments
    -Wno-comment                    # Don't warn about code in comments
    )

-Werrorコンパイラオプションを無効にする。

再度 CEF をビルドする。

$ make
tocpp/value_ctocpp.h:25,
                 from /home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/cpptoc/accessibility_handler_cpptoc.cc:16:
/home/tomoyan/my_projects/cef_binary_3.3626.1886.g162fdec_linux64/libcef_dll/ctocpp/ctocpp_ref_counted.h:78:27: 警告: ‘cfi-icall’ attribute directive ignored [-Wattributes]
   void UnderlyingAddRef() const {
                           ^~~~~

警告: ‘cfi-icall’ attribute directive ignored [-Wattributes] 警告は出るがコンパイルは通る様になった。

  • linux/chromium/cef.1550065255.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)