Centos 7 cef_binary_3.2785.1440.g1ee311f_linux64编译之路

前端之家收集整理的这篇文章主要介绍了Centos 7 cef_binary_3.2785.1440.g1ee311f_linux64编译之路前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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进行编译。
这样这个问题就解决
3.编译出现的第二个错误 首先需要安装gtk包
yum install gtk3* 这样安装的包都是gtk-3.0版本的相关依赖

安装完成后需要继续编译
   
   
In file included from /homewangwecodecef_binary_3.2785.1440.g1ee311f_linux64cefclientbrowserclient_handlerh:160, from browser_window11cc5:client_types1221:致命错误gtk:没有那个文件或目录 #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`)(-I usrinclude/gtk-3.0/unix-print-3)
这样编译后错误就会消失 继续make 你会发现下一个错误
[ 91%] Building CXX object cefclient/CMakeFilesdircefclient_gtko623gtkgl<gtk/gtkgl.h>
这是因为gtk的opengl库没有安装 需要下个包继续安装输入以下命令
用git版本下载到本地
git clone git://git.gnome.org/gtkglext
下载完后 继续编译
  • root@localhost gtkglext]# lsAUTHORS gdk MAINTAINERSautogensh gdkglextpcin makecopyrightshChangeLogpre-10 gdkglextuninstalledin MakefileamChangeLog2 gtk NEWSconfigureac gtkglextdoap READMECOPYING gtkglextnsiin READMEwin32COPYINGLIB gtkglextin setupgtkglextshdocs gtkglextin TODOexamples m4macrossh which no gtkdocize in (/localbin:/sbin/.)*** No GTK-Doc found please install it ***
    运行autogen文件出现以下错误 需要安装gtk-doc
    yum install gtkdoc

    这样会将所有的依赖都安装上
    继续运行 出现以下错误
    I am going to run configure with no arguments if you wish to pass any to it please specify them on the sh command lineautoreconf Entering directory `.' configureac not using Gettext running aclocal force I m4macros $ACLOCAL_FLAGS tracing libtoolize copy forcelibtoolize putting auxiliary files in ' copying file `./ltmainsh putting macros in AC_CONFIG_MACRO_DIR`m4macrosm4macroslibtoolm4ltoptionsltsugarltversionlt~obsoleteautoconf autoheader automake addmissing forcemissing62 installing './config.guess''./config.sub'55'./install-sh''./missing'Makefileam'./INSTALL'examples/Makefile'./depcomp'gdk212 error HAVE_INTROSPECTION does not appear in AM_CONDITIONAL113 automake Failed with exit status
    这个错误找了好久 发现到了需要安装gobject-introspection这个包

    3.安装gobject-introspection

    //git.gnome.org/gobject-introspection
    参考这个包的官网
    https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection
    下载好了 就安装 这个仍然是运行
    root@localhost gobjectintrospectionI m4 $ creating directory buildaux putting auxiliary files in AC_CONFIG_AUX_DIRbuildauxauxm443'build-aux/compile'30'build-aux/config.guess''build-aux/config.sub'20'build-aux/install-sh''build-aux/missing'Makefile'build-aux/depcomp''build-aux/ylwrap'Makefilegiscanner28'build-aux/py-compile'Makefile22'Makefile-giscanner.am' included from hereparalleltests'build-aux/test-driver' Leavingchecking for a BSDcompatible install...install cchecking whether build environment is sane yes a threadsafe mkdir pmkdir p gawk gawkchecking whether make sets $MAKE)...checking whether make supports nested variableschecking whether UID '0' is supported by ustar formatchecking whether GID checking how to create a ustar tar archive gnutarchecking whether to enable maintainerspecific portions of Makefilescachedchecking build system type x86_64unknownlinuxgnuchecking host system type gcc gccchecking whether the C compiler works C compiler default output file name aout suffix of executables checking whether we are cross compiling no suffix of object files ochecking whether we are the GNU C compilerchecking whether gcc accepts g gcc option to accept ISO C89 none needed style of include used by make GNUchecking dependency style of gcc gcc3checking whether gcc and cc understand c and o togetherchecking how to print strings printf a sed that does not truncate outputsed grep that handles long lines and egrep egrepgrep E fgrepF ld used by gccld the linker ld is GNU ld BSD or MScompatible name lister nmnm Bchecking the name lister B interface BSD nmchecking whether ln s workschecking the maximum length of command line arguments1572864checking whether the shell understands some XSI constructschecking whether the shell understands "+="checking how to convert x86_64gnu file names to x86_64gnu format func_convert_file_noopgnu file names to toolchain formatld option to reload object filesr objdump objdumpchecking how to recognize dependent libraries pass_all dlltoolchecking how to associate runtime and link libraries printf %s\n ar ar archiver @FILE support@ strip strip ranlib ranlibchecking command to parse B output from gcc object ok sysroot mt is a manifest toolchecking how to run the C preprocessor gcc ANSI C header files systypesstat stdlib string memory strings inttypes stdint unistd dlfcn objdirlibs gcc supports fnortti exceptions gcc option to produce PICfPIC DPIC gcc PIC flag DPIC works gcc static flag - worksc o filechecking whether the gcc linker ld m elf_x86_64 supports shared librarieschecking whether lc should be explicitly linked inchecking dynamic linker characteristics GNU/Linux ldsochecking how to hardcode library paths into programs immediatechecking whether stripping libraries is possible libtool supports shared librarieschecking whether to build shared librarieschecking whether to build libraries pkgconfigconfigchecking pkgconfig is at least version 0.90... flex flexchecking lex output file root lexyychecking lex librarychecking whether yytext is a pointer bison bison y dlopen in ldl the suffix of shared libraries GLIB Package requirements glib2.0>=2.494 were not met:Requested'glib-2.0 >= 2.49.4' but version of GLib is 2.422Consider adjusting the PKG_CONFIG_PATH environment variable youinstalled software in a nonstandard prefix.Alternatively you may set the environment variables GLIB_CFLAGSand GLIB_LIBS to avoid the need to call pkg.See the pkgconfig man page more details.
    出现错误glib版本太陈旧 安装新glib
    root@localhost glib.6configure
    
         
         
  • libffi 3.0:No package 'libffi' foundConsider the environment variables LIBFFI_CFLAGSand LIBFFI_LIBS to avoid the need to call pkg
  • glib依赖libffi 仍需要安装
    make install
    编译成功 可以重新编译glib了
    configurechecking whether gcc understands checking minixh usabilityh presence minixchecking whether it is safe to define __EXTENSIONS__ Win32 the Android Mac OS X Carbon OS X Cocoachecking whether to enable garbage collector friendlinesschecking whether to disable memory pools c++...++ the GNU C compilerchecking whether c accepts checking dependency style of c special C compiler options needed large files _FILE_OFFSET_BITS value needed 0.16 perl5 perl perl indent indentperl a Python interpreter with version 2.5 python pythonpython python version2.7 python platform linux2 python script directory $prefix}/libpython27sitepackages python extension module directoryexec_prefixlib64 iconv_open ZLIB LIBFFI.
    仍然提示这个错误 这是因为 环境变量的问题 加上以下一句话
    export PKG_CONFIG_PATH=/pkgconfig
    重新配置 出现下列依赖包
    libpcre 8.13'libpcre' found

    这个可以直接用yum安装了
    yum install pcre-devel yum install pcre
    将所有依赖都安装上
    这次可以编译glib库了
    make install
    一路顺风直接安装上

    4.继续编译gobject-introspection

    headers required to compile python extensions line 14668python such file or directorynot found Python headers not found
    出现以上错误 初步断定是python的依赖包没有安装
    安装python依赖包
    yum install python*
    其实安装个别的包就可以了 由于我不知道哪一个 都安装了
    安装完成可以编译gobject-introspection文件
    仍是三步
    make install


    之后编译gtkgtext出现如下错误
  • 按照如下方法解决
    mkdir root cd ..root@localhost codeg1ee311f_linux64 glib6 libffi3.21cmake2.812.1 gobjectintrospection12.1targz gtkglext cd gobject/ cp m4 vi ../gtkglext/configure.ac
    116 AC_CHECK_PROG([ms_librarian],76)">exeyesno])117118 AC_PROG_LN_S119120 AC_PATH_PROGSPERLperl5 perl121122 AC_CONFIG_MACRO_DIR([/123124##################################################125# GObject introspection126127128 GOBJECT_INTROSPECTION_CHECK([1.40129130131# Checks for gtk-doc and docbook-tools132##################################################

    添加122行 为m4路径
    打开 [ root@localhost gobject - introspection ]# vi ../gtkglext/Makefile.am
    在第6行 10行分别添加一下两句话
    ACLOCAL_AMFLAGS =m4 $7 DISTCHECK_CONFIGURE_FLAGS enabledoc 89 EXTRA_DIST \10 root/m4m4 \11 READMEwin32 \12 ChangeLog1314in \15 gtkglext16171819nsi \20 setup2122## Copy .pc files to target-specific names23 GDK_TARGET @gdktarget@

    按照如上方法就可以完成了
    这样在执行
    sh
    就可以配置成功了
    接下来make编译 出现错误缺少opengl的库文件
    、查看mesa相关的包yum list mesa*2、安装这些包yum install mesa*安装完成后,我们就拥有了一个基础的OpenGL开发环境了,但是仅仅有基础的开发环境是不够的,一般来讲,我们还要安装一个叫做Glut的库,这是一个OpenGL的辅助库,可以让我们创建与平台无关的OpenGL窗口。因此,安装Glut也是必要的。 Glut有很多种实现,在这里我用的是freeglut3glut*glut、安装freeglut freeglut到这里,我们就完成了OpenGL的安装了。

    以上完成之后 opengl安装完成 但是编译过程中仍然会出现问题
    在最后执行文件的时候出现问题 使用
    设置环境变量 export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib

    因为系统安装的软件默认在/usr/lib下 我们指定的安装路径在/usr/local/lib下
    注:以上安装的我们软件在配置的时候 ./configure --prefix=/usr/local 最好要加上这个参数 这样 我们在最后编译过程中才会轻松

    系统安装的方式不同可能出现的问题也不同 以上是我编译过程中出现的问题

    猜你在找的CentOS相关文章