Centos 7 cef_binary_3.2785.1440.g1ee311f_linux64编译之路
cef这个库 一般来说都是运行在windows下的 ,下面是我在linux编译的过程1.首先 安装cmake工具cmake出现错误 版本太低 更新cmke版本wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz./configure makemake instal
·
cef这个库 一般来说都是运行在windows下的 ,下面是我在linux编译的过程
链接是我的网盘链接地址 大家可以去下载cef
http://pan.baidu.com/s/1eSboi10
密码55qx
1.首先 安装cmake工具
cmake
出现错误 版本太低 更新cmake版本
./configure
make
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进行编译。
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]# ls
AUTHORS gdk MAINTAINERS
autogen.sh gdkglext.pc.in make-copyright.sh
ChangeLog.pre-1-0 gdkglext-uninstalled.pc.in Makefile.am
ChangeLog.pre-1-2 gtk NEWS
configure.ac gtkglext.doap README
COPYING gtkglext.nsi.in README.win32
COPYING.LIB gtkglext.pc.in setup-gtkglext.sh
docs gtkglext-uninstalled.pc.in TODO
examples m4macros
[root@localhost gtkglext]# ./autogen.sh
which: 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.sh
I am going to run ./configure with no arguments - if you wish
to pass any to it, please specify them on the ./autogen.sh command line.
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: 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 --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.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_CONDITIONAL
gtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
autoreconf: 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.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: running: libtoolize --copy --force
libtoolize: 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 --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.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 here
parallel-tests: installing 'build-aux/test-driver'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for bison... bison -y
checking for dlopen in -ldl... yes
checking for the suffix of shared libraries... .so
checking for GLIB... no
configure: 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.2
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GLIB_CFLAGS
and 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' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBFFI_CFLAGS
and 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 仍需要安装
./configure
make
make install
编译成功 可以重新编译glib了
[root@localhost glib-2.49.6]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for Win32... no
checking for the Android... no
checking for Mac OS X Carbon support... no
checking for Mac OS X Cocoa support... no
checking whether to enable garbage collector friendliness... no
checking whether to disable memory pools... no
checking for c++... c++
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking dependency style of c++... gcc3
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.16... yes
checking for gawk... (cached) gawk
checking for perl5... no
checking for perl... perl
checking for indent... indent
checking for perl... /usr/bin/perl
checking for a Python interpreter with version >= 2.5... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packages
checking for iconv_open... yes
checking for ZLIB... yes
checking for LIBFFI... no
configure: error: Package requirements (libffi >= 3.0.0) were not met:
No package 'libffi' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBFFI_CFLAGS
and 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库了
./configure
make
make install
一路顺风直接安装上
4.继续编译gobject-introspection
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packages
checking for headers required to compile python extensions... ./configure: line 14668: /usr/bin/python-config: No such file or directory
not found
configure: error: Python headers not found
出现以上错误 初步断定是python的依赖包没有安装
安装python依赖包
yum install python*
其实安装个别的包就可以了 由于我不知道哪一个 都安装了
安装完成可以编译gobject-introspection文件了
仍是三步
./configure
make
make install
之后编译gtkgtext出现如下错误
[root@localhost gtkglext]# ./autogen.sh
I am going to run ./configure with no arguments - if you wish
to pass any to it, please specify them on the ./autogen.sh command line.
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4macros ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: 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 --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
gdk/Makefile.am:212: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
gtk/Makefile.am:113: error: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
autoreconf: automake failed with exit status: 1
[root@localhost gtkglext]#
按照如下方法解决
[root@localhost gtkglext]# mkdir /root/m4
[root@localhost gtkglext]# cd ..
[root@localhost code]# ls
cef_binary_3.2785.1440.g1ee311f_linux64 glib-2.49.6 libffi-3.2.1
cmake-2.8.12.1 gobject-introspection
cmake-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])
117
118 AC_PROG_LN_S
119
120 AC_PATH_PROGS([PERL], [perl5 perl])
121
122 AC_CONFIG_MACRO_DIR([/root/m4])
123
124 ##################################################
125 # GObject introspection
126 ##################################################
127
128 GOBJECT_INTROSPECTION_CHECK([1.40.0])
129
130 ##################################################
131 # Checks for gtk-doc and docbook-tools
132 ##################################################
添加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-introspection
8
9 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.sh
21
22 ## Copy .pc files to target-specific names
23 GDK_TARGET = @gdktarget@
按照如上方法就可以完成了
这样在执行
./autogen.sh
就可以配置成功了
接下来make编译 出现错误缺少opengl的库文件
1、查看mesa相关的包
yum list mesa*
2、安装这些包
yum install mesa*
安装完成后,我们就拥有了一个基础的OpenGL开发环境了,但是仅仅有基础的开发环境是不够的,一般来讲,我们还要安装一个叫做Glut的库,这是一个OpenGL的辅助库,可以让我们创建与平台无关的OpenGL窗口。因此,安装Glut也是必要的。 Glut有很多种实现,在这里我用的是freeglut。
3、查看glut
yum list *glut*
4、安装freeglut
yum list freeglut*
到这里,我们就完成了OpenGL的安装了。
以上完成之后 opengl安装完成 但是编译过程中仍然会出现问题
在最后执行文件的时候出现问题 使用
设置环境变量 export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
因为系统安装的软件默认在/usr/lib下 我们指定的安装路径在/usr/local/lib下
注:以上安装的我们软件在配置的时候 ./configure --prefix=/usr/local 最好要加上这个参数 这样 我们在最后编译过程中才会轻松
系统安装的方式不同可能出现的问题也不同 以上是我编译过程中出现的问题
更多推荐
已为社区贡献1条内容
所有评论(0)