Centos 7 cef_binary_3.2785.1440.g1ee311f_linux64编译之路

来源:互联网 发布:股中王股票行情软件 编辑:程序博客网 时间:2024/06/10 15:27

cef这个库 一般来说都是运行在windows下的 ,下面是我在linux编译的过程


链接是我的网盘链接地址  大家可以去下载cef


http://pan.baidu.com/s/1eSboi10

密码55qx


1.首先 安装cmake工具

cmake
出现错误 版本太低  更新cmake版本
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz

  1. ./configure
  2. make
  3. make 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版本的相关依赖


安装完成后需要继续编译
  1. In file included from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/client_handler.h:16:0,
  2. from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/browser_window.h:11,
  3. from /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/browser_window.cc:5:
  4. /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/browser/client_types.h:12:21: 致命错误:gtk/gtk.h:没有那个文件或目录
  5. #include <gtk/gtk.h>

出现了这个错误 证明你需要修改cmake文件了
打开CMakeList.txt文件在注释的下面加上以下部分
  1. # Include the libcef_dll_wrapper target.
  2. # Comes from the libcef_dll/CMakeLists.txt file in the binary distribution
  3. # directory.
  4. add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
  5. add_definitions(`pkg-config --libs --cflags gtk+-3.0`)
  6. add_definitions(-I /usr/include/gtk-3.0/unix-print)
  7. add_definitions(-I /usr/include/gtk-3.0)

这样编译后错误就会消失 继续make  你会发现下一个错误
  1. [ 91%] Building CXX object cefclient/CMakeFiles/cefclient.dir/cefclient_gtk.cc.o
  2. /home/wangwe/code/cef_binary_3.2785.1440.g1ee311f_linux64/cefclient/cefclient_gtk.cc:6:23: 致命错误:gtk/gtkgl.h:没有那个文件或目录
  3. #include <gtk/gtkgl.h>
这是因为gtk的opengl库没有安装 需要下个包继续安装输入以下命令 
用git版本下载到本地
  1. git clone git://git.gnome.org/gtkglext
下载完后 继续编译
  1. [root@localhost gtkglext]# ls
  2. AUTHORS gdk MAINTAINERS
  3. autogen.sh gdkglext.pc.in make-copyright.sh
  4. ChangeLog.pre-1-0 gdkglext-uninstalled.pc.in Makefile.am
  5. ChangeLog.pre-1-2 gtk NEWS
  6. configure.ac gtkglext.doap README
  7. COPYING gtkglext.nsi.in README.win32
  8. COPYING.LIB gtkglext.pc.in setup-gtkglext.sh
  9. docs gtkglext-uninstalled.pc.in TODO
  10. examples m4macros
  11. [root@localhost gtkglext]# ./autogen.sh
  12. which: no gtkdocize in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/wangwe/.local/bin:/home/wangwe/bin)
  13. *** No GTK-Doc found, please install it ***
  14. [root@localhost gtkglext]#
运行autogen文件出现以下错误 需要安装gtk-doc
  1. yum install gtk-doc

 这样会将所有的依赖都安装上
继续运行 出现以下错误
  1. [root@localhost gtkglext]# ./autogen.sh
  2. I am going to run ./configure with no arguments - if you wish
  3. to pass any to it, please specify them on the ./autogen.sh command line.
  4. autoreconf: Entering directory `.'
  5. autoreconf: configure.ac: not using Gettext
  6. autoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}
  7. autoreconf: configure.ac: tracing
  8. autoreconf: running: libtoolize --copy --force
  9. libtoolize: putting auxiliary files in `.'.
  10. libtoolize: copying file `./ltmain.sh'
  11. libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4macros'.
  12. libtoolize: copying file `m4macros/libtool.m4'
  13. libtoolize: copying file `m4macros/ltoptions.m4'
  14. libtoolize: copying file `m4macros/ltsugar.m4'
  15. libtoolize: copying file `m4macros/ltversion.m4'
  16. libtoolize: copying file `m4macros/lt~obsolete.m4'
  17. autoreconf: running: /usr/bin/autoconf --force
  18. autoreconf: running: /usr/bin/autoheader --force
  19. autoreconf: running: automake --add-missing --copy --force-missing
  20. configure.ac:62: installing './config.guess'
  21. configure.ac:62: installing './config.sub'
  22. configure.ac:55: installing './install-sh'
  23. configure.ac:55: installing './missing'
  24. Makefile.am: installing './INSTALL'
  25. examples/Makefile.am: installing './depcomp'
  26. gdk/Makefile.am:212: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
  27. gtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
  28. autoreconf: automake failed with exit status: 1
  29. [root@localhost gtkglext]#
