博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Mac Pro 下安装 Snappy 压缩工具
阅读量:6804 次
发布时间:2019-06-26

本文共 14463 字,大约阅读时间需要 48 分钟。

  hot3.png

    snappy 我这里就不做介绍了,直接可以移步  https://github.com/google/snappy/tree/master 查看源码及说明信息。

    我这里下载 :https://github.com/google/snappy/releases/download/1.1.4/snappy-1.1.4.tar.gz

    接下来执行编译和安装:

     1.  首先对文件进行解压缩:

liuweideMacBook-Pro:opensource liuweiryan$ tar -zxvf snappy-1.1.4.tar.gz x snappy-1.1.4/x snappy-1.1.4/AUTHORSx snappy-1.1.4/COPYINGx snappy-1.1.4/ChangeLogx snappy-1.1.4/Makefile.amx snappy-1.1.4/NEWSx snappy-1.1.4/READMEx snappy-1.1.4/autogen.shx snappy-1.1.4/configure.acx snappy-1.1.4/format_description.txtx snappy-1.1.4/framing_format.txtx snappy-1.1.4/m4/x snappy-1.1.4/m4/gtest.m4x snappy-1.1.4/snappy-c.ccx snappy-1.1.4/snappy-c.hx snappy-1.1.4/snappy-internal.hx snappy-1.1.4/snappy-sinksource.ccx snappy-1.1.4/snappy-sinksource.hx snappy-1.1.4/snappy-stubs-internal.ccx snappy-1.1.4/snappy-stubs-internal.hx snappy-1.1.4/snappy-stubs-public.h.inx snappy-1.1.4/snappy-test.ccx snappy-1.1.4/snappy-test.hx snappy-1.1.4/snappy.ccx snappy-1.1.4/snappy.hx snappy-1.1.4/snappy.pc.inx snappy-1.1.4/snappy_unittest.ccx snappy-1.1.4/testdata/x snappy-1.1.4/testdata/alice29.txtx snappy-1.1.4/testdata/asyoulik.txtx snappy-1.1.4/testdata/baddata1.snappyx snappy-1.1.4/testdata/baddata2.snappyx snappy-1.1.4/testdata/baddata3.snappyx snappy-1.1.4/testdata/fireworks.jpegx snappy-1.1.4/testdata/geo.protodatax snappy-1.1.4/testdata/htmlx snappy-1.1.4/testdata/html_x_4x snappy-1.1.4/testdata/kppkn.gtbx snappy-1.1.4/testdata/lcet10.txtx snappy-1.1.4/testdata/paper-100k.pdfx snappy-1.1.4/testdata/plrabn12.txtx snappy-1.1.4/testdata/urls.10KliuweideMacBook-Pro:opensource liuweiryan$ cd snappy-1.1.4liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ lsAUTHORS				snappy-internal.hCOPYING				snappy-sinksource.ccChangeLog			snappy-sinksource.hMakefile.am			snappy-stubs-internal.ccNEWS				snappy-stubs-internal.hREADME				snappy-stubs-public.h.inautogen.sh			snappy-test.ccconfigure.ac			snappy-test.hformat_description.txt		snappy.ccframing_format.txt		snappy.hm4				snappy.pc.insnappy-c.cc			snappy_unittest.ccsnappy-c.h			testdata

    2. 编译安装

   在这里他提供了一个 autogen.sh 安装脚本,我们直接使用该脚本即可:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh ./autogen.sh: line 3: aclocal: command not found

执行后,这里提供缺少  aclocal 。对此进行安装即可,该包是由 automake 提供的,接下来安装 automake 包:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ brew install automake==> Installing dependencies for automake: autoconf==> Installing automake dependency: autoconf==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/au######################################################################## 100.0%==> Pouring autoconf-2.69.high_sierra.bottle.4.tar.gz==> CaveatsEmacs Lisp files have been installed to:  /usr/local/share/emacs/site-lisp/autoconf==> Summary  /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB==> Installing automake==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/au######################################################################## 100.0%==> Pouring automake-1.16.1_1.high_sierra.bottle.tar.gz  /usr/local/Cellar/automake/1.16.1_1: 131 files, 3.4MB==> Caveats==> autoconfEmacs Lisp files have been installed to:  /usr/local/share/emacs/site-lisp/autoconf

    安装完成后,接着我们继续执行  ./autogen.sh 脚本。

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh ./autogen.sh: line 10: libtoolize: command not foundliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$

