cef这个库 一般来说都是运行在windows下的 ,下面是我在linux编译的过程
链接是我的网盘链接地址 大家可以去下载cef
http://pan.baidu.com/s/1eSboi10
密码55qx
1.首先 安装cmake工具
cmake
出现错误 版本太低 更新cmake版本
./configure makemake install
如果上面安装出现了错误
运行下列命令
yum install gcc
yum install gcc-c++ 安装编译器
该版本默认配置到/usr/local/bin 下
cmake工具安装完成
2.cmake编译cef包
cmake CMakeList.txt
所以后面可能出现错误
-bash: /usr/bin/cmake: No such file or directory
后面知道这个问题是因为直接使用cmake系统回到默认的/usr/bin中去寻找,但是src中安装的cmake是在/usr/local/bin中
解决方法:
1、做一个链接即可:ln -s /usr/local/bin/cmake /usr/bin
2、直接使用/usr/local/bin/cmake进行编译。
1、做一个链接即可:ln -s /usr/local/bin/cmake /usr/bin
2、直接使用/usr/local/bin/cmake进行编译。
这样这个问题就解决了
3.编译出现的第二个错误 首先需要安装gtk包
yum install gtk3* 这样安装的包都是gtk-3.0版本的相关依赖
安装完成后需要继续编译
In file included from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/client_handler.h:16:0,from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/browser_window.h:11,from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/browser_window.cc:5:/home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/client_types.h:12:21: 致命错误:gtk/gtk.h:没有那个文件或目录#include <gtk/gtk.h>
出现了这个错误 证明你需要修改cmake文件了
打开
CMakeList.txt文件在注释的下面加上以下部分
# Include the libcef_dll_wrapper target.# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution# directory.add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)add_definitions(`pkg-config --libs --cflags gtk+-3.0`)add_definitions(-I /usr/include/gtk-3.0/unix-print)add_definitions(-I /usr/include/gtk-3.0)
这样编译后错误就会消失 继续make 你会发现下一个错误
[ 91%] Building CXX object cefclient/CMakeFiles/cefclient.dir/cefclient_gtk.cc.o/home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/cefclient_gtk.cc:6:23: 致命错误:gtk/gtkgl.h:没有那个文件或目录#include <gtk/gtkgl.h>
这是因为gtk的opengl库没有安装 需要下个包继续安装输入以下命令
用git版本下载到本地
git clone git://git.gnome.org/gtkglext
下载完后 继续编译
[root@localhost gtkglext]# lsAUTHORS gdk MAINTAINERSautogen.sh gdkglext.pc.in make-copyright.shChangeLog.pre-1-0 gdkglext-uninstalled.pc.in Makefile.amChangeLog.pre-1-2 gtk NEWSconfigure.ac gtkglext.doap READMECOPYING gtkglext.nsi.in README.win32COPYING.LIB gtkglext.pc.in setup-gtkglext.shdocs gtkglext-uninstalled.pc.in TODOexamples m4macros[root@localhost gtkglext]# ./autogen.shwhich: no gtkdocize in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/wangwe/.local/bin:/home/wangwe/bin)*** No GTK-Doc found, please install it ***[root@localhost gtkglext]#
运行autogen文件出现以下错误 需要安装gtk-doc
yum install gtk-doc
这样会将所有的依赖都安装上
继续运行 出现以下错误
[root@localhost gtkglext]# ./autogen.shI am going to run ./configure with no arguments - if you wishto pass any to it, please specify them on the ./autogen.sh command line.autoreconf: Entering directory `.'autoreconf: configure.ac: not using Gettextautoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}autoreconf: configure.ac: tracingautoreconf: running: libtoolize --copy --forcelibtoolize: putting auxiliary files in `.'.libtoolize: copying file `./ltmain.sh'libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4macros'.libtoolize: copying file `m4macros/libtool.m4'libtoolize: copying file `m4macros/ltoptions.m4'libtoolize: copying file `m4macros/ltsugar.m4'libtoolize: copying file `m4macros/ltversion.m4'libtoolize: copying file `m4macros/lt~obsolete.m4'autoreconf: running: /usr/bin/autoconf --forceautoreconf: running: /usr/bin/autoheader --forceautoreconf: running: automake --add-missing --copy --force-missingconfigure.ac:62: installing './config.guess'configure.ac:62: installing './config.sub'configure.ac:55: installing './install-sh'configure.ac:55: installing './missing'Makefile.am: installing './INSTALL'examples/Makefile.am: installing './depcomp'gdk/Makefile.am:212: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONALgtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONALautoreconf: automake failed with exit status: 1[root@localhost gtkglext]#
这个错误找了好久 发现到了需要安装gobject-introspection这个包
3.安装gobject-introspection
git clone git://git.gnome.org/gobject-introspection
参考这个包的官网
https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection
下载好了 就安装 这个仍然是运行
[root@localhost gobject-introspection]# ./autogen.shautoreconf: Entering directory `.'autoreconf: configure.ac: not using Gettextautoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}autoreconf: configure.ac: tracingautoreconf: configure.ac: creating directory build-auxautoreconf: running: libtoolize --copy --forcelibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.libtoolize: copying file `build-aux/ltmain.sh'libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.libtoolize: copying file `m4/libtool.m4'libtoolize: copying file `m4/ltoptions.m4'libtoolize: copying file `m4/ltsugar.m4'libtoolize: copying file `m4/ltversion.m4'libtoolize: copying file `m4/lt~obsolete.m4'autoreconf: running: /usr/bin/autoconf --forceautoreconf: running: /usr/bin/autoheader --forceautoreconf: running: automake --add-missing --copy --force-missingconfigure.ac:43: installing 'build-aux/compile'configure.ac:30: installing 'build-aux/config.guess'configure.ac:30: installing 'build-aux/config.sub'configure.ac:20: installing 'build-aux/install-sh'configure.ac:20: installing 'build-aux/missing'Makefile.am: installing 'build-aux/depcomp'configure.ac: installing 'build-aux/ylwrap'Makefile-giscanner.am:28: installing 'build-aux/py-compile'Makefile.am:22: 'Makefile-giscanner.am' included from hereparallel-tests: installing 'build-aux/test-driver'autoreconf: Leaving directory `.'checking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /usr/bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether UID '0' is supported by ustar format... yeschecking whether GID '0' is supported by ustar format... yeschecking how to create a ustar tar archive... gnutarchecking whether to enable maintainer-specific portions of Makefiles... yeschecking whether make supports nested variables... (cached) yeschecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking for style of include used by make... GNUchecking dependency style of gcc... gcc3checking whether gcc and cc understand -c and -o together... yeschecking how to print strings... printfchecking for a sed that does not truncate output... /usr/bin/sedchecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking for fgrep... /usr/bin/grep -Fchecking for ld used by gcc... /usr/bin/ldchecking if the linker (/usr/bin/ld) is GNU ld... yeschecking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -Bchecking the name lister (/usr/bin/nm -B) interface... BSD nmchecking whether ln -s works... yeschecking the maximum length of command line arguments... 1572864checking whether the shell understands some XSI constructs... yeschecking whether the shell understands "+="... yeschecking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noopchecking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noopchecking for /usr/bin/ld option to reload object files... -rchecking for objdump... objdumpchecking how to recognize dependent libraries... pass_allchecking for dlltool... nochecking how to associate runtime and link libraries... printf %s\nchecking for ar... archecking for archiver @FILE support... @checking for strip... stripchecking for ranlib... ranlibchecking command to parse /usr/bin/nm -B output from gcc object... okchecking for sysroot... nochecking for mt... nochecking if : is a manifest tool... nochecking how to run the C preprocessor... gcc -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking for dlfcn.h... yeschecking for objdir... .libschecking if gcc supports -fno-rtti -fno-exceptions... nochecking for gcc option to produce PIC... -fPIC -DPICchecking if gcc PIC flag -fPIC -DPIC works... yeschecking if gcc static flag -static works... nochecking if gcc supports -c -o file.o... yeschecking if gcc supports -c -o file.o... (cached) yeschecking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yeschecking whether -lc should be explicitly linked in... nochecking dynamic linker characteristics... GNU/Linux ld.sochecking how to hardcode library paths into programs... immediatechecking whether stripping libraries is possible... yeschecking if libtool supports shared libraries... yeschecking whether to build shared libraries... yeschecking whether to build static libraries... yeschecking for pkg-config... /usr/bin/pkg-configchecking pkg-config is at least version 0.9.0... yeschecking for flex... flexchecking lex output file root... lex.yychecking lex library... none neededchecking whether yytext is a pointer... nochecking for bison... bison -ychecking for dlopen in -ldl... yeschecking for the suffix of shared libraries... .sochecking for GLIB... noconfigure: error: Package requirements (glib-2.0 >= 2.49.4) were not met:Requested 'glib-2.0 >= 2.49.4' but version of GLib is 2.42.2Consider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables GLIB_CFLAGSand GLIB_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.[root@localhost gobject-introspection]#
出现错误glib版本太陈旧 安装新glib
[root@localhost glib-2.49.6]# ./configure
configure: error: Package requirements (libffi >= 3.0.0) were not met:No package 'libffi' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables LIBFFI_CFLAGSand LIBFFI_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.[root@localhost glib-2.49.6]#
glib依赖libffi 仍需要安装
./configuremakemake install
编译成功 可以重新编译glib了
[root@localhost glib-2.49.6]# ./configurechecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /usr/bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether UID '0' is supported by ustar format... yeschecking whether GID '0' is supported by ustar format... yeschecking how to create a ustar tar archive... gnutarchecking whether to enable maintainer-specific portions of Makefiles... yeschecking whether make supports nested variables... (cached) yeschecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking whether gcc understands -c and -o together... yeschecking for style of include used by make... GNUchecking dependency style of gcc... gcc3checking how to run the C preprocessor... gcc -Echecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking minix/config.h usability... nochecking minix/config.h presence... nochecking for minix/config.h... nochecking whether it is safe to define __EXTENSIONS__... yeschecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking for Win32... nochecking for the Android... nochecking for Mac OS X Carbon support... nochecking for Mac OS X Cocoa support... nochecking whether to enable garbage collector friendliness... nochecking whether to disable memory pools... nochecking for c++... c++checking whether we are using the GNU C++ compiler... yeschecking whether c++ accepts -g... yeschecking dependency style of c++... gcc3checking for special C compiler options needed for large files... nochecking for _FILE_OFFSET_BITS value needed for large files... nochecking for pkg-config... /usr/bin/pkg-configchecking pkg-config is at least version 0.16... yeschecking for gawk... (cached) gawkchecking for perl5... nochecking for perl... perlchecking for indent... indentchecking for perl... /usr/bin/perlchecking for a Python interpreter with version >= 2.5... pythonchecking for python... /usr/bin/pythonchecking for python version... 2.7checking for python platform... linux2checking for python script directory... ${prefix}/lib/python2.7/site-packageschecking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packageschecking for iconv_open... yeschecking for ZLIB... yeschecking for LIBFFI... noconfigure: error: Package requirements (libffi >= 3.0.0) were not met:No package 'libffi' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables LIBFFI_CFLAGSand LIBFFI_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.
仍然提示这个错误 这是因为 环境变量的问题 加上以下一句话
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
重新配置 出现下列依赖包
configure: error: Package requirements (libpcre >= 8.13) were not met:No package 'libpcre' found
这个可以直接用yum安装了
yum install pcre- yum install pcre-devel
将所有依赖都安装上
这次可以编译glib库了
./configuremakemake install
一路顺风直接安装上
4.继续编译gobject-introspection
checking for python script directory... ${prefix}/lib/python2.7/site-packageschecking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packageschecking for headers required to compile python extensions... ./configure: line 14668: /usr/bin/python-config: No such file or directorynot foundconfigure: error: Python headers not found
出现以上错误 初步断定是python的依赖包没有安装
安装python依赖包
yum install python*
其实安装个别的包就可以了 由于我不知道哪一个 都安装了
安装完成可以编译gobject-introspection文件了
仍是三步
./configuremakemake install
之后编译gtkgtext出现如下错误
[root@localhost gtkglext]# ./autogen.shI am going to run ./configure with no arguments - if you wishto pass any to it, please specify them on the ./autogen.sh command line.autoreconf: Entering directory `.'autoreconf: configure.ac: not using Gettextautoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}autoreconf: configure.ac: tracingautoreconf: running: libtoolize --copy --forcelibtoolize: putting auxiliary files in `.'.libtoolize: copying file `./ltmain.sh'libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4macros'.libtoolize: copying file `m4macros/libtool.m4'libtoolize: copying file `m4macros/ltoptions.m4'libtoolize: copying file `m4macros/ltsugar.m4'libtoolize: copying file `m4macros/ltversion.m4'libtoolize: copying file `m4macros/lt~obsolete.m4'autoreconf: running: /usr/bin/autoconf --forceautoreconf: running: /usr/bin/autoheader --forceautoreconf: running: automake --add-missing --copy --force-missinggdk/Makefile.am:212: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONALgtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONALautoreconf: automake failed with exit status: 1[root@localhost gtkglext]#
按照如下方法解决
[root@localhost gtkglext]# mkdir /root/m4[root@localhost gtkglext]# cd ..[root@localhost code]# lscef_binary_3.2785.1440.g1ee311f_linux64 glib-2.49.6 libffi-3.2.1cmake-2.8.12.1 gobject-introspectioncmake-2.8.12.1.tar.gz gtkglext[root@localhost code]# cd gobject-introspection/[root@localhost gobject-introspection]# cp ./m4/introspection.m4 /root/m4/[root@localhost gobject-introspection]# vi ../gtkglext/configure.ac
116 AC_CHECK_PROG([ms_librarian], [lib.exe], [yes], [no])117118 AC_PROG_LN_S119120 AC_PATH_PROGS([PERL], [perl5 perl])121122 AC_CONFIG_MACRO_DIR([/root/m4])123124 ##################################################125 # GObject introspection126 ##################################################127128 GOBJECT_INTROSPECTION_CHECK([1.40.0])129130 ##################################################131 # Checks for gtk-doc and docbook-tools132 ##################################################
添加122行 为m4路径
打开
[
root@localhost gobject
-
introspection
]#
vi ../gtkglext/Makefile.am
在第6行 10行分别添加一下两句话
6 ACLOCAL_AMFLAGS = -I /root/m4 ${ACLOCAL_FLAGS}7 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection89 EXTRA_DIST = \10 root/m4/introspection.m4 \11 README.win32 \12 ChangeLog.pre-1-0 \13 ChangeLog.pre-1-2 \14 gdkglext.pc.in \15 gtkglext.pc.in \16 gdkglext-uninstalled.pc.in \17 gtkglext-uninstalled.pc.in \18 gtkglext.nsi.in \19 gtkglext.nsi \20 setup-gtkglext.sh2122 ## Copy .pc files to target-specific names23 GDK_TARGET = @gdktarget@
按照如上方法就可以完成了
这样在执行
./autogen.sh
就可以配置成功了
接下来make编译 出现错误缺少opengl的库文件
1、查看mesa相关的包yum list mesa*2、安装这些包yum install mesa*安装完成后,我们就拥有了一个基础的OpenGL开发环境了,但是仅仅有基础的开发环境是不够的,一般来讲,我们还要安装一个叫做Glut的库,这是一个OpenGL的辅助库,可以让我们创建与平台无关的OpenGL窗口。因此,安装Glut也是必要的。 Glut有很多种实现,在这里我用的是freeglut。3、查看glutyum list *glut*4、安装freeglutyum list freeglut*到这里,我们就完成了OpenGL的安装了。
以上完成之后 opengl安装完成 但是编译过程中仍然会出现问题
在最后执行文件的时候出现问题 使用
设置环境变量 export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
因为系统安装的软件默认在/usr/lib下 我们指定的安装路径在/usr/local/lib下
注:以上安装的我们软件在配置的时候 ./configure --prefix=/usr/local 最好要加上这个参数 这样 我们在最后编译过程中才会轻松
系统安装的方式不同可能出现的问题也不同 以上是我编译过程中出现的问题
本文详细记录了在Linux环境下编译跨平台浏览器引擎CEF的全过程,包括安装cmake、解决GTK依赖问题、安装OpenGL相关库等关键步骤。

5544

被折叠的 条评论
为什么被折叠?