这个错误找了好久 发现到了需要安装gobject-introspection这个包

3.安装gobject-introspection

  1. git clone git://git.gnome.org/gobject-introspection
参考这个包的官网
   https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection
下载好了 就安装 这个仍然是运行
  1. [root@localhost gobject-introspection]# ./autogen.sh
  2. autoreconf: Entering directory `.'
  3. autoreconf: configure.ac: not using Gettext
  4. autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
  5. autoreconf: configure.ac: tracing
  6. autoreconf: configure.ac: creating directory build-aux
  7. autoreconf: running: libtoolize --copy --force
  8. libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
  9. libtoolize: copying file `build-aux/ltmain.sh'
  10. libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
  11. libtoolize: copying file `m4/libtool.m4'
  12. libtoolize: copying file `m4/ltoptions.m4'
  13. libtoolize: copying file `m4/ltsugar.m4'
  14. libtoolize: copying file `m4/ltversion.m4'
  15. libtoolize: copying file `m4/lt~obsolete.m4'
  16. autoreconf: running: /usr/bin/autoconf --force
  17. autoreconf: running: /usr/bin/autoheader --force
  18. autoreconf: running: automake --add-missing --copy --force-missing
  19. configure.ac:43: installing 'build-aux/compile'
  20. configure.ac:30: installing 'build-aux/config.guess'
  21. configure.ac:30: installing 'build-aux/config.sub'
  22. configure.ac:20: installing 'build-aux/install-sh'
  23. configure.ac:20: installing 'build-aux/missing'
  24. Makefile.am: installing 'build-aux/depcomp'
  25. configure.ac: installing 'build-aux/ylwrap'
  26. Makefile-giscanner.am:28: installing 'build-aux/py-compile'
  27. Makefile.am:22: 'Makefile-giscanner.am' included from here
  28. parallel-tests: installing 'build-aux/test-driver'
  29. autoreconf: Leaving directory `.'
  30. checking for a BSD-compatible install... /usr/bin/install -c
  31. checking whether build environment is sane... yes
  32. checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
  33. checking for gawk... gawk
  34. checking whether make sets $(MAKE)... yes
  35. checking whether make supports nested variables... yes
  36. checking whether UID '0' is supported by ustar format... yes
  37. checking whether GID '0' is supported by ustar format... yes
  38. checking how to create a ustar tar archive... gnutar
  39. checking whether to enable maintainer-specific portions of Makefiles... yes
  40. checking whether make supports nested variables... (cached) yes
  41. checking build system type... x86_64-unknown-linux-gnu
  42. checking host system type... x86_64-unknown-linux-gnu
  43. checking for gcc... gcc
  44. checking whether the C compiler works... yes
  45. checking for C compiler default output file name... a.out
  46. checking for suffix of executables...
  47. checking whether we are cross compiling... no
  48. checking for suffix of object files... o
  49. checking whether we are using the GNU C compiler... yes
  50. checking whether gcc accepts -g... yes
  51. checking for gcc option to accept ISO C89... none needed
  52. checking for style of include used by make... GNU
  53. checking dependency style of gcc... gcc3
  54. checking whether gcc and cc understand -c and -o together... yes
  55. checking how to print strings... printf
  56. checking for a sed that does not truncate output... /usr/bin/sed
  57. checking for grep that handles long lines and -e... /usr/bin/grep
  58. checking for egrep... /usr/bin/grep -E
  59. checking for fgrep... /usr/bin/grep -F
  60. checking for ld used by gcc... /usr/bin/ld
  61. checking if the linker (/usr/bin/ld) is GNU ld... yes
  62. checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
  63. checking the name lister (/usr/bin/nm -B) interface... BSD nm
  64. checking whether ln -s works... yes
  65. checking the maximum length of command line arguments... 1572864
  66. checking whether the shell understands some XSI constructs... yes
  67. checking whether the shell understands "+="... yes
  68. checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
  69. checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
  70. checking for /usr/bin/ld option to reload object files... -r
  71. checking for objdump... objdump
  72. checking how to recognize dependent libraries... pass_all
  73. checking for dlltool... no
  74. checking how to associate runtime and link libraries... printf %s\n
  75. checking for ar... ar
  76. checking for archiver @FILE support... @
  77. checking for strip... strip
  78. checking for ranlib... ranlib
  79. checking command to parse /usr/bin/nm -B output from gcc object... ok
  80. checking for sysroot... no
  81. checking for mt... no
  82. checking if : is a manifest tool... no
  83. checking how to run the C preprocessor... gcc -E
  84. checking for ANSI C header files... yes
  85. checking for sys/types.h... yes
  86. checking for sys/stat.h... yes
  87. checking for stdlib.h... yes
  88. checking for string.h... yes
  89. checking for memory.h... yes
  90. checking for strings.h... yes
  91. checking for inttypes.h... yes
  92. checking for stdint.h... yes
  93. checking for unistd.h... yes
  94. checking for dlfcn.h... yes
  95. checking for objdir... .libs
  96. checking if gcc supports -fno-rtti -fno-exceptions... no
  97. checking for gcc option to produce PIC... -fPIC -DPIC
  98. checking if gcc PIC flag -fPIC -DPIC works... yes
  99. checking if gcc static flag -static works... no
  100. checking if gcc supports -c -o file.o... yes
  101. checking if gcc supports -c -o file.o... (cached) yes
  102. checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
  103. checking whether -lc should be explicitly linked in... no
  104. checking dynamic linker characteristics... GNU/Linux ld.so
  105. checking how to hardcode library paths into programs... immediate
  106. checking whether stripping libraries is possible... yes
  107. checking if libtool supports shared libraries... yes
  108. checking whether to build shared libraries... yes
  109. checking whether to build static libraries... yes
  110. checking for pkg-config... /usr/bin/pkg-config
  111. checking pkg-config is at least version 0.9.0... yes
  112. checking for flex... flex
  113. checking lex output file root... lex.yy
  114. checking lex library... none needed
  115. checking whether yytext is a pointer... no
  116. checking for bison... bison -y
  117. checking for dlopen in -ldl... yes
  118. checking for the suffix of shared libraries... .so
  119. checking for GLIB... no
  120. configure: error: Package requirements (glib-2.0 >= 2.49.4) were not met:
  121. Requested 'glib-2.0 >= 2.49.4' but version of GLib is 2.42.2
  122. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  123. installed software in a non-standard prefix.
  124. Alternatively, you may set the environment variables GLIB_CFLAGS
  125. and GLIB_LIBS to avoid the need to call pkg-config.
  126. See the pkg-config man page for more details.
  127. [root@localhost gobject-introspection]#
