2016년 8월 18일 목요일

Cross-Compile zbar for Sama5d3

Cross-Compile zbar for Sama5d3

2016-08-19 shinC

libpng compile

  • I planed to check only png type barcode picture. if you need another delegate, you need to install library for it.


libImagemagic compile

  • zbar need libImagemagic to open image file.
    .
  • Source download
    git clone http://git.imagemagick.org/repos/ImageMagick.git && git checkout 6.9.4-0
    lastest version(7.0): wget http://www.imagemagick.org/download/ImageMagick.tar.gz
  • ./configure --prefix=/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi --host=arm \
    --without-jpeg --without-fontconfig --without-freetype --without-pango --without-xml --without-jng --without-bzlib \
    --disable-openmp --disable-cipher \
    && make && make install
  • compile complete message


...
...
configure:
==============================================================================
ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

 Host system type: arm-unknown-none
 Build system type: x86_64-unknown-linux-gnu

                Option                        Value
 ------------------------------------------------------------------------------
 Shared libraries  --enable-shared=no no
 Static libraries  --enable-static=yes yes
 Module support    --with-modules=no no
 GNU ld            --with-gnu-ld=no no
 Quantum depth     --with-quantum-depth=16 16
 High Dynamic Range Imagery
                   --enable-hdri=yes yes

 Install documentation: yes

 Delegate Library Configuration:
 BZLIB             --with-bzlib=no no
 Autotrace         --with-autotrace=no no
 DJVU              --with-djvu=yes no
 DPS               --with-dps=yes no
 FFTW              --with-fftw=yes no
 FLIF              --with-flif=yes no
 FlashPIX          --with-fpx=yes no
 FontConfig        --with-fontconfig=no no
 FreeType          --with-freetype=no no
 Ghostscript lib   --with-gslib=no no
 Graphviz          --with-gvc=yes no
 JBIG              --with-jbig=yes no
 JPEG v1           --with-jpeg=no no
 LCMS              --with-lcms=yes no
 LQR               --with-lqr=yes no
 LTDL              --with-ltdl=yes no
 LZMA              --with-lzma=yes no
 Magick++          --with-magick-plus-plus=yes yes
 OpenEXR           --with-openexr=yes no
 OpenJP2           --with-openjp2=yes no
 PANGO             --with-pango=no no
 PERL              --with-perl=no no
 PNG               --with-png=yes yes
 RAQM              --with-raqm=yes no
 RSVG              --with-rsvg=no no
 TIFF              --with-tiff=yes no
 WEBP              --with-webp=yes no
 WMF               --with-wmf=yes no
 X11               --with-x= no
 XML               --with-xml=no no
 ZLIB              --with-zlib=yes yes

 Delegate Program Configuration:
 GhostPCL          None pcl6 (unknown)
 GhostXPS          None gxps (unknown)
 Ghostscript       None gs (9.10)

 Font Configuration:
 Apple fonts       --with-apple-font-dir=default
 Dejavu fonts      --with-dejavu-font-dir=default none
 Ghostscript fonts --with-gs-font-dir=default /usr/share/fonts/type1/gsfonts/
 Windows fonts     --with-windows-font-dir=default none

 X11 Configuration:
       X_CFLAGS        =
       X_PRE_LIBS      =
       X_LIBS          =
       X_EXTRA_LIBS    =

 Options used to compile and link:
   PREFIX          = /home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi
   EXEC-PREFIX     = /home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi
   VERSION         = 7.0.2
   CC              = arm-poky-linux-gnueabi-gcc  -march=armv7-a -marm  -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a5 --sysroot=/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi
   CFLAGS          = -I/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi/usr/include/libpng16     -O2 -pipe -g -feliminate-unused-debug-types -Wall -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
   CPPFLAGS        =   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
   PCFLAGS         =
   DEFS            = -DHAVE_CONFIG_H
   LDFLAGS         = -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
   LIBS            =
   CXX             = arm-poky-linux-gnueabi-g++  -march=armv7-a -marm  -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a5 --sysroot=/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi
   CXXFLAGS        =  -O2 -pipe -g -feliminate-unused-debug-types -pthread
   FEATURES        = DPC HDRI
   DELEGATES       = mpeg png ps zlib
==============================================================================


zbar compile

  • zbar access old version directory name and library names so we need some modification for them.
  • Make symbolic link wand
    ~/Workspace2/VoIP/zbar-0.10$ ln -s /home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi/include/ImageMagick-7/MagickWand /home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi/include/ImageMagick-7/wand
  • Compile
    - it made a compile problem when I configured without CFLAGS option.
    ./configure --prefix=/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi --host=arm \
    --disable-video --without-gtk --without-python --without-qt --without-jpeg CFLAGS="" \
    MAGICK_LIBS="-L/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi/lib
    -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI" \
    MAGICK_CFLAGS="-I/home/albert/Workspace2/VoIP/yocto_gcc/sysroots/cortexa5hf-vfp-poky-linux-gnueabi/include/ImageMagick-7" \
    && make && make install
  • Test # ./bin/zbarimg samplesimg/barcode_01.png EAN-13:9876543210128 scanned 1 barcode symbols from 1 images in 0.1 seconds