linux下编译zbar64位,linux 编译zbar

本文档详细介绍了在Linux Deepin 15系统中下载、解压ZBar源码,并通过配置选项关闭不必要的模块(如video、gtk、qt、python支持),成功编译并安装ZBar库的过程。在配置时遇到的错误提示是由于缺少视频支持,通过添加--disable-video参数解决了问题。最终,编译完成后能够在指定目录下找到生成的库文件。
摘要由CSDN通过智能技术生成

从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

编译完成后,可以看到生成的库文件

来源:oschina

链接:https://my.oschina.net/u/4361193/blog/4694956

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在C语言中编译ZBar,您需要按照以下步骤进行操作: 1. 下载ZBar源代码:您可以从ZBar的官方网站上下载源代码压缩包,解压后得到源代码文件。 2. 安装编译工具:确保您的系统上已经安装了C编译器。对于Linux系统,可以使用gcc编译器。对于Windows系统,可以使用MinGW或者Cygwin等工具。 3. 打开终端(Linux)或者命令提示符(Windows):进入到源代码所在的目录。 4. 配置编译选项:执行"./configure"命令,该命令将会根据您的系统环境自动配置编译选项。如果没有出现错误提示,则表示配置成功。 5. 编译源代码:执行"make"命令进行编译,该命令将会编译源代码并生成可执行文件。这个过程可能需要一些时间,请耐心等待。 6. 安装ZBar库:执行"sudo make install"命令,该命令将会安装编译好的ZBar库到系统中。如果是Windows系统,则可以将生成的库文件手动拷贝到指定目录。 7. 添加头文件和库文件路径:在您的C代码中,需要添加ZBar的头文件路径和库文件路径。例如,可以使用#include <zbar.h>来引入ZBar的头文件,并使用"-lzbar"选项链接ZBar库。 8. 编译您的C代码:使用C编译编译您的C代码,同时添加上一步中设置好的头文件路径和库文件路径。请确保编译成功并生成可执行文件。 以上是使用C语言编译ZBar的基本步骤。根据不同的操作系统和编译环境,可能会有一些细微的差异,请按照具体情况进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值