出现错误glib版本太陈旧 安装新glib
  1. [root@localhost glib-2.49.6]# ./configure
  1. configure: error: Package requirements (libffi >= 3.0.0) were not met:
  2. No package 'libffi' found
  3. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  4. installed software in a non-standard prefix.
  5. Alternatively, you may set the environment variables LIBFFI_CFLAGS
  6. and LIBFFI_LIBS to avoid the need to call pkg-config.
  7. See the pkg-config man page for more details.
  8. [root@localhost glib-2.49.6]#
glib依赖libffi 仍需要安装
  1. ./configure
  2. make
  3. make install
编译成功 可以重新编译glib了
  1. [root@localhost glib-2.49.6]# ./configure
  2. checking for a BSD-compatible install... /usr/bin/install -c
  3. checking whether build environment is sane... yes
  4. checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
  5. checking for gawk... gawk
  6. checking whether make sets $(MAKE)... yes
  7. checking whether make supports nested variables... yes
  8. checking whether UID '0' is supported by ustar format... yes
  9. checking whether GID '0' is supported by ustar format... yes
  10. checking how to create a ustar tar archive... gnutar
  11. checking whether to enable maintainer-specific portions of Makefiles... yes
  12. checking whether make supports nested variables... (cached) yes
  13. checking for gcc... gcc
  14. checking whether the C compiler works... yes
  15. checking for C compiler default output file name... a.out
  16. checking for suffix of executables...
  17. checking whether we are cross compiling... no
  18. checking for suffix of object files... o
  19. checking whether we are using the GNU C compiler... yes
  20. checking whether gcc accepts -g... yes
  21. checking for gcc option to accept ISO C89... none needed
  22. checking whether gcc understands -c and -o together... yes
  23. checking for style of include used by make... GNU
  24. checking dependency style of gcc... gcc3
  25. checking how to run the C preprocessor... gcc -E
  26. checking for grep that handles long lines and -e... /usr/bin/grep
  27. checking for egrep... /usr/bin/grep -E
  28. checking for ANSI C header files... yes
  29. checking for sys/types.h... yes
  30. checking for sys/stat.h... yes
  31. checking for stdlib.h... yes
  32. checking for string.h... yes
  33. checking for memory.h... yes
  34. checking for strings.h... yes
  35. checking for inttypes.h... yes
  36. checking for stdint.h... yes
  37. checking for unistd.h... yes
  38. checking minix/config.h usability... no
  39. checking minix/config.h presence... no
  40. checking for minix/config.h... no
  41. checking whether it is safe to define __EXTENSIONS__... yes
  42. checking build system type... x86_64-unknown-linux-gnu
  43. checking host system type... x86_64-unknown-linux-gnu
  44. checking for Win32... no
  45. checking for the Android... no
  46. checking for Mac OS X Carbon support... no
  47. checking for Mac OS X Cocoa support... no
  48. checking whether to enable garbage collector friendliness... no
  49. checking whether to disable memory pools... no
  50. checking for c++... c++
  51. checking whether we are using the GNU C++ compiler... yes
  52. checking whether c++ accepts -g... yes
  53. checking dependency style of c++... gcc3
  54. checking for special C compiler options needed for large files... no
  55. checking for _FILE_OFFSET_BITS value needed for large files... no
  56. checking for pkg-config... /usr/bin/pkg-config
  57. checking pkg-config is at least version 0.16... yes
  58. checking for gawk... (cached) gawk
  59. checking for perl5... no
  60. checking for perl... perl
  61. checking for indent... indent
  62. checking for perl... /usr/bin/perl
  63. checking for a Python interpreter with version >= 2.5... python
  64. checking for python... /usr/bin/python
  65. checking for python version... 2.7
  66. checking for python platform... linux2
  67. checking for python script directory... ${prefix}/lib/python2.7/site-packages
  68. checking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packages
  69. checking for iconv_open... yes
  70. checking for ZLIB... yes
  71. checking for LIBFFI... no
  72. configure: error: Package requirements (libffi >= 3.0.0) were not met:
  73. No package 'libffi' found
  74. Consider adjusting the PKG_CONFIG_PATH environment variable if you
  75. installed software in a non-standard prefix.
  76. Alternatively, you may set the environment variables LIBFFI_CFLAGS
  77. and LIBFFI_LIBS to avoid the need to call pkg-config.
  78. See the pkg-config man page for more details.
