Building Debian Package for Dynamsoft Barcode SDK

Dynamsoft Barcode Reader for Linux is released as a .tar.gz file. To use the barcode SDK, first, you have to download and extract the compressed package. Then, copy the shared libraries to /usr/lib folder or export the library search path. The process seems to be easy, but as a matter of fact, some developers who are new to Linux platform always suffer from the issue – shared library not found. To simplify the SDK installation and deployment, I decided to create a Debian package.

Making Debian Package

Basic Project Structure

Create a Debian package project as follows:

Debian package

·         Dbr_5.2: conform to the convention <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb, dbr is the package name and 5.2 is the version number.

·         DEBIAN: the folder contains a control file and other script files. The control file provides the information about the package. Once the package has been unpacked, the DEBIAN postinst file will be triggered. If you want to run some commands before removing the package, add scripts to DEBIAN prerm file.

·         Opt: all resources will be copied to /opt/ folder of the file system after installing the Debian package.

Download Dynamsoft Barcode Reader for Linux and extract all files to dbr_5.2/opt/dynamsoft/dbr.

DEBIAN control file

Edit the DEBIAN control file:

Package: dbr

Version: 5.2

Architecture: amd64

Description: Dynamsoft Barcode Reader

 Dynamsoft Barcode Reader SDK for Linux enables you to efficiently embed barcode reading functionality into your web and desktop applications with a few lines of code.

 To get a valid trial license, please contact

Maintainer: Dynamsoft <>


The architectures include i386 for 32-bit Intel CPUs, amd64 for 64-bit, armel for ARM processors.

How to list the default library search path on Linux?

The error message “shared library not found” means the library does not exist under the default search paths. According to the answer from StackOverflow, we can use the following command to check the default search path:

ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012












Usually, we can create a symbolic link for target shared library and move the symlink to /usr/lib/.

DEBIAN postinst

Create symbolic links for shared libraries in this file:

ln -s /opt/dynamsoft/dbr/lib/ /usr/lib/
ln -s /opt/dynamsoft/dbr/lib/ /usr/lib/

DEBIAN prerm

Before uninstalling Debian package, remember to delete the related symlinks:

rm /usr/lib/
rm /usr/lib/

Build, install and remove the Debian package


dpkg-deb -b dbr_5.2


sudo dpkg -i dbr_5.2.deb

Remove :

sudo dpkg -r dbr

Build a barcode project

After installing the .deb file with dpkg, you can build and run your barcode applications without specifying the library path:

g++ -o BarcodeReader -I/opt/dynamsoft/dbr/include/ BarcodeReader.cxx -lDynamsoftBarcodeReader