Developer Blog - Inventic.eu
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Category: Linux

Docker links

13 Dec 2016

Posted by: ludek.vodicka

Linux Windows #Linux #Windows #docker #virtualization

Wordpress upgrade

Error message:

wordpress update Could not create directory<br />
This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php<br />

Solution:

#set persmissions for writing to all<br />
find -type d -print0 | xargs -0 chmod 777<br />
find -type f -print0 | xargs -0 chmod 666</p>
<p>#revert back<br />
find -type d -print0 | xargs -0 sudo chown deploy<br />
find -type f -print0 | xargs -0 sudo chown deploy</p>
<p>find -type d -print0 | xargs -0 chmod 755<br />
find -type f -print0 | xargs -0 chmod 664</p>
<p>#set permissions to correct user<br />
sudo chown deploy ./wp-includes/js/tinymce/plugins/wpemoji/*</p>
<p>

Additional links

25 Apr 2015

Posted by: ludek.vodicka

Linux #Linux #wordpress

S3 usage statistics

13 Feb 2015

Posted by: ludek.vodicka

Programming Linux #s3 #statistics

perl: warning: Setting locale failed

sudo locale-gen en_US en_US.UTF-8<br />
sudo dpkg-reconfigure locales<br />
sudo update-locale<br />
07 Feb 2015

Posted by: ludek.vodicka

Linux

How to update gcc to 4.8.1 on any ubuntu

Everything is perfectly explained in this post:

http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

List of commands

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
gcc --version
06 Feb 2015

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #gcc

Disable sudo password on Jenkins build machines

edit file sudoers

sudo nano /etc/sudoers</p>
<p>or</p>
<p>sudo visudo<br />

and modify

%sudo ALL=(ALL) ALL<br />

to

%sudo ALL=(ALL) NOPASSWD: ALL<br />

and add following line to the end of the file:

user ALL=NOPASSWD: ALL<br />

Be careful!

When editing sudoers, it's necessary to be very careful. Any error cause that you will not be able to edit this file anymore and also not to use sudo ;-).

Here are links how to fix it (verified ;-) )

Remote links

02 Dec 2014

Posted by: ludek.vodicka

Programming Linux #Linux #jenkins #sudo

Autossh forward ports to whole network

Use -g swith after -L section to forward ports to whole network

autossh -M 40008 -f -N [email protected] -L 33061:127.0.0.1:3306 -g -L 6380:127.0.0.1:6380 -o &quot;ServerAliveInterval 60&quot; -o &quot;ServerAliveCountMax 3&quot; -o BatchMode=yes -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa<br />

Other notes

Configuration file : /etc/init/autossh.conf

Start service:

sudo service autossh start<br />

 

Other links

26 Nov 2014

Posted by: ludek.vodicka

Linux #autossh #forward port

Tips for versioning systems (Git, svn, mercurial,...)

Get packed archive of changed files from git directory (more info)

zip changes.zip $(git diff --name-only)<br />

Packed last changes of git:

 git archive -o qt-changes.zip head $(git diff --name-only)<br />

How to upgrade svn to 1.7 on Ubuntu 10.4

Here is nice step-by-step manual.

09 Aug 2014

NGINX + FastCGI - usefull commands

Start / stop nginx server

//execute<br />
nginx</p>
<p>//stop<br />
nginx -s stop</p>
<p>//reload configurations<br />
nginx -s reload</p>
<p>//reopen log files<br />
nginx -s reload<br />

24 Jul 2014

Posted by: ludek.vodicka

Linux Windows Web tools #nginx #fast-cgi

Using ssh as proxy/tunnel between Mac OS and Linux

How to connect to remote computer with private key by using ssh:

#register private key<br />
ssh-add ~/dev/Private/ludek_vodicka_dsa.openssh</p>
<p>#connect to computer and forward local port to remote computer and remote port<br />
ssh my-computer.com -p PORT -lUSER -L LOCAL_PORT:REMOTE_COMPUTER:REMOTE_PORT</p>
<p>#connect to computer and create SOCKS proxy on port SOCKS_PORT<br />
ssh my-computer.com -p PORT -lUSER -D SOCKS_PORT<br />

Note:

If your private key was created for Windows, it will probably not work on linux/mac. It's necessary to convert it by using puttygen (on mac or windows). You need to open it by puttygen and choose "Save as openssh" from menu.

Additional resources

07 Feb 2014

Posted by: ludek.vodicka

Linux Mac OS #ssh #tunnel #port-forwarding

Debugging segmentation fault

22 Jan 2014

Posted by: ludek.vodicka

Linux #Linux #C++ #debugging #segmentationfault

Customize OSX terminal prompt

How to customize default terminal prompt which looks like this?

ComputerName Directory UserName$<br />

simply define PS1 variable with required format. To display only full path, use following:

export PS1=&quot;\w $&quot;<br />
  • \d – date
  • \t – time
  • \h – hostname
  • \# – command number
  • \u – username
  • \W – current directory (e.g.: Desktop)
  • \w – current directory path (e.g.: /Users/Admin/Desktop)

External links:

03 Jan 2014

Posted by: ludek.vodicka

Linux Mac OS #Linux #terminal #osx #prompt

Parse HTTP data to more suitable form

18 Nov 2013

Posted by: ludek.vodicka

Linux Windows Mac OS #nginx

nginx and fast-cgi - tips and tricks

How to pass full path to fast-cgi app

It's necessary to configure which parameters are passed to fast-cgi application from nginx server. For this purposes serves fastcgi_param keyword. It's a good practice to keeps all fastcgi params together. For this purposes nginx has fastcgi.conf file. This file already contains most of useful fastcgi_param bindings.

fastcgi_param  QUERY_STRING       $query_string;<br />
fastcgi_param  REQUEST_METHOD     $request_method;<br />
fastcgi_param  CONTENT_TYPE       $content_type;<br />
...<br />

To include this file use include statement:

location / {<br />
   include fastcgi_params;<br />
   fastcgi_pass 127.0.0.1:9345;<br />
 }<br />

How to pass custom headers to fast-cgi app

Default configuration pass only default headers to fast-cgi. It's necessary to add few more configurations statements:

fastcgi_pass_request_headers on;<br />

After that headers are passed as HTTP_* parameters:

HTTP_HEADER1=2222<br />

External links

18 Nov 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #nginx

FastCGI c++ library for all platforms (Windows, Mac and Linux)

List of existing libraries

Snippets

Stackoverflow articles

Tutorials

Other links

CGICC - how to update it for VS2010 COMPILATION

  •  **error C2668: 'cgicc::copy_if' : ambiguous call to overloaded function** - add cgicc:: to all cgicc::copy_if instances
  •  **error LNK2019: unresolved external symbol** - add compiled .lib path (...Debug\cgicc.lib) to all dependend projects
17 Nov 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #C++ #fastcgi #nginx

Problem installing Fedora18/19 on VMWare

During my attempts to install Fedora as virtual machine we got following error:

[caption width="774" align="aligncenter"] VMWare Fedora problem [/caption]

dracut-initqueue[350]: mount: /dev/sr1 is write-protected, mounting read-only<br />
dracut-initqueue[350]: warning: Could not boot</p>
<p>Entering emergency mode. Exit the shell to continue<br />
Type &quot;journalctl&quot; to view systm logs.</p>
<p>dracut:/#<br />

The solution is pretty simple. The problem is inside VMWare automatical installer and VMWare's **autoinst.iso** image which is automatically connected to virtual machine.
To resolve this issue, stop your virtual machine, open **Edit virtual machine settings** and remove first CD drive with mounted autoinst.iso.

[caption width="660" align="aligncenter"] How to fix problem when installing Fedora on VMW[/caption]

When you remove this iso from you VM, run it again and everything will work as expected.

[caption width="497" align="aligncenter"] Fedora installation[/caption]

18 Oct 2013

Posted by: ludek.vodicka

Linux #installation #vmw #fedora

C++ Code coverage tools for Windows and Linux (DRAFT)

Linux

  • CovTool - Free test coverage analyzer for C++
  • ggcov -  GTK+ GUI for exploring test coverage data produced by C and C++ programs compiled with gcc --coverage.
  • lcov - graphical front-end for GCC's coverage testing tool gcov. Creates HTML pages containing the source code annotated with coverage information.
  • Trucov - open source program that works with the GCC compiler to display the control flow of a program and its test coverage information

STEPS:

1) add CXX, CFD + LINKER FLAGS

2) remove OBJS output dir and generate .o .gcov,... to root project directory

3)remove MOC directory output for Qt app

3)run gcov xx.cpp

--- generate html

sudo apt-get install lcov (http://ltp.sourceforge.net/coverage/lcov.php)

lcov --capture --directory ~/dev/Applications/AtomixApp/AtomixApp --output-file coverage.info

How to use articles

How to integrate with jenkins

StackOverflow questions

15 Oct 2013

Posted by: ludek.vodicka

Linux Windows Mac OS #code-coverage

DD-WRT Monitoring bandwidth per IP

For detailed bandwidth tracking there is a great plugin ip_conntrack available on **dd-wrt.com** forum.

Step 1 - upload plugin to DD-WRT

The easiest way how to upload any content to DD-WRT is build-it ProFTPD server. To enable it, open **Services ->** **NAS** and check **ProFTPD **server.

[caption id="" align="aligncenter" width="497"] DD-WRT FTP[/caption]

Now you can upload any content to your router by any FTP client.

Step 2 - connect to router by telnet

My DD-WRT firmware has some problems with SSH so it isn't possible to use it. It's not a big deal because we can connect to router by telnet (in Win7 it's necessary to install it Add or Remove program->Turn Windows Features -> Telnet client). Run **Telnet** from start menu and type (use IP address based on your own configuration)

&lt;br /&gt;o 192.168.0.1&lt;br /&gt;

[caption id="" align="aligncenter" width="417"] Telnet[/caption]

Step 3 - Install ip_conntrack plugin

Now it's necessary to execute all steps described in ip_conntrack post.

#Extract and set correct permissions<br />
chmod +x /tmp/MyPage/*.sh<br />
ln -s /tmp/MyPage/www/qos_conntrack.js /tmp/www/</p>
<p>#register new page<br />
nvram set mypage_scripts=&quot;/tmp/MyPage/qos_conntrack.sh&quot;<br />
nvram commit</p>
<p>#activate new page<br />
/tmp/MyPage/traffic_monitor.sh&amp;<br />

Step 4 - Configure automatic execution of script

Not tested, more info on plugin page

**External links**

07 Oct 2013

Posted by: ludek.vodicka

Linux #dd-wrt

Why I am not using phpMyAdmin on production servers

Even though I find phpMyAdmin and similar tools useful I don't like them on production servers. When I spent a lot of my time protecting website against SQL injection I don't want to leave opened doors to access the database through phpMyAdmin. Many phpMyAdmin installations are not protected with HTTPS and just one login on a public or attacked wifi can lead to a lot of troubles. So I recommend to delete the phpMyAdmin installation from the server and start with a more comfortable and secured way to do the task.

SSH tunnel will give you the security you're looking for. Start your Putty, load the session and configure tunnel:

Putty tunnel screenshot

I've selected port 3366 to be used on my local machine so it avoids conflict with my other installation. Now I can connect from any tool to MySQL database at localhost:3366. I prefer Netbeans IDE and MySQL Workbench which is also really great for server/user configuration.

28 Aug 2013

Posted by: ludek.vodicka

Programming Linux #Linux #ssh

Secure SSH with RSA/DSA key

We are using SSH a lot to deploy our projects and to do common maintenance tasks. If you are accessing your server many times a day you might find frustrating typing the password all the time. You can use private key instead. Here are some detailed articles about adding RSA key and configuring SSH daemon. Bellow is a summary of the basic steps for Windows users.

Putty which is a great alternative to the Linux tools. To generate private/public key you should use PuttyGen.exe. Run the application, click generate and follow the instructions. It's a good idea to put your name into the key comment so you could easily recognize your public key in configuration files. You should also protect your key with a password.

PuttyGen screenshot

Copy the public key which is located in the big text field above Key fingerprint field. Append the public key into /root/.ssh/authorized_keys file (if you want to login as root). You might need to create this file if it doesn't exist already. Click on Save private key button and save the key to a secured place. You can now use this private key to login with putty to the remote server. To make things more comfortable you can use an agent to store unlocked private keys in the memory while you are logged into your computer. Run this command after you login:

pageant.exe john_doe.ppk

Without any further settings you should now be able to login to the remote SSH without password. If everything worked as expected you can now disable password authenticated access to make your server more secure:

# /etc/ssh/sshd_config
PasswordAuthentication no

To load you key after you login to a Linux box (useful for deployment) insert:


# ~/.bash_profile
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

keychain --clear id_rsa
. ~/.keychain/$HOSTNAME-sh

ssh-add

Now we have a little bit more secured but more comfortable way to use SSH.

28 Aug 2013

Posted by: ludek.vodicka

Programming Linux #Linux #ssh #rsa/dsa key

SVN repository maintenance

To perform SVN repository maintenance use following commands

svnadmin verify REPO</p>
<p>
14 Jun 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #svn

Ubuntu eth0: ERROR while getting interface flags: No such device

This article is step-by-step tutorial how to fix a problem which occured after I restored my virtual machines from backup to my ESXI server.

ifconfig<br />

[caption id="" align="aligncenter" width="658"] ifconfig when eth0 is not available[/caption]

when I used **lspci**, result was

lspci<br />

[caption id="" align="alignnone" width="658"] lspci result[/caption]

So network adapter is correctly available in my virtual machine. As next step I need to found out which alias is used for this adapter. I didn't find any easily way than try et0,eth1,....

ifconfig eth0<br />
eth0: error fetching interface information: Device not found</p>
<p>ifconfig eth1<br />
eth1: error fetching interface information: Device not found</p>
<p>ifconfig eth2<br />
eth2: Link encap: Ethernet HWaddr.....<br />

So, I found my network adapter. Now as last step it's necessary to update network interfaces to this adapter

sudo nano /etc/network/interfaces</p>
<p>#and change all eth0 to eth1 values<br />

[caption id="" align="alignnone" width="652"] /etc/network/interfaces[/caption]

As last step restart your machine and everything should work correctly.

External links:

  • http://www.cyberciti.biz/faq/show-ethernet-adapter-ubuntu-linux/
18 Mar 2013

Posted by: ludek.vodicka

Linux #Linux #network #virtual-machine

How to add new drive to ubuntu

Step one: install drive

It's easy.... ;-)

Step two, check if drive is connected

sudo fdisk -l<br />

Create partitions

sudo fdisk /dev/sdb</p>
<p>#Create partition<br />
#----------------<br />
#press u (units to sectors)<br />
#press n (create new partition)<br />
#press p (primary partition)<br />
#press 1 (first partition)<br />
#press enter (default start at begin)<br />
#press enter (default end at end)</p>
<p>#Format partition<br />
#----------------<br />
#press L (list of formats)<br />
#?? need tye 83, don't know how to enter ;-)</p>
<p>#press W (write changes to hdd and quit)</p>
<p>#update kernel with changes we have made<br />
sudo partproble /dev/sdb</p>
<p>#format drive<br />
sudo mkfs /dev/sdb1 -t ext4</p>
<p>#create directory mount point<br />
sudo mkdir /home/dev/dev<br />
sudo chmod 777 /home/dev/dev</p>
<p>#mount it<br />
sudo mount /dev/sdb1 /home/dev/dev -t ext4</p>
<p>#try to write something<br />
touch /home/dev/dev/test.txt<br />
ls /home/dev/dev</p>
<p>#setup auto-mounting point<br />
sudo nano /etc/fstab</p>
<p>#add line<br />
/dev/sdb1 /home/dev/dev ext4 defaults 0 0</p>
<p>

External ref:

13 Feb 2013

Posted by: ludek.vodicka

Linux #Linux #system #hdd #partitions

Managing users and passwords on linux

Add user

Add user with correct bash and home folder:

sudo useradd -m -s /bin/bash USER<br />
sudo passwd USER</p>
<p>#Add user to sudoers group<br />
usermod -a -G admin USER<br />

Remove user

sudo userdel USER<br />

To remove also home directory, pass -r

sudo userdel -r USER<br />

Change su password

sudo passwd<br />

13 Feb 2013

Posted by: ludek.vodicka

Linux #Linux #shell

Ubuntu / Debian versions and GLIBC version

How to get current linux and GLIBC version?

#linux version<br />
cat /etc/issue</p>
<p>#glibc version<br />
ldd --version<br />
OS Version GlibC version
Ubuntu 12.04.1 LTS 2.14/2.15
Debian 6.0 2.11
13 Feb 2013

Posted by: ludek.vodicka

Linux #Linux #gcc #compiler

Qt QtDBus compilation

To add DBUS to Qt compilation, add following switch

./configure -opensource -dbus ....<br />

If you get following error:

The QtDBus module cannot be enabled because libdbus-1 version 0.93 was not found.<br />
Turn on verbose messaging (-v) to ./configure to see the final report.<br />
If you believe this message is in error you may use the continue<br />
switch (-continue) to ./configure to continue.<br />

It's necessary to install libsbus:

sudo apt-get install libdbus-1-3<br />
Reading package lists... Done<br />
Building dependency tree<br />
Reading state information... Done<br />
libdbus-1-3 is already the newest version.<br />

and also developer package:

sudo apt-get install libdbus-1-dev<br />

Now everything should work correctly.

24 Jan 2013

Posted by: ludek.vodicka

Qt Linux #Qt #Linux #system

How to get Linux version from command line

cat /etc/issue<br />
08 Jan 2013

Posted by: ludek.vodicka

Linux #Linux #system

Equivalent of ProcessExplorer for Linux

  • http://htop.sourceforge.net/
  • http://www.student.nada.kth.se/~f91-men/qps/
  • http://sourceforge.net/projects/procexp/

Linux Tools

**lsof, pmap -** Get all opened files by any process

 

Other info

http://superuser.com/questions/285572/equivalent-to-sysinternals-process-explorer-on-linux

07 Jan 2013

Posted by: ludek.vodicka

Linux #Linux #system

How to recursively change directory/files permissions

sudo chown user:user -R *<br />
08 Sep 2012

Posted by: ludek.vodicka

Linux

How to change Ubuntu computer network name and setup SSH access

To change computer network use following commands:

sudo nano /etc/hostname
sudo reboot

To check host name:

hostname

To setup SSH access use:

sudo apt-get install ssh
sudo apt-get install openssh-server
08 Sep 2012

Posted by: ludek.vodicka

Linux #Linux #network #ssh

Qt and Google breakpad Windows/Linux/MacOS

Integration of Google breakpad on any platform is really challenge. I didn't figure out how to do it by using recommended ways. So I did it my way ;-)

Create your own Qt project

As first thing I did when integrating Qt and Breakpad is creation of my own .pri file. I manually add all required files from Breakpad one-by-one, starting with src/platform/exception_handler continuing with all files included in previous ones. The complete .pri file you will find at end of this post.

After that I created simple CCrashHandler (inspired by qt-breakpad project) class which register exception handler. It's necessary to implement this handler for each platform separately because each platform have different parameters in google_breakpad::ExceptionHandler() constructor. CrashHandler source code you can find also at end of this post.

Using Breakpad on Linux:

Article about Linux integration.

Notes Linux

  • GCC 4.6.3
  • Ubuntu 12.04.1 32/64bit

Get and Compile Breakpad

#get breakpad latest version<br />
svn checkout http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad-read-only</p>
<p>#compile all breakpad tools for extracting symbol files<br />
./configure<br />
make<br />
sudo make install</p>
<p>#when compilation is ready, you should have installed file dump_syms from original directory /src/tools/linux/dump_syms in your /usr/bin<br />
dump_syms<br />

Generate symbol file and test debug info

Now how to generate and use symbol file:

#generate .sym file<br />
dump_syms ./Application &gt; Application.sym</p>
<p>#store sym file in the correct location<br />
#this step is necessary. Without that minidump_stackwalk tool doesn't work</p>
<p>head -n1 Application.sym<br />
#Result: MODULE Linux x86_64 6EDC6ACDB282125843FD59DA9C81BD830 Application</p>
<p>mkdir -p ./symbols/Application/6EDC6ACDB282125843FD59DA9C81BD830<br />
mv Application.sym ./symbols/Application/6EDC6ACDB282125843FD59DA9C81BD830</p>
<p>#show stack with using minidump_stackwalk tool<br />
minidump_stackwalk ./crash.dmp ./symbols<br />

Result of minidump_stackwalk tool can look like this:

Use additional tools

There is script written by Mozzila corp which simplifies extracting and storing .sym file:
http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/tools/symbolstore.py?raw=1

Now with this script, you can do only one step instead of all described above.

python /path/to/script/symbolstore.py /usr/local/bin/dump_syms ./symbol-storage ./Application<br />

This command correctly creates folder Application/uuid in path symbol-storage and copy generated .sym file inside.

Using Breakpad on MacOS:

To integrate Breakpad and Qt on MacOS I used the same article as for Linux because I'm using gcc and linux-like development toolchain. For native XCode integration you have to probably use this article.

Notes MacOS

  • GCC 4.6.3
  • Qt creator toolchain
  • Mac OS 10.7.3 64bit
  • Don't using any of XCode tool chaing

Do almost all steps like on Linux integration. There is one exception, because you can't compile Breakpad tools using linux-like configure&make. You have to build these tools with XCode.

Compile google_breakpad/src/tools/mac/dump_syms/dump_syms.xcodeproj with XCode

Before I managed to successfully compile dump_syms in XCode, I have to update Architectures Debug/Release to 64-bit Intel and BaseSDK to "Latest Mac OS X". I also fix all issues displayed in the left part of XCode window.

Next step is change compilation type from Debug to Release. After a short searching I found a way in "Schema->Edit schema->Build configuration".

To be honest, I was not sure what I did, but it worked ;-). Maybe there is some easier way how to compile dump_syms in xcode, but I don't know how. This was my first contact with XCode ;-).

The application is compiled to path "/Users/User/Library/Developer/Xcode/DerivedData/dump_syms-bjvr/Build/Products/Release/dump_syms". Now copy dump_syms to safe location from where you will use it.

The rest steps are same like in the Linux.

Using Breakpad on Windows

Notes Windows

Article about Windows integration.

  • Compile with Visual Studio 2010
  • Post-mortem debugging is done also via VS2010
  • Google breakpad under windows generates common .dmp files which can by simply load directly to VS

Generate symbol files and test debug info

You have to choices for Windows. First option is use standard .PDB and .DMP files mechanism in VS. Second is use the same way how you can did it for Linux and Mac.

**First way**: Let compiler generate .PDB file. Store this files and use them later in VS together with your crash dump.

**Second way**: Use dump_sys.exe. This file is located in the google breakpad directory tree: google-breakpad\src\tools\windows\binaries\dump_syms.exe .

dump_syms.exe AtomixDevelopment.exe &gt;AtomixDevelopment.sym<br />

And also like under Linux, you can use Python script symbolstore.py to extract symbols to correct directory:

python.exe symbolstore.py binaries\dump_syms.exe .\Symbols AtomixDevelopment.exe<br />

Minidump stackwalk for windows:
http://code.google.com/p/pcxfirefox/source/browse/trunk/betterpgo/talos/talos/breakpad/win32/minidump_stackwalk.exe?r=19

The best thing at end

The most amazing thing I found about dump_syms is their platform independence. If you correctly extract symbol file on each platform and store it in one location, you can analyze any crashdump on one location. No matter what is source platform, you will analyze .dmp file by using **minidump_stackwalk ./crash.dmp ./symbols**.

How to include CrashHandler directly to your project

This is what I get when I follow all includes from **.h** and **.cpp** files starting with exception_handler.h for all platforms. With small modification you can include it to your project and your application will be fully breakpad-able ;-).

# ---------- HEADER -----------------------------------------------------------<br />
OTHERS   += $$PWD/axCrashHandler.pri<br />
HEADERS += $$PWD/CrashHandler.h<br />
SOURCES += $$PWD/CrashHandler.cpp</p>
<p>BREAKPAD_PATH=$$EXTERNAL_LIBRARIES_PATH/breakpad-qt<br />
INCLUDEPATH += $$BREAKPAD_PATH/src</p>
<p>OSMAC {<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/handler/exception_handler.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/crash_generation/crash_generation_client.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/crash_generation/crash_generation_server.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/crash_generation/client_info.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/handler/minidump_generator.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/handler/dynamic_images.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/handler/breakpad_nlist_64.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/mac/handler/mach_vm_compat.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/minidump_file_writer.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/minidump_file_writer-inl.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/macho_utilities.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/byteswap.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/MachIPC.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/scoped_task_suspend-inl.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/file_id.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/macho_id.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/macho_walker.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/macho_utilities.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/bootstrap_compat.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/mac/string_utilities.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/linux_libc_support.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/string_conversion.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/md5.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/memory.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/using_std_string.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/convert_UTF.h<br />
  HEADERS += $$BREAKPAD_PATH/src/processor/scoped_ptr.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_exception_mac.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/breakpad_types.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_format.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_size.h<br />
  HEADERS += $$BREAKPAD_PATH/src/third_party/lss/linux_syscall_support.h</p>
<p>  SOURCES += $$BREAKPAD_PATH/src/client/mac/handler/exception_handler.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/mac/crash_generation/crash_generation_client.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/mac/crash_generation/crash_generation_server.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/mac/handler/minidump_generator.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/mac/handler/dynamic_images.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/mac/handler/breakpad_nlist_64.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/minidump_file_writer.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/macho_id.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/macho_walker.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/macho_utilities.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/string_utilities.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/file_id.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/MachIPC.mm<br />
  SOURCES += $$BREAKPAD_PATH/src/common/mac/bootstrap_compat.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/md5.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/string_conversion.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/linux_libc_support.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/convert_UTF.c<br />
  LIBS += /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation<br />
  LIBS += /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices<br />
  #breakpad app need debug info inside binaries<br />
  QMAKE_CXXFLAGS+=-g<br />
}</p>
<p>OSLIN {<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/handler/exception_handler.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/crash_generation/crash_generation_client.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/handler/minidump_descriptor.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/minidump_writer/minidump_writer.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/minidump_writer/line_reader.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/minidump_writer/linux_dumper.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/minidump_writer/linux_ptrace_dumper.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/minidump_writer/directory_reader.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/linux/log/log.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/minidump_file_writer-inl.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/minidump_file_writer.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/linux_libc_support.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/eintr_wrapper.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/ignore_ret.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/file_id.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/memory_mapped_file.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/safe_readlink.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/guid_creator.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/elfutils.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/linux/elfutils-inl.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/using_std_string.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/memory.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/basictypes.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/memory_range.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/string_conversion.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/convert_UTF.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_format.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_size.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/breakpad_types.h<br />
  HEADERS += $$BREAKPAD_PATH/src/processor/scoped_ptr.h<br />
  HEADERS += $$BREAKPAD_PATH/src/third_party/lss/linux_syscall_support.h<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/crash_generation/crash_generation_client.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/handler/exception_handler.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/handler/minidump_descriptor.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/minidump_writer/minidump_writer.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/minidump_writer/linux_dumper.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/minidump_writer/linux_ptrace_dumper.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/linux/log/log.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/minidump_file_writer.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/linux_libc_support.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/file_id.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/memory_mapped_file.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/safe_readlink.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/guid_creator.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/linux/elfutils.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/string_conversion.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/convert_UTF.c<br />
  #breakpad app need debug info inside binaries<br />
  QMAKE_CXXFLAGS+=-g<br />
}</p>
<p>OSWIN {<br />
  BREAKPAD_PATH=q:/Applications/breakpad-qt/third-party/latest-breakpad<br />
  INCLUDEPATH += $$BREAKPAD_PATH/src<br />
  HEADERS += $$BREAKPAD_PATH/src/common/windows/string_utils-inl.h<br />
  HEADERS += $$BREAKPAD_PATH/src/common/windows/guid_string.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/windows/handler/exception_handler.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/windows/common/ipc_protocol.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/minidump_format.h<br />
  HEADERS += $$BREAKPAD_PATH/src/google_breakpad/common/breakpad_types.h<br />
  HEADERS += $$BREAKPAD_PATH/src/client/windows/crash_generation/crash_generation_client.h<br />
  HEADERS += $$BREAKPAD_PATH/src/processor/scoped_ptr.h </p>
<p>  SOURCES += $$BREAKPAD_PATH/src/client/windows/handler/exception_handler.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/windows/string_utils.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/common/windows/guid_string.cc<br />
  SOURCES += $$BREAKPAD_PATH/src/client/windows/crash_generation/crash_generation_client.cc<br />
}<br />

And this is the minimal implementation of your new CrashHandler. My ownd crash handler is much more sophisticate to perform reporting, sending crash dump etc. But for purposes of this article this is what you need (And also I don't want to share my whole know-how here ;-)))

CrashHandler.h

#pragma once<br />
#include &lt;QtCore/QString&gt;</p>
<p>namespace Atomix<br />
{<br />
	class CrashHandlerPrivate;<br />
	class CrashHandler<br />
	{<br />
	public:<br />
		static CrashHandler* instance();<br />
    void Init(const QString&amp;  reportPath);</p>
<p>		void setReportCrashesToSystem(bool report);<br />
		bool writeMinidump();</p>
<p>	private:<br />
		CrashHandler();<br />
		~CrashHandler();<br />
		Q_DISABLE_COPY(CrashHandler)<br />
		CrashHandlerPrivate* d;<br />
	};<br />
}<br />

CrashHandler.cpp

#include &quot;CrashHandler.h&quot;<br />
#include &lt;QtCore/QDir&gt;<br />
#include &lt;QtCore/QProcess&gt;<br />
#include &lt;QtCore/QCoreApplication&gt;<br />
#include &lt;QString&gt;</p>
<p>#if defined(Q_OS_MAC)<br />
#include &quot;client/mac/handler/exception_handler.h&quot;<br />
#elif defined(Q_OS_LINUX)<br />
#include &quot;client/linux/handler/exception_handler.h&quot;<br />
#elif defined(Q_OS_WIN32)<br />
#include &quot;client/windows/handler/exception_handler.h&quot;<br />
#endif</p>
<p>namespace Atomix<br />
{<br />
	/************************************************************************/<br />
	/* CrashHandlerPrivate                                                  */<br />
	/************************************************************************/<br />
	class CrashHandlerPrivate<br />
	{<br />
	public:<br />
		CrashHandlerPrivate()<br />
		{<br />
			pHandler = NULL;<br />
		}</p>
<p>		~CrashHandlerPrivate()<br />
		{<br />
			delete pHandler;<br />
		}</p>
<p>		void InitCrashHandler(const QString&amp; dumpPath);<br />
		static google_breakpad::ExceptionHandler* pHandler;<br />
		static bool bReportCrashesToSystem;<br />
	};</p>