仍然提示这个错误 这是因为 环境变量的问题 加上以下一句话
  1. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
重新配置 出现下列依赖包
  1. configure: error: Package requirements (libpcre >= 8.13) were not met:
  2. No package 'libpcre' found

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

4.继续编译gobject-introspection


  1. checking for python script directory... ${prefix}/lib/python2.7/site-packages
  2. checking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packages
  3. checking for headers required to compile python extensions... ./configure: line 14668: /usr/bin/python-config: No such file or directory
  4. not found
  5. configure: error: Python headers not found
出现以上错误 初步断定是python的依赖包没有安装

安装python依赖包
  1. yum install python*
其实安装个别的包就可以了 由于我不知道哪一个 都安装了

安装完成可以编译gobject-introspection文件了  
仍是三步
  1. ./configure
  2. make
  3. make install


之后编译gtkgtext出现如下错误
  
  1. [root@localhost gtkglext]# ./autogen.sh
  2. I am going to run ./configure with no arguments - if you wish
  3. to pass any to it, please specify them on the ./autogen.sh command line.
  4. autoreconf: Entering directory `.'
  5. autoreconf: configure.ac: not using Gettext
  6. autoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}
  7. autoreconf: configure.ac: tracing
  8. autoreconf: running: libtoolize --copy --force
  9. libtoolize: putting auxiliary files in `.'.
  10. libtoolize: copying file `./ltmain.sh'
  11. libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4macros'.
  12. libtoolize: copying file `m4macros/libtool.m4'
  13. libtoolize: copying file `m4macros/ltoptions.m4'
  14. libtoolize: copying file `m4macros/ltsugar.m4'
  15. libtoolize: copying file `m4macros/ltversion.m4'
  16. libtoolize: copying file `m4macros/lt~obsolete.m4'
  17. autoreconf: running: /usr/bin/autoconf --force
  18. autoreconf: running: /usr/bin/autoheader --force
  19. autoreconf: running: automake --add-missing --copy --force-missing
  20. gdk/Makefile.am:212: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
  21. gtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
  22. autoreconf: automake failed with exit status: 1
  23. [root@localhost gtkglext]#
