Monthly Archives: July 2017

Creating Ubuntu debian pakage


You can check any debian package to get an idea about what goes inside the package.

.deb file can be opened in Linux with Archive manager. Actually .deb is just a zip.

There are two important directories:


and usrin general can have other directories or may not have usr directory.

Screen Shot 2017-07-02 at 5.21.45 PM

myApplication inside /usr/local/bin contains all the executable and .so etc related to my application.

You can literally see into any .deb file and get to know what kind of content is inside each of the files in DEBIAN directory.

control file


Package: myApplication
Version: 1.1.0
Section: admin
Priority: optional
Installed-Size: 415000
Architecture: amd64
Maintainer: Company name 
Description: Blah blah .. blah software..






#This installer installs myApplication

#give permission to startup script for IntelliSpace
chmod 755 /usr/local/bin/myApplication/

#create application entry for IntelliSpace

echo "
#!/usr/bin/env xdg-open

[Desktop Entry]
Comment=blah blah blah
" > /usr/share/applications/myApplication.desktop

xdg-desktop-menu install --novendor /usr/share/applications/myApplication.desktop

#Creating desktop icons
for user in /home/*
cp /usr/share/applications/myApplication.desktop ${user}/Desktop/
chmod 777 ${user}//Desktop/myApplication.desktop

cd /usr/local/bin/myApplication
chmod -R 777 *




#remove myApplication startup
rm /usr/local/bin/myApplication/

#delete all configurations
#rm -rf ~/.local/share/calibs #wrong folder
#uninstall application entry
xdg-desktop-menu uninstall usr/share/applications/myApplication.desktop


The file names are descriptive I think. prerm this will be run when application will be removed so for cleaning. postinst will run at time of installation when all your files are copied and dependencies installed.

md5sums is created when package is created you do not have to worry for this.


Command to create package:


fakeroot dpkg-deb --build myApplication

where myApplication is the name of folder which has all the content.


You may need to install dpkg-deb


To test either double click and install the .deb file created in above step by Ubuntu Software center or use below command

sudo dpkg -i myApplication.deb


Problem with #define from other libraries

While building a qt project with libxdo xdo.h I faced some strange problems with qt enum names conflicting with X #define macros.

There is no standard way of including headers the one which works is the best. For Qt I think it is recommended to include qt headers first then your files and other library files. This worked for me. To begin with I started to do #undef before include for each terms for which compiler was complaining. It was becoming really messy as there were many conflicts.

Another issue was below error

undefined reference to `xdo_new(char*)'

Inline with xdo.h I was including it in C++ project. libxdo is C project and it doesn’t have extern “C” declaration as other libraries have.

To fix above just use below:

extern "C" {
#include <xdo.h>