<p>	google_breakpad::ExceptionHandler* CrashHandlerPrivate::pHandler = NULL;<br />
	bool CrashHandlerPrivate::bReportCrashesToSystem = false;</p>
<p>	/************************************************************************/<br />
	/* DumpCallback                                                         */<br />
	/************************************************************************/<br />
#if defined(Q_OS_WIN32)<br />
	bool DumpCallback(const wchar_t* _dump_dir,const wchar_t* _minidump_id,void* context,EXCEPTION_POINTERS* exinfo,MDRawAssertionInfo* assertion,bool success)<br />
#elif defined(Q_OS_LINUX)<br />
	bool DumpCallback(const google_breakpad::MinidumpDescriptor &amp;md,void *context, bool success)<br />
#elif defined(Q_OS_MAC)<br />
	bool DumpCallback(const char* _dump_dir,const char* _minidump_id,void *context, bool success)<br />
#endif<br />
	{<br />
		Q_UNUSED(context);<br />
#if defined(Q_OS_WIN32)<br />
		Q_UNUSED(_dump_dir);<br />
		Q_UNUSED(_minidump_id);<br />
		Q_UNUSED(assertion);<br />
		Q_UNUSED(exinfo);<br />
#endif<br />
		qDebug(&quot;BreakpadQt crash&quot;);</p>
<p>		/*<br />
		NO STACK USE, NO HEAP USE THERE !!!<br />
		Creating QString's, using qDebug, etc. - everything is crash-unfriendly.<br />
		*/<br />
		return CrashHandlerPrivate::bReportCrashesToSystem ? success : true;<br />
	}</p>