按照如下方法解决
  1. [root@localhost gtkglext]# mkdir /root/m4
  2. [root@localhost gtkglext]# cd ..
  3. [root@localhost code]# ls
  4. cef_binary_3.2785.1440.g1ee311f_linux64 glib-2.49.6 libffi-3.2.1
  5. cmake-2.8.12.1 gobject-introspection
  6. cmake-2.8.12.1.tar.gz gtkglext
  7. [root@localhost code]# cd gobject-introspection/
  8. [root@localhost gobject-introspection]# cp ./m4/introspection.m4 /root/m4/
  9. [root@localhost gobject-introspection]# vi ../gtkglext/configure.ac
  1. 116 AC_CHECK_PROG([ms_librarian], [lib.exe], [yes], [no])
  2. 117
  3. 118 AC_PROG_LN_S
  4. 119
  5. 120 AC_PATH_PROGS([PERL], [perl5 perl])
  6. 121
  7. 122 AC_CONFIG_MACRO_DIR([/root/m4])
  8. 123
  9. 124 ##################################################
  10. 125 # GObject introspection
  11. 126 ##################################################
  12. 127
  13. 128 GOBJECT_INTROSPECTION_CHECK([1.40.0])
  14. 129
  15. 130 ##################################################
  16. 131 # Checks for gtk-doc and docbook-tools
  17. 132 ##################################################

添加122行 为m4路径 
打开 [root@localhost gobject-introspection]# vi ../gtkglext/Makefile.am
在第6行 10行分别添加一下两句话
  1. 6 ACLOCAL_AMFLAGS = -I /root/m4 ${ACLOCAL_FLAGS}
  2. 7 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
  3. 8
  4. 9 EXTRA_DIST = \
  5. 10 root/m4/introspection.m4 \
  6. 11 README.win32 \
  7. 12 ChangeLog.pre-1-0 \
  8. 13 ChangeLog.pre-1-2 \
  9. 14 gdkglext.pc.in \
  10. 15 gtkglext.pc.in \
  11. 16 gdkglext-uninstalled.pc.in \
  12. 17 gtkglext-uninstalled.pc.in \
  13. 18 gtkglext.nsi.in \
  14. 19 gtkglext.nsi \
  15. 20 setup-gtkglext.sh
  16. 21
  17. 22 ## Copy .pc files to target-specific names
  18. 23 GDK_TARGET = @gdktarget@


 按照如上方法就可以完成了


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

以上完成之后 opengl安装完成 但是编译过程中仍然会出现问题


在最后执行文件的时候出现问题 使用
设置环境变量  export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib

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


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

0 0
原创粉丝点击