linux下使用gflags编译glog
2015-04-22 18:57
274 查看
想在glog中使用gflags,但是gflags并没有安装在系统的默认目录下,因为我没有root权限,glog文档上有这么一段:
Several flags influence glog's output behavior. If the Google
gflags library is installed on your machine, the
of this script) will automatically detect and use it, allowing you to pass flags on the command line. For example, if you want to turn the flag
you can start your application with the following command line:
这里只说了安装在默认路径下,对于定制路径,我只好自己来尝试了。
最终的configure命令:
./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared -with-pic
./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared
备注:gflags和glog都安装在指定的目录下而不是系统默认目录,通过源代码安装
过程:
1.
使用 ./configure --prefix=/home/xxx/sbin/glog-0.3.4/
生成的Makefile:ac_cv_have_libgflags = 0
查看configure.ac中:
130 # Check if there is google-gflags library installed.
131 SAVE_CFLAGS="$CFLAGS"
132 SAVE_LIBS="$LIBS"
133 AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
134 GFLAGS_CFLAGS="-I${with_gflags}/include"
135 GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
136 CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
137 LIBS="$LIBS $GFLAGS_LIBS"
我就直接使用了--with-gflags=来指示gflags的路径
2.
使用: ./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags
make
报错:
/home/xxx/sbin/gflags/lib/libgflags.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1041: recipe for target 'libglog.la' failed
make: *** [libglog.la] Error 1
网上搜到了文章:http://blog.chinaunix.net/uid-20470603-id-3671388.html,找到了添加的参数,但是具体原因我还不是太懂
3.
使用: ./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared -with-pic
ok,只是没有so文件,只有*.a文件
Several flags influence glog's output behavior. If the Google
gflags library is installed on your machine, the
configurescript (see the INSTALL file in the package for detail
of this script) will automatically detect and use it, allowing you to pass flags on the command line. For example, if you want to turn the flag
--logtostderron,
you can start your application with the following command line:
这里只说了安装在默认路径下,对于定制路径,我只好自己来尝试了。
最终的configure命令:
./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared -with-pic
./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared
备注:gflags和glog都安装在指定的目录下而不是系统默认目录,通过源代码安装
过程:
1.
使用 ./configure --prefix=/home/xxx/sbin/glog-0.3.4/
生成的Makefile:ac_cv_have_libgflags = 0
查看configure.ac中:
130 # Check if there is google-gflags library installed.
131 SAVE_CFLAGS="$CFLAGS"
132 SAVE_LIBS="$LIBS"
133 AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
134 GFLAGS_CFLAGS="-I${with_gflags}/include"
135 GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
136 CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
137 LIBS="$LIBS $GFLAGS_LIBS"
我就直接使用了--with-gflags=来指示gflags的路径
2.
使用: ./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags
make
报错:
/home/xxx/sbin/gflags/lib/libgflags.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1041: recipe for target 'libglog.la' failed
make: *** [libglog.la] Error 1
网上搜到了文章:http://blog.chinaunix.net/uid-20470603-id-3671388.html,找到了添加的参数,但是具体原因我还不是太懂
3.
使用: ./configure --prefix=/home/xxx/sbin/glog-0.3.4/ --with-gflags=/home/xxx/sbin/gflags --disable-shared -with-pic
ok,只是没有so文件,只有*.a文件
相关文章推荐
- Cross compile gdbserver and use it in ARM linux (在ARM uClinux下编译和使用gdbserver)
- linux下安装和使用ccache加快编译
- linux下用gcc编译使用了math库函数的程序出错的解决方法
- Cross compile gdbserver and use it in ARM linux (在ARM uClinux下编译和使用gdbserver)
- Linux下C语言编程的-编译命令gcc的使用
- 在Linux上使用Qt编译WebKit
- Linux系统平台下关于GCC编译及使用的方法
- 嵌入式linux使用交叉编译器编译ACE
- 在linux下使用crosstool制作自己的arm交叉编译环境
- Linux系统平台下关于GCC编译及使用的方法
- 编译Linux Kernel,启动Linux不使用Initrd Image
- 谈一点自已在linux下使用过的几种编译建构系统的感受吧
- 在linux下使用crosstool-0.43制作自己的arm交叉编译环境 (转)
- Linux下使用交叉编译工具开发powerpc(mpc83xx)
- 【原】Boost下载安装编译配置使用指南(含Windows、Linux以及ARM Linux)
- 使用uclibc的buildroot制作交叉编译工具链 ,arm-linux-gcc
- Berkeley DB Xml 入门系列之二: 在Linux下编译和使用Berkeley DB Xml
- linux下静态库、动态库的编译和使用
- 在Linux下编译使用kfs-0.3
- linux-c使用math.h编译问题