<p>	void CrashHandlerPrivate::InitCrashHandler(const QString&amp; dumpPath)<br />
	{<br />
		if ( pHandler != NULL )<br />
			return;</p>
<p>#if defined(Q_OS_WIN32)<br />
		std::wstring pathAsStr = (const wchar_t*)dumpPath.utf16();<br />
		pHandler = new google_breakpad::ExceptionHandler(<br />
			pathAsStr,<br />
			/*FilterCallback*/ 0,<br />
			DumpCallback,<br />
			/*context*/<br />
			0,<br />
			true<br />
			);<br />
#elif defined(Q_OS_LINUX)<br />
		std::string pathAsStr = dumpPath.toStdString();<br />
		google_breakpad::MinidumpDescriptor md(pathAsStr);<br />
		pHandler = new google_breakpad::ExceptionHandler(<br />
			md,<br />
			/*FilterCallback*/ 0,<br />
			DumpCallback,<br />
			/*context*/ 0,<br />
			true,<br />
			-1<br />
			);<br />
#elif defined(Q_OS_MAC)<br />
		std::string pathAsStr = dumpPath.toStdString();<br />
		pHandler = new google_breakpad::ExceptionHandler(<br />
			pathAsStr,<br />
			/*FilterCallback*/ 0,<br />
			DumpCallback,<br />
			/*context*/<br />
			0,<br />
			true,<br />
			NULL<br />
			);<br />
#endif<br />
	}</p>