擦擦,这里有缺了,接着继续安装即可:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ brew install libtool==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/li######################################################################## 100.0%==> Pouring libtool-2.4.6_1.high_sierra.bottle.tar.gz==> CaveatsIn order to prevent conflicts with Apple's own libtool we have prepended a "g"so, you have instead: glibtool and glibtoolize.==> Summary  /usr/local/Cellar/libtool/2.4.6_1: 71 files, 3.7MB

终于安装完了,我们继续执行安装脚本,执行后有报错了(如下信息,这是第三个错误了):

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh ./autogen.sh: line 10: libtoolize: command not foundliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ brew install libtool==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/li######################################################################## 100.0%==> Pouring libtool-2.4.6_1.high_sierra.bottle.tar.gz==> CaveatsIn order to prevent conflicts with Apple's own libtool we have prepended a "g"so, you have instead: glibtool and glibtoolize.==> Summary  /usr/local/Cellar/libtool/2.4.6_1: 71 files, 3.7MBliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, '.'.glibtoolize: copying file './ltmain.sh'glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.glibtoolize: copying file 'm4/libtool.m4'glibtoolize: copying file 'm4/ltoptions.m4'glibtoolize: copying file 'm4/ltsugar.m4'glibtoolize: copying file 'm4/ltversion.m4'glibtoolize: copying file 'm4/lt~obsolete.m4'configure.ac:17: installing './compile'configure.ac:17: installing './config.guess'configure.ac:17: installing './config.sub'configure.ac:15: installing './install-sh'configure.ac:15: installing './missing'Makefile.am: installing './INSTALL'/usr/local/Cellar/automake/1.16.1_1/share/automake-1.16/am/ltlibrary.am: warning: 'libsnappy.la': linking libtool libraries using a non-POSIX/usr/local/Cellar/automake/1.16.1_1/share/automake-1.16/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'Makefile.am:4:   while processing Libtool library 'libsnappy.la'Makefile.am: installing './depcomp'parallel-tests: installing './test-driver'configure.ac:43: error: possibly undefined macro: AC_DEFINE      If this token and others are legitimate, please use m4_pattern_allow.      See the Autoconf documentation.configure.ac:45: error: possibly undefined macro: AC_MSG_FAILURE

        经百度后,说是缺少 pkg-config 包,我们直接安装即可

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ brew install  pkg-config==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/pk######################################################################## 100.0%==> Pouring pkg-config-0.29.2.high_sierra.bottle.tar.gz  /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.2KBliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$

 

        再次执行,报错如下:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh /usr/local/Cellar/automake/1.16.1_1/share/automake-1.16/am/ltlibrary.am: warning: 'libsnappy.la': linking libtool libraries using a non-POSIX/usr/local/Cellar/automake/1.16.1_1/share/automake-1.16/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'Makefile.am:4:   while processing Libtool library 'libsnappy.la'

    工具错误提示,需要在  configure.ac 文件中,增加 AM_PROG_AR,我们使用 vim 编辑 configure.ac 这个文件,如下图:

c9e278b5fe12d452189501ac487120e4041.jpg

    接着再执行 ./autogen.sh 脚本文件(编译通过):

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./autogen.sh liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$

 

    接下来,我们进入正式安装环节,根目录下执行   ./configure  命令:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./configurechecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... ./install-sh -c -dchecking for gawk... nochecking for mawk... nochecking for nawk... nochecking for awk... awkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether make supports the include directive... yes (GNU style)checking 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 dependency style of gcc... gcc3checking for ar... archecking the archiver (ar) interface... archecking build system type... x86_64-apple-darwin17.7.0checking host system type... x86_64-apple-darwin17.7.0checking 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... /Library/Developer/CommandLineTools/usr/bin/ldchecking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... nochecking 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... 196608checking how to convert x86_64-apple-darwin17.7.0 file names to x86_64-apple-darwin17.7.0 format... func_convert_file_noopchecking how to convert x86_64-apple-darwin17.7.0 file names to toolchain format... func_convert_file_noopchecking for /Library/Developer/CommandLineTools/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 archiver @FILE support... nochecking for strip... stripchecking for ranlib... ranlibchecking command to parse /usr/bin/nm -B output from gcc object... okchecking for sysroot... nochecking for a working dd... /bin/ddchecking how to truncate binary pipes... /bin/dd bs=4096 count=1checking for mt... nochecking if : is a manifest tool... nochecking for dsymutil... dsymutilchecking for nmedit... nmeditchecking for lipo... lipochecking for otool... otoolchecking for otool64... nochecking for -single_module linker flag... yeschecking for -exported_symbols_list linker flag... yeschecking for -force_load linker flag... yeschecking 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... yeschecking for gcc option to produce PIC... -fno-common -DPICchecking if gcc PIC flag -fno-common -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 (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yeschecking dynamic linker characteristics... darwin17.7.0 dyldchecking 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 g++... g++checking whether we are using the GNU C++ compiler... yeschecking whether g++ accepts -g... yeschecking dependency style of g++... gcc3checking how to run the C++ preprocessor... g++ -Echecking for ld used by g++... /Library/Developer/CommandLineTools/usr/bin/ldchecking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... nochecking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yeschecking for g++ option to produce PIC... -fno-common -DPICchecking if g++ PIC flag -fno-common -DPIC works... yeschecking if g++ static flag -static works... nochecking if g++ supports -c -o file.o... yeschecking if g++ supports -c -o file.o... (cached) yeschecking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yeschecking dynamic linker characteristics... darwin17.7.0 dyldchecking how to hardcode library paths into programs... immediatechecking whether byte ordering is bigendian... nochecking for size_t... yeschecking for ssize_t... yeschecking for stdint.h... (cached) yeschecking stddef.h usability... yeschecking stddef.h presence... yeschecking for stddef.h... yeschecking sys/mman.h usability... yeschecking sys/mman.h presence... yeschecking for sys/mman.h... yeschecking sys/resource.h usability... yeschecking sys/resource.h presence... yeschecking for sys/resource.h... yeschecking windows.h usability... nochecking windows.h presence... nochecking for windows.h... nochecking byteswap.h usability... nochecking byteswap.h presence... nochecking for byteswap.h... nochecking sys/byteswap.h usability... nochecking sys/byteswap.h presence... nochecking for sys/byteswap.h... nochecking sys/endian.h usability... nochecking sys/endian.h presence... nochecking for sys/endian.h... nochecking sys/time.h usability... yeschecking sys/time.h presence... yeschecking for sys/time.h... yeschecking for mmap... yeschecking for 'gtest-config'... checking for gtest-config... nonochecking for pkg-config... /usr/local/bin/pkg-configchecking pkg-config is at least version 0.9.0... yeschecking for libgflags... nochecking if the compiler supports __builtin_expect... yeschecking if the compiler supports __builtin_ctzll... yeschecking for zlibVersion in -lz... yeschecking for lzo1x_1_15_compress in -llzo2... nochecking for lzf_compress in -llzf... nochecking for fastlz_compress in -lfastlz... nochecking for qlz_compress in -lquicklz... nochecking that generated files are newer than configure... doneconfigure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating snappy-stubs-public.hconfig.status: creating snappy.pcconfig.status: creating config.hconfig.status: executing depfiles commandsconfig.status: executing libtool commandsliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$

    从以上输出信息来看,没有报错信息,正常并通过。

    接着执行安装命令即可完成:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ./configure --prefix=/Users/liuweiryan/opensource/env/snappy; make; make install

        

        完成后,在 /Users/liuweiryan/opensource/env/snappy/lib 目录下,会有如下文件:

liuweideMacBook-Pro:snappy-1.1.4 liuweiryan$ ls ~/opensource/env/snappy/lib/libsnappy.1.dylib	libsnappy.dylib		pkgconfiglibsnappy.a		libsnappy.laliuweideMacBook-Pro:snappy-1.1.4 liuweiryan$

 

 

转载于:https://my.oschina.net/Rayn/blog/2877719

你可能感兴趣的文章
SpringBoot RESTful 应用中的异常处理小结
查看>>
域用户像服务器上传文件
查看>>
GRE over IPSCE
查看>>
我的友情链接
查看>>
Spinner的总结
查看>>
职场检讨术:算计别人就是伤害自己
查看>>
豹仔视觉个人文章
查看>>
经验分享:开发SWT应用两点心得
查看>>
使用angularjs写指令
查看>>
Linux下高并发socket最大连接数所受的各种限制 .
查看>>
php基础教程之mysqli
查看>>
jvax.net.ssl.SSLException: 异常解决
查看>>
IPC(进程间通信)几种常用的方法
查看>>
Python 模块 & 作用域
查看>>
20145129 《Java程序设计》第5周学习总结
查看>>
Linux服务器---使用mysql
查看>>
Linux服务器---安装telnet
查看>>
UBUNTU 12.04 LTS 64 JDK 安装配置
查看>>
CIF、DCIF、D1分辨率是多少?
查看>>
js 中解决 下载路径有中文的问题
查看>>