linux 编译zbar

耗尽温柔 提交于 2020-10-30 07:58:42

 

从github上git的源码的目录下没有configure ,晕

wget http://downloads.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.gz

tar -zvxf zbar-0.10.tar.gz

export CFLAGS=""./configure --prefix=$(pwd)/output0808 --enable-shared --enable-static --without-imagemagick --without-jpeg --without-python --without-gtk --without-qt --disable-video

make&&make intsall

在output0808/lib下

file libzbar.so.0.2.0

 

本节环境: linux deepin 15
在编译zbar之前,请看之前博客《Linux Imagemagick 安装》,zbar 测试依赖Imagemagick工具。

一、下载zbar源码
http://zbar.sourceforge.net/download.html

二、解压文件

eric@eric-PC:~/Documents/work/linux-c/zbar-0.10$ ls
aclocal.m4  config.log     configure.ac  eric-config.txt  HACKING  libtool   Makefile.am  perl    python      README          TODO     zbar-gtk.pc     zbarimg   zbar.pc.in
ChangeLog   config.status  COPYING       examples         include  LICENSE   Makefile.in  plugin  QRcode.png  README.windows  zbar     zbar-gtk.pc.in  zbar.nsi  zbar-qt.pc
config      configure      doc           gtk              INSTALL  Makefile  NEWS         pygtk   qt          test            zbarcam  zbar.ico        zbar.pc   zbar-qt.pc.in

  • 1
  • 2
  • 3
  • 4
  • 5

三、配置zbar

eric@eric-PC:~/Documents/work/linux-c/zbar-0.10$ ./configure 
  • 1

完成后,提示错误

checking for linux/videodev.h... no
configure: error: in `/home/eric/Documents/work/linux-c/zbar-0.10':
configure: error: test for video support failed!
rebuild your kernel to include video4linux support or
configure --disable-video to skip building video support.
See `config.log' for more details.

类似错误,是因为相关依赖项,linux环境并未安装,但很多东西我们也并不需要,可以在配置的时候关闭相关模块./configure --enable-shared --enable-static --disable-video --without-gtk --without-qt --without-python

eric@eric-PC:~/Documents/work/linux-c/zbar-0.10$ ./configure --enable-shared --enable-static --disable-video --without-gtk --without-qt --without-python
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for style of include used by make... GNU

...

please verify that the detected configuration matches your expectations:
------------------------------------------------------------------------
X                 --with-x=yes
pthreads          --enable-pthread=yes
v4l               --enable-video=no
        => zbarcam video scanner will *NOT* be built
jpeg              --with-jpeg=yes
Magick++          --with-imagemagick=yes
Python            --with-python=no
GTK+              --with-gtk=no
        => the GTK+ widget will *NOT* be built
Qt4               --with-qt=no
        => the Qt4 widget will *NOT* be built

eric@eric-PC:~/Documents/work/linux-c/zbar-0.10$ 

配置完成后,可以看到,Magick++、jpeg模块已经支持!

四、编译make,make install
编译完成后,可以看到生成的库文件

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!