<p>	/************************************************************************/<br />
	/* CrashHandler                                                         */<br />
	/************************************************************************/<br />
	CrashHandler* CrashHandler::instance()<br />
	{<br />
		static CrashHandler globalHandler;<br />
		return &amp;globalHandler;<br />
	}</p>
<p>	CrashHandler::CrashHandler()<br />
	{<br />
		d = new CrashHandlerPrivate();<br />
	}</p>
<p>	CrashHandler::~CrashHandler()<br />
	{<br />
		delete d;<br />
	}</p>
<p>	void CrashHandler::setReportCrashesToSystem(bool report)<br />
	{<br />
		d-&gt;bReportCrashesToSystem = report;<br />
	}</p>
<p>	bool CrashHandler::writeMinidump()<br />
	{<br />
		bool res = d-&gt;pHandler-&gt;WriteMinidump();<br />
		if (res) {<br />
			qDebug(&quot;BreakpadQt: writeMinidump() successed.&quot;);<br />
		} else {<br />
			qWarning(&quot;BreakpadQt: writeMinidump() failed.&quot;);<br />
		}<br />
		return res;<br />
	}</p>
<p>	void CrashHandler::Init( const QString&amp; reportPath )<br />
	{<br />
		d-&gt;InitCrashHandler(reportPath);<br />
	}<br />
}<br />

Main.cpp

And here is how to use it:

#include &quot;axCore/axCrashHandler/CrashHandler.h&quot;<br />
#include &lt;QDebug&gt;<br />
#include &lt;QCoreApplication&gt;<br />
#include &lt;iostream&gt;</p>
<p>int buggyFunc()<br />
{<br />
	delete reinterpret_cast&lt;QString*&gt;(0xFEE1DEAD);<br />
	return 0;<br />
}</p>
<p>int main(int argc, char * argv[])<br />
{<br />
	qDebug() &lt;&lt; &quot;App start&quot;;<br />
	QCoreApplication app(argc, argv);</p>
<p>#if defined(Q_OS_WIN32)<br />
	Atomix::CrashHandler::instance()-&gt;Init(&quot;c:\\dump&quot;);<br />
#elif defined(Q_OS_LINUX)<br />
	Atomix::CrashHandler::instance()-&gt;Init(&quot;/Users/dev/dump&quot;);<br />
#elif defined(Q_OS_MAC)<br />
	Atomix::CrashHandler::instance()-&gt;Init(&quot;/Users/User/dump&quot;);<br />
#endif</p>
<p>	qDebug() &lt;&lt; &quot;CrashHandlerSet&quot;;<br />
	buggyFunc();<br />
	return 0;<br />
}<br />

Very slow svn updates from Virtual Machines (VMWare)

I have a lot of virtual machines used for my everyday development. It's very frustrating the SVN update speed if you have several externals in your main SVN source.

Today when I wait for some compilation start searching if there is anything what could improve SVN speed. After searching a lot of articles about faster network, better server hdd,... I found article with mention how SVN client communicate with server (intensively ;-) ). But without any clue how to improve it.

So I start searching how SVN client communiacte from within VMWare machines to server. I noticed that VMWare default network settings is NAT: Used to share the host's IP address:

So I start trying other network methods and this is the result:

When I use "Custom: Specific virtual network" and choose "VMnet0 Bridged", my svn update is about ten times faster than on NAT settings!!. I also tried first option "Bridged:..." but this doesn't work for me.

30 Aug 2012

Posted by: ludek.vodicka

Linux Windows Mac OS #deploy #svn

How to get Linux / Ubuntu version

cat /etc/issue<br />
Ubuntu 12.04.1 LTS<br />
27 Aug 2012

Posted by: ludek.vodicka

Linux #Linux

How to install Subversion 1.7 to Ubuntu

sudo apt-add-repository ppa:dominik-stadler/subversion-1.7<br />
sudo apt-get update<br />
sudo apt-get upgrade<br />
sudo apt-get dist-upgrade<br />
sudo apt-get install subversion<br />

External links

https://launchpad.net/~dominik-stadler/+archive/subversion-1.7

http://askubuntu.com/questions/65468/where-can-i-find-a-subversion-1-7-binary

27 Aug 2012

Posted by: ludek.vodicka

Linux #Linux #svn

How to instal JRE 7 in Ubuntu 12

First step is clean all openjdk from system

sudo apt-get purge openjdk*<br />

Now download latest JRE version from here http://www.oracle.com/technetwork/java/javase/downloads/jre-7u13-download-1501631.html. Download package: **jre-7u13-linux-i586.tar.gz**.

Download package to ~/Downloads and execute following commands

tar -xvf ~/Downloads/jre-7u13-linux-i586.tar.gz<br />
sudo mkdir -p /usr/lib/jvm/jre1.7.0<br />
sudo mv jre1.7.0_13/* /usr/lib/jvm/jre1.7.0/<br />
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 0<br />

External links

http://www.liberiangeek.net/2012/04/install-oracle-java-runtime-jre-7-in-ubuntu-12-04-precise-pangolin/

27 Aug 2012

Posted by: ludek.vodicka

Linux #Linux #java

How to share Ubuntu drive

Today I need to share some testing data (deployment package) from one Ubuntu to another. Probably the simplest way is to install samba-server to Ubuntu and access it from the second one.

How to install samba server in Ubuntu

To install samba server, use:

sudo apt-get install samba<br />
sudo smbpasswd [user-name]<br />

When asked, enter new samba access password for selected user. Now you need to install gnome-install-tools to be able use shares-admin command to view all shared folders

sudo apt-get install gnome-system-tools<br />
shares-admin<br />

Now setup folder sharing and close dialog. From now, you can use

\\computer\shared<br />

to access your samba-shared folder.

How to access samba sharing from Ubuntu

If you want to access samba share from ubuntu using GUI-way, follow next steps:

1) Open Places->Connect to Server
2) Choose Type: Windows Share
3) To "Server" field enter IP of your server (or computer-name)
4) To "Share" enter path of your shared folder
5) "Folder" keep as is "/"
6) Enter user details based on previous samba server settings

Now click "Connect" and your shared folder should be connected.

23 Aug 2012

Posted by: ludek.vodicka

Linux #Linux #samba

Windows, Linux and MacOS 7za equivalent

**Windows:**
http://www.7-zip.org/

**Ubuntu:**

sudo apt-get install p7zip-full<br />

**MacOS:**

sudo port install p7zip<br />

21 Aug 2012

Posted by: ludek.vodicka

Linux Windows Mac OS

Error compiling Qt 4.8.2 under older versions of Ubuntu

If you encounter to this error

error package gstreamer-app-0.10 not found<br />

simply install/reinstall gstreamer packages

sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev<br />
21 Aug 2012

Posted by: ludek.vodicka

Qt Linux #Qt #Linux

How to create .DEB package for Unix Debian-like systems

**This guide isn't complete. Create valid .DEB file is a much harder than I thought. So I will create .DEB file (and update this article) when I will have a more free time.**

This is how now looks lintian result ;-( :

[email protected]:~/dev/Applications/AtomixDevelopment/DeployInfo/Ubuntu$ lintian ormdesigner.deb<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/OrmDesigner2<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/OrmDesigner2<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libQtCore.so.4<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libQtGui.so.4<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_chrono.so<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_chrono.so<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_chrono.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_chrono.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_date_time.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_date_time.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_filesystem.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_filesystem.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_iostreams.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_iostreams.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_regex.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_regex.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_system.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_system.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libboost_thread.so.1.49.0<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libboost_thread.so.1.49.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libexslt.so.0<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libxml2.so.2<br />
E: orm-designer: embedded-library usr/share/orm-designer/libs/libxml2.so.2: libxml2<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libxslt.so.1<br />
E: orm-designer: arch-dependent-file-in-usr-share usr/share/orm-designer/libs/libyaml-cpp.so.0.2<br />
E: orm-designer: unstripped-binary-or-object usr/share/orm-designer/libs/libyaml-cpp.so.0.2<br />
W: orm-designer: unknown-control-file control~<br />
E: orm-designer: control-file-has-bad-permissions postinst 0775 != 0755<br />
E: orm-designer: control-file-has-bad-owner postinst dev/dev != root/root<br />
W: orm-designer: unknown-control-file postinst~<br />
E: orm-designer: control-file-has-bad-permissions postrm 0775 != 0755<br />
E: orm-designer: control-file-has-bad-owner postrm dev/dev != root/root<br />
W: orm-designer: unknown-control-file postrm~<br />
E: orm-designer: no-copyright-file<br />
W: orm-designer: extended-description-line-too-long<br />
W: orm-designer: package-relation-with-self breaks: orm-designer (&lt;&lt; 2.0.1)<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/ 1001/1001<br />
W: orm-designer: non-standard-dir-perm usr/ 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/ 1001/1001<br />
W: orm-designer: non-standard-dir-perm usr/share/ 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/ 1001/1001<br />
W: orm-designer: non-standard-dir-perm usr/share/orm-designer/ 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/OrmDesigner2 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/OrmDesigner2 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/ 1001/1001<br />
W: orm-designer: non-standard-dir-perm usr/share/orm-designer/libs/ 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libQtCore.so.4 1001/1001<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libQtGui.so.4 1001/1001<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_chrono.so 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_chrono.so 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_chrono.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_chrono.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_date_time.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_date_time.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_filesystem.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_filesystem.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_iostreams.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_iostreams.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_regex.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_regex.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_system.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_system.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libboost_thread.so.1.49.0 1001/1001<br />
W: orm-designer: non-standard-executable-perm usr/share/orm-designer/libs/libboost_thread.so.1.49.0 0775 != 0755<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libexslt.so.0 1001/1001<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libxml2.so.2 1001/1001<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libxslt.so.1 1001/1001<br />
E: orm-designer: wrong-file-owner-uid-or-gid usr/share/orm-designer/libs/libyaml-cpp.so.0.2 1001/1001<br />
W: orm-designer: maintainer-script-ignores-errors postinst<br />
W: orm-designer: maintainer-script-ignores-errors postrm~<br />
W: orm-designer: maintainer-script-ignores-errors postrm<br />
W: orm-designer: maintainer-script-ignores-errors postinst~<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_chrono.so 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_chrono.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_date_time.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_filesystem.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_iostreams.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_regex.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_system.so.1.49.0 0775<br />
E: orm-designer: shlib-with-executable-bit usr/share/orm-designer/libs/libboost_thread.so.1.49.0 0775<br />

Prerequisities

sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder<br />

Commands

#creates .deb file<br />
dpkg -b ormdesigner-2.0.1 ormdesigner.deb</p>
<p>#validate .deb file<br />
lintian ormdesigner<br />

How to add screenshot to .DEB file

http://screenshots.debian.net/
http://stackoverflow.com/questions/4776624/how-to-create-deb-package-with-screenshot-for-ubuntu

Errors

E: orm-designer: wrong-file-owner-uid-or-gid usr/ 1001/1001<br />
...<br />

External links

http://www.ibm.com/developerworks/linux/library/l-debpkg/index.html
How to create DEB from source files
How to remove some litian errors

20 Aug 2012

Posted by: ludek.vodicka

Uncategorized Linux #Linux #deploy #ubuntu

Why is compiled Linux executable so large?

Today I encountered another issue when compiling my Qt application http://www.orm-designer.com/ under Linux. The size of final executable was about 400MB.
The first thought was that there is some static libraries compiled to application. But the problem was elsewhere.

Unlike to Windows compilation where linker creates .exe and .pdb file, linux linker creates only one final file. So this file includes also lot of additional symbols useful for debugging and post-mortem bugs finding. But it is not so usefull for distribution your application. To strip all these symbols, use following command

strip --strip-unneeded /path/to/application<br />

Strip command have a lot of switches, but after a short testing it seems that the results are the same. Maybe I'm doing something wrong or simply my executable doesn't contain any additional infos for stripping.

15 Aug 2012

Posted by: ludek.vodicka

Qt Linux #Linux #deploy

The most easiest way how to deploy Qt linux Application

**I found solution also for the problem with executing application form in-app directory!!, Look to text bellow.**
Warning: This solution has one big disadvantage ;-(. It's necessary to execute application only from app-dir. In other cases system doesn't find required libraries.
The solution could be run patchelf on the client computer with final installation path

Today I start working on deploying my http://www.orm-designer.com/ Qt application on linux platform.

I read a lot of articles about deploying applications but all of the suggested methods was impractical, too complex or unusable. Here is a list of them:

  • Using qt.conf in Qt resource or application dir. Usefull for Qt libraries, but not third party libraries
  • Installing Qt and third-party libraries in one of the system library path. This method need root permission for app users
  • Using startup script for setting correct LD_LIBRARY_PATH. Really? It's too complicated for maintenance and users
  • Using -rpath to specify predetermined path. This method requires the users have this directory and have the full access to this directory

Another solution, the simplest one

I'm not sure why this solution isn't mentioned in Qt forums or anywhere else. Maybe this solution isn't so clean and perfect for Linux gurus, but it's perfect for me.

The solution is in simply changing the search path in already compiled application to "." (current directory) **current application location by using $ORIGIN variable**, so application will search all libraries in application directory first. It's simple, it's clean. All libraries distributed with application will be isolated in application directory and app-loader will not load any other library by mistake.

**Updated**: The keyword $ORIGIN do the trick, that you can run application from anywhere on your computer. $ORIGIN is absolute path to your executable.

And how to do this change? As first, you need to download small utility called PatchELF. With this application you can change -rpath in app to anything you need.

patchelf --set-rpath '$ORIGIN' ./ApplicationExecutable<br />

And it is. Now you can copy all required libraries to directory with your application and everything will works correctly.

Installation

Download Ubuntu 32/64bit package from site http://hydra.nixos.org/release/patchelf/patchelf-0.6

Note

Maybe there is a way how to set rpath directly in the linking proces by using -rpath linker param. But I didn't manage it to work.

If you want to display list of shared libraries used by your application, use this command:

ldd ./ApplicationExecutable<br />

External links

15 Aug 2012

Posted by: ludek.vodicka

Qt Linux #Linux #Programming #deploy application

Linux find usage

</p>
<p>#syntax<br />
#find [SETTINGS] PATH [EXPR]</p>
<p>#write all files<br />
find</p>
<p>#write all files in specified diretory<br />
find /usr/dev</p>
<p>#write files with extension .pro<br />
find /usr/dev -name &quot;*.pro&quot;</p>
<p>#write &quot;file&quot;<br />
find /usr/dev -name &quot;*.pro&quot; | echo file</p>
<p>#wite file followed by all files in ONE row<br />
find /usr/dev -name &quot;*.pro&quot; | xargs echo file</p>
<p>#write found file to specified position in echo command (char $ can be raplaced by anything else, for examle {} )<br />
find /usr/dev -name &quot;*.pro&quot; | xargs -I $ echo file: $</p>
<p>#change date time in all *.pro files<br />
find /usr/dev -name &quot;*.pro&quot; | xargs -I $ touch -t 201208131010 $</p>
<p>#find specified texts in files<br />
grep &quot;text&quot; *.pro</p>
<p>#find texts and write also a file name<br />
grep -H &quot;text&quot; *</p>
<p>#write only file names (really don't know how it works ;-) )<br />
grep -h &quot;text&quot; * | cut -d: -f1</p>
<p>#change privileges for files with content<br />
grep -h &quot;text&quot; * | cut -d: -f1 | xargs -I $ chmod 777 $</p>
<p>

14 Aug 2012

Posted by: ludek.vodicka

Linux #Linux #command line

QtCreator: ptrace operation not permitted

Fast fix:

sudo nano /etc/sysctl.d/10-ptrace.conf<br />

and edit following value:

&lt;pre&gt;kernel.yama.ptrace_scope = 0<br />

and reboot. More info about this issue

https://bugreports.qt-project.org/browse/QTCREATORBUG-3509

29 Jul 2012

Posted by: ludek.vodicka

Linux #Qt #Linux

Linux c++ linker - "ld terminated with signal 9"

The linker error “ld terminated with signal 9” is caused by low amount of memory for link process. There are two ways how to fix it.

  • First way is increase computer / virtual machine memory.
  • Second way is by increasing swap file size.

How to increase swap file size

#create new swap file 512x1M size filled with zeros
sudo dd if=/dev/zero of=/extraswap bs=1M count=512
#setup file as a swap file
sudo mkswap /extraswap
#enable created swapfile
sudo swapon /extraswap

If you want to use this swap file also after your computer reboot, you have to do also following steps:

#edit fstab
sudo nano /etc/fstab
#add following line to /etc/fstab
/extraswap           swap                    swap    defaults        0 0

Additional swap-file commands

Here is a list of additional commands which can be useful when working with swap file

#show memory information in KB
free -k
#show existing swap file sizes in KB
swapon -s

External articles about this subject:

26 Jul 2012

Posted by: ludek.vodicka

Uncategorized Linux #Linux

Linux - how to remove Ubuntu Unity

Remove unity

detailed step-by-step instructions:
http://linux-software-news-tutorials.blogspot.com/2011/10/ubuntu-1110-oneiric-remove-unity-and.html

resize window border

https://bugs.launchpad.net/ubuntu/+source/unity-2d/+bug/878198


sudo nano /usr/share/themes/Ambiance/metacity-1/metacity-theme-1.xml </p>

<frame_geometry name="frame_geometry_normal"....
left_width, right_width and bottom_height from 1 to 3.
</code>

21 May 2012

Posted by: ludek.vodicka

Linux

Linux - problem with gdb

How to solve problem with gdb: "ptrace: operation not permited"

http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails-with-ptrace-operation-not-permitted/

sudo chmod +s /usr/bin/gdb<br />
21 Mar 2012

Posted by: ludek.vodicka

Linux #Linux #C++

Ubuntu - Configure VirtualBox Shared Folders

</p>
<p>mkdir /mnt/vbox_share</p>
<p>mount.vboxsf SHARED_FOLDER /mnt/vbox_share<br />

To mount this every time linux boots, edit the file /etc/rc.local and put the following line at the start:
mount.vboxsf VirtualBox /mnt/vbox_share

More: http://my-wd-local.wikidot.com/otherapp:configure-virtualbox-shared-folders-in-a-windows-ho

02 Mar 2012

Posted by: ludek.vodicka

Linux #Linux

Qt on Ubuntu and Missing menu icons

This isn't bug, but feature ;-). It's described here: https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/501468

These commands fixed the issue:

gconftool-2 --type boolean --set /desktop/gnome/interface/buttons_have_icons true<br />
gconftool-2 --type boolean --set /desktop/gnome/interface/menus_have_icons true<br />

14 Feb 2012

Posted by: ludek.vodicka

Qt Linux

How to relocate svn under linux

svn switch --relocate http://192.168.0.100:3353/svn/applications http://192.168.0.111:3344/svn/applications

09 Sep 2011

Posted by: ludek.vodicka

Linux

g++ error: conversion from XTestObjectA to non-scalar type XTestObjectBase requested

//error<br />
XTestObjectBase objTestObjectBase1 = objTestObjectA;</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase2(objTestObjectA);</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase3; objTestObjectBase3 = objTestObjectA;<br />

cite from: http://stackoverflow.com/questions/6120240/why-constructor-is-not-called-for-given-casting-operator

The problem is that the number of user-defined conversions that are invoked implicitly is limited (to 1) by the Standard.

B ob = a;
implies two user conversions:

on a: Wrap::operator A*() should be called
on the result: B::B(A*) should be called

The solution is to use explicit conversion

//now ok<br />
XTestObjectBase objTestObjectBase1 = XTestObjectBase(objTestObjectA);<br />
07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++

g++ error: expected primary-expression before > token

For g++ compiler is sometimes necessary to specify more typename / template keywords than for Visual Studio. This is one of examples.

To the following code it's necessary to add template keyword:

TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />

use

TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.template CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />

07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++ #templates

MinGW and compilation 32/64bit libraries

Install MinGW-64

1) Download MinGW 64-bit and 32-bit

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/

- Toolchains targetting Win64 / Toolchains targetting Win32
- Automated Builds
- mingw-w64-1.0-bin_i686-mingw_*.zip
- mingw-w32-1.0-bin_i686-mingw_*.zip

2) Download MSYS compatible with 64-bit MinGW

http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20(Win64%20hosted)/MSYS%20(32-bit)/

3) Extract MinGW32, mingw64 and MSYS to one folder

MinGW-32, MinGW-64 and MSYS to folder MinGW64 (Bin folder from MinGW will be merged with bin folder from MSYS, etc.)

**External links:**

MSYS wiki
MinGW-64 wiki

30 Jan 2011

Posted by: ludek.vodicka

Programming Linux Windows #Linux #C++ #Windows #cygwin

How to parse Apache Log and insert data to MySQL database

#!/bin/bash

echo Generating new data from log
echo "#generated sql file" > data.sql

echo "truncate table log_data;" >> data.sql
echo "START TRANSACTION;" >> data.sql

FIND_PATTERN="\
\(\S*\)\s*\
\(\S*\)\s*\
\(\S*\s*\S*\)\s*\
[\x5B]\([^\x5D]*\)[\x5D]\s*\
\"\([^\"]*\)\"\s*\
\(\S*\)\s*\
\(\S*\)\s*\
\"\([^\"]*\)\"\s*\
\"\([^\"]*\)\"\s*\
";

REPLACE_PATTERN="\
INSERT INTO log_data \
(domain,ip,other,date,url,status,size,referral,clientstring) \
VALUES \
('\1','\2','\3','\4','\5','\6','\7','\8','\9');";

APACHE_FILE="other_vhosts_access.log";

if [ -f $APACHE_FILE.size ];
then
ALREADY_PROCEED=`cat $APACHE_FILE.size`
echo "Already proceed size ($APACHE_FILE): "$ALREADY_PROCEED;
else
ALREADY_PROCEED=0;
echo "New log file $APACHE_FILE";
fi

FILTER_PATTERN="\.css|\.ico|\.png|\.jpg|\.txt|\.js|\.gif|\.swf"

#echo $FIND_PATTERN"/"$REPLACE_PATTERN;

cat $APACHE_FILE |
tail -c +$ALREADY_PROCEED | #preskocime jiz zpracovane radky
#head -5000 | #debug
#head -1128863 | #tail -2 |
#tail -n +1177103 | head -3 |
#sed -r "s/(\(.*\))//g" | #debug - odebere z clientstring (...)
#sed "s/^[^+]*//g" | #debug - odebere pocatek stringu az do GET
#sed -r "s/Mozilla|Gecko|Firefox//g" | #debug odebere tyhle klicovy slova
sed -r "s/^(subdomain|www)\.//" | #odebereme prefix subdomain. a www.
sed -r "s/^([^:]*)(:[0-9]*)/\1/" | #odebereme port
sed -r -n "/^(orm-|inventic).*/p" | #exportujem jen nektere domeny
sed "s/\([\x5c][\x22]\)//g" | #odebrani \" retezcu
sed "s/\([']\)//g" | #odebrani apostrof ktery delaj pak bordel v$
sed -r "s/ \"GET ([\x2F].*) HTTP[\x2F][0-9.]*/ \"\1/" | #dame pryc GET a HTTP1.1
#sed -r -n "/$FILTER_PATTERN/p" #| debug- vypise filtrovane .css/.png/...
sed -r "/$FILTER_PATTERN/d" | #vyfiltrujeme pryc .css, .png atd
#sed "/^$FIND_PATTERN$/d" | #debug - toto lze pouzit na vypis radku kte$
sed -n "/^$FIND_PATTERN$/p" | #vypiseme vsechny radky ktere jsou validni
sed "s/$FIND_PATTERN/$REPLACE_PATTERN/" >> data.sql

echo "COMMIT;" >> data.sql

#ulozime velikost zpracovaneho logu

stat -c&quot;%s&quot; $APACHE_FILE &gt; $APACHE_FILE.size<br />
#vlozime data do Mysql<br />
echo Putting data to MySQL<br />
mysql \<br />
  --user=root \<br />
  --password=1234 \<br />
  --host=192.168.0.10 \<br />
  --database=server_log &lt; data.sql</p>

17 Jan 2011

Posted by: ludek.vodicka

Linux #Linux #Apache #Bash

Mount error(12): Cannot allocate memory

Problem

When mounting some windows samba drives, "mount error(12)" error can occurred. Problem is in windows samba server settings. Full linux error message:

mount error(12): Cannot allocate memory<br />
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)<br />

and error message in windows event log:

Source: srv<br />
Event ID: 2017<br />
Level: Error<br />
The server was unable to allocate from the system nonpaged pool because the server reached the configured limit for nonpaged pool allocations.<br />

Solution

Update following registry:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache = 1<br />
HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size = 3<br />

After you update these values, restart your computer.

More about this issue:

http://alan.lamielle.net

13 Dec 2010

Posted by: ludek.vodicka

Linux Windows #Linux #Windows

How to deploy Qt application on MacOs

Missing dylib libraries

If your application using some externals dynamic libraries (called .dylib in MacOs system), you have to provide all these libraries. The simplest way is to provide these libraries into the Application.app directory.

Find out which libraries are used

Qt provide really useful tool called **"otool"** which serves to lots of purpose. One of them is to detect which shared libraries are required by our application. For this purpose otool has parameter -L. The usage is following:

otool -L ./Test1.app/Contents/MacOS/Test1<br />

Output could looks like this:

./Test1:<br />
        libboost_iostreams.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_thread.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_date_time.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_regex.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        /Users/dev/dev/SharedLibraries/libiconv/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxml/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxslt/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxslt/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.15.0)<br />
        /Users/dev/dev/ExternalLibraries/yaml-cpp-0.2.5/build/libyaml-cpp.0.2.dylib (compatibility version 0.2.0, current version 0.2.5)<br />
        QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.0)<br />
        QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.0)<br />
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)<br />
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)<br />
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)<br />

Output from "otool" is simmilar to linux tool "ldd".

The Mac Deployment Tool

Because manual copying and configuring all shared libraries to our application could be difficult, Qt have deployment tool which do all work for us. Tool is called "macdeployqt" and can be found in /Developer/Tools/Qt/macdeployqt.

 /Developer/Tools/Qt/macdeployqt ./GeneratedFilesMacOs/Debug/Test1.app<br />

**Note:** Every time when you call macdeployqt tool, project have to be build from scratch. But is sufficient when whole result directory is removed and linked again:

rm -rf ./GeneratedFilesMacOs/Debug/Test1.app/<br />
make<br />
13 Dec 2010

Posted by: ludek.vodicka

Programming Qt Linux #Qt #MacOs #Linux #C++ #Programming

g++ template method problem

Quick post about problem which I already solved, but think that could be handy for someone else.

I have following code:

template&lt;class T&gt;
struct Test
{
	T val;
	template &lt;class T2&gt;
	void DoSomething( T2 &amp;obj )
	{
		obj.FindByType&lt;int&gt;();
	}
};

When compiling under Visual studio, everything is ok. But when try the same code snippet under g++, have following error:

test.cpp: In member function ‘void Test&lt;T&gt;::DoSomething(T2&amp;)’:
test.cpp:48: error: expected primary-expression before ‘int’
test.cpp:48: error: expected ‘;’ before ‘int’

This is because compiler doesn’t known FindByType method, because T2 is templated argument. The solution which I found is in adding keyword template before FindByType method name. So updated source code will look like this:

template&lt;class T&gt;
struct Test
{
	T val;
	template &lt;class T2&gt;
	void DoSomething( T2 &amp;obj )
	{
		obj.template FindByType&lt;int&gt;();
	}
};

After this update, code will be compiled correctly under both compilers.

03 Dec 2010

TENG - c++ templating engine

Project site: http://teng.sourceforge.net/?page=home

External project documentation: http://teng.olmik.net/

Latest TENG source code: http://teng.cvs.sourceforge.net/teng/ (**Note**: Source code referenced from main site isn't latest! )

How to compile TENG on windows

Compilation under Windows is possible only using MinGW and with few modifications in TENG code (because there is few glitch which didn't meet c++ standards). If you want more information or updated TENG version, please let me know.

15 Nov 2010

Posted by: ludek.vodicka

Programming MinGW Linux #MacOs #Linux #C++ #Windows

How to show all defines for compiler

Sometime it's useful to know what defines are available on specific platform and compiler. Here is command which shows these defines:

touch test.export<br />
g++ -dM -E test.export<br />
15 Nov 2010

Posted by: ludek.vodicka

Programming Linux #Linux #C++

How to install and configure git with ssh key

  • Download git client depends on your OS platform
  • Open your .ppk key in PuTTY Key generator and export key to OpenSSH key:
  • Content of this OpenSSH key store to file ~/.ssh/id_dsa (copy exported key to ~/.ssh folder and rename it to id_dsa)
  • Now change security permissions on this file to 400 (chmod 400 ~/.ssh/id_dsa)
  • Now cal ssh-add to load id_dsa key

And it's done. Now you can use your git. For example clone some repository:

git clone ssh:[email protected]/~/repository/example.git<br />

Automatic ssh-key loading during startup:

TODO

14 Nov 2010

Posted by: ludek.vodicka

Programming Linux #Linux #Git

Linux tips

Here is few tricks for Linuch which we needed during our exploration of this system ;-)

How to change executable flag for scripts recursively

find -iname '*.sh' | xargs chmod 777

How to configure shared library path

Add file atomix.conf to directory /etc/ld.so.conf.d. To this file enter following:

# atomix libraries
/home/USER_NAME/dev/SharedLibraries/libs

and then run

sudo ldconfig

External link: http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

VIM cheat sheet

External link: http://www.tuxfiles.org/linuxhelp/vimcheat.html

How to resize partition

Use gparted

sudo apt-get install gparted<br />

Measure disk write speed

time sh -c &quot;dd if=/dev/zero of=ddfile bs=8k count=100000 &amp;&amp; sync&quot;<br />

10 Nov 2010

Posted by: ludek.vodicka

Linux #Linux

How to configure MacOs for Qt programming.

How to configure script for automatic run after login

Create startup-script(or any other)file in your home directory. Then enter following command

nano startup-script
chmod 777 ./startup-script
sudo defaults write com.apple.loginwindow LoginHook /Users/thomas/.startup-script

Another solution is to create .bash_profile file, which is launched automatically by system.

or create

How to configure new search path

If you want to have bin folder in your home directory, enter following code snippet to your .profile file located in your home directory:

export PATH=$PATH:/Users/user_name/bin

Open file using:

nano ./.profile

**Note:**Path is separated by char ":".

How to instal apt-get alternative for MacOS

Mac OS have apt-get alternative called "**port**".

Additional notes

Realtek RTL81xx macOs version:

How to mount Windows drive from MacOs

As first, create some directory where you want to mount your shared drive

mkdir mnt
cd mnt
mkdir computer_d
mount -t smbfs //user_name:[email protected]/d computer_d

</div>

Conclusion & Note

It's possible that all of these task can be done in simpler way, or can't be done at all. All comments and tips are based on my current experience with my first MacOS configuration in my life ;-)

04 Nov 2010

Posted by: ludek.vodicka

Qt Linux #Qt #MacOs