library mismatch problem and solution


When I tried to run a executable that had been built at other machine, it showed following error :

$ ./regdaemon
./regdaemon: /usr/lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.20' not found (required by ./regdaemon)



The reason of this error was because dynamic linking library's version was lower than the library version used in the build machine.

On the build machine, the library is like following:

/usr/lib/x86_64-linux-gnu$ ll libstdc*
lrwxrwxrwx 1 root root      19 Nov  4  2014 ->
-rw-r--r-- 1 root root 1011824 Nov  4  2014

This means that the library that is actually used by the executable is and links to it. This library is installed with new gcc.

On the other machine that showed error, the library was like following:

/usr/lib/x86_64-linux-gnu $ ll libstdc*
lrwxrwxrwx 1 root root     19 May 14 14:11 ->
-rw-r--r-- 1 root root 979056 May 14 14:41 links to and it is older version than on the build machine.



Since the machine was linux mint, which was debian, newest gcc can be installed by following command :

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9

Then the library is updated like this :

/usr/lib/x86_64-linux-gnu $ ll libstdc*
lrwxrwxrwx 1 root root      19 Apr 23 13:00 ->
-rw-r--r-- 1 root root 1541600 Apr 23 13:23

Now, because installed library was newer than in the build machine, the executable worked well.

The other solution will be linking statically by adding <code>-static-libgcc</code> option.

additional information

Which files(file/socket etc.) are opened by a process can be seen using "lsof" utility.

hosung@hosung-Spectre:~$ lsof -p 6002
regdaemon 6002 hosung  cwd    DIR                8,2     4096 2589221 /home/hosung/cdot/ccl/regdaemon/Debug
regdaemon 6002 hosung  rtd    DIR                8,2     4096       2 /
regdaemon 6002 hosung  txt    REG                8,2  1066943 2545008 /home/hosung/cdot/ccl/regdaemon/Debug/regdaemon
regdaemon 6002 hosung  mem    REG                8,2    47712 2117917 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2    14664 2117927 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2   100728 2101352 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2  1071552 2117915 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2  3355040 6921479 /usr/lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2  1840928 2117938 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2    92504 2097171 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2  1011824 6846284 /usr/lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2  1112840 6830431 /usr/lib/
regdaemon 6002 hosung  mem    REG                8,2   141574 2117939 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung  mem    REG                8,2   149120 2117935 /lib/x86_64-linux-gnu/
regdaemon 6002 hosung    0u   CHR             136,23      0t0      26 /dev/pts/23
regdaemon 6002 hosung    1u   CHR             136,23      0t0      26 /dev/pts/23
regdaemon 6002 hosung    2u   CHR             136,23      0t0      26 /dev/pts/23
regdaemon 6002 hosung    3u  IPv4              63342      0t0     TCP localhost:60563->localhost:mysql (ESTABLISHED)
regdaemon 6002 hosung    4u  unix 0x0000000000000000      0t0  114861 /tmp/cc.daemon.sock

scp/sftp through ssh turnnel

SSH Tunneling

Machine CC can be connected from another machine called zenit.
To do scp to CC through zenit, following command establish a ssh tunnel to CC.

ssh -L 9999:[address of CC known to zenit]:22 [user at zenit]@[address of zenit]
in my case,
ssh -L 9999:

Now, 9999 port of localhost( is for tunnel to CC through zenit.
This session need to be alive to do all followings.


SCP through the SSH Tunnel

Then these commands do scp from local test.png file to CC:~/tmp and copy from CC:/tmp/test.png to ..

scp -P 9999 test.png ccuser@
scp -P 9999 ccuser@ .


Making it easy

Typing those long command is not a good idea.
I added an alias to .bashrc.

alias ccturnnel='ssh -L 9999:'

Then wrote two simple bash script.

This is cpfromcc.

var=$(echo $1 | sed 's/\/home\/hosung/~/g')
scp -P 9999 ccuser@$remote $2

This is cptocc.

for var in "$@"
    if [ $i -ne $# ]
        values="$values $var"
        var=$(echo $var | sed 's/\/home\/hosung/~/g')
scp -P 9999 $values ccuser@$remote

The reason why I use sed for remote path is because bash changes ~ to my home directory.
Now I can establish ssh tunnel by typing ccturnnel.
Then I can do scp from my machine to CC using :

cptocc test.jpg test2.jpg ~

And I can do scp from CC to my machine using :

cpfromcc ~/remotefile.txt .


Making it convenient using sftp

When the tunnel is established, sftp is the same.

$ sftp ccuser@


Making it more convenient using Krusader

By typing sftp://ccuser@ in the URL bar of the Krusader, and then by adding the place to the bookmark, the remote machine’s file system is easily accessed.

Screenshot from 2015-06-26 10:23:39

Mounting it using sshfs also will be possible.

Emacs diary additional functionality

On my another posting about Everyday Text File and emacs LISP Customization, I made a fast way to make a text file every day for diary. Also, there was a way to find information from diaries. However, sometimes, I want to see yesterday’s diary, and previous/next day’s diary of current diary file. To make this, I wrote a bash script and LISP functions.

Bash script that opens previous/next file


fname=$(basename $2)

if [ "$1" == "next" ]
    a=$(ls /diary | grep -C1 $fname | tail -1)
    echo "/diary/"$a
elif [ "$1" == "prev" ]
    b=$(ls /diary | grep -C1 $fname | head -1)
    echo "/diary/"$b

This script gets a file name and return previous file or next file. In this case it returns previous day’s file or next day’s file when I run like this : prev

When there is file it opens it. If now, it opens a previous file that there is.

LISP functions for emacs

(defun prevfile ()
  (find-file (substring (shell-command-to-string (format "~/sh/ prev %s" (current-buffer)))0 -1) )

(defun nextfile ()
  (find-file (substring (shell-command-to-string (format "~/sh/ next %s" (current-buffer)))0 -1) )

(global-set-key (kbd "C-S-<prior>") 'prevfile)
(global-set-key (kbd "C-S-<next>") 'nextfile)

M-x prevfile takes current buffer name, which is the file name, and open previous file in the diary directory. I set short cuts using global-set-key.
Ctrl+Shift+PageUp opens previous day’s diary
Ctrl+Shift+PageDown opens next day’s diary
and in my case, Ctrl+PageUp/PageDown opens previous/next buffer in emacs.

SIRIUS – Open-Source Digital Assistant


Using SIRIUS, we can build our own Siri, Google Now or Microsoft Cortana. SIRIUS is open source speech and vision based intelligent personal assistant service.

It recognizes speech and image, and give answer based on web search.


Possible idea using SIRIUS

  • Using image matching part for Creative Commons image searching (my current project)
  • Building it on Raspberry Pi that has video camera. -> Almost Google glass
  • Desktop application as an assistant (using voice recognition and screen capture)
  • Browser extension that calls SIRIUS to get information from image or text

CentOS minimum installation : network setup, GNOME Desktop Install

Network Setup

There are difficult way and easier way to setup network in command line. Editing /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/resolv.conf will be the difficult way.

Easier way is using this command :

$ nmcli & nmtui

You can see GUI and put static address easily, and see the Wifi network AP list and connect with password.

GNOME Desktop Install

  1. Check installation
    $ sudo yum check-update
  2. Install gnome package
    $sudo yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
  3. Make the system start with GUI
    $sudo ln -sf /lib/systemd/system/ /etc/systemd/system/

Screenshot from 2015-02-25 14:32:38

Markdown format

Recently, I started to use Markdown format as a personal memo format. This is by far the one I was looking for. I always wanted a text format that can be easily formatted as HTML, at the same time, it should be easy to write, and text file itself should be readable. Markdown has all that features and it is already widely being used.
I was thinking about using wiki format. There is local wiki editor and viewer called Zim Desktop Wiki. Emacs also has wiki mode. However, sharing with other devices was painful.

About Markdown

Markdown is developed in 2004 by John Gruber “to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid XHTML”


Following links are useful :

Benefit in the local memo file with emacs

To write everyday activities, I was using text files that are everyday generated by emacs (link). It was good, but to share it, I had to copy it to evernote or something.
By using emacs’ Markdown mode, I can see the text with little bit of formatting using color and bold. Also, it gives fast way to insert Markdown formatting keywords.
Now all my text file extension is .md and emacs generates it automatically.

Benefit in mobile sharing with dropbox

When I put the diary directory’s link to dropbox sync directory, the files are automatically synchronized as soon as I edit them.
There is an Android app called “Draft“. It supports Dropbox synchronization for Text and Markdown format. Also it shows formatted Markdown. Of course, it has editing feature.
As a result, when I add or edit a text in the Android Draft app, it is synchronized to my laptop’s diary directory. Now, I do not need evernote. “Draft” looks like this :

Benefit with github

github uses Markdown as readme and all kind of text file. So, if I write my local file using markdown, it can be directly used as github text.

Benefit with wordpress

wordpress supports Markdown. This posting and previous posting was written using Markdown. It is much faster than typing html tag for making list and table. Also, my Markdown memo can be directly posted as a wordpress posting.

Chrome Extension

There is a Markdown Preview Plus chrome extension. If the markdown file is opened by chrome using “file:///home/hosung/diary/” or drag-drop, it shows generated HTML on the page using CSS for github style or other style. Optionally, the page can reload changed file every 1+ seconds.

Emacs Integration

I wrote a simple LISP script to add into .emacs file. By using it, currently editing file can be quickly opened in chrome by typing M-x chrome or Ctrl-Shift-c.

(defun chrome ()
   (format "google-chrome --activate-existing-profile-browser %s" buffer-file-name ))
(global-set-key (kbd "C-S-c") 'chrome)


How to change VirtualBox HDD size on Linux

The storage in my Windows 7 VM on the VirtualBox fell short. HDD size was 29GB. I forgot how to extend it, so I am writing how to do it here after doing it.

My system is Ubuntu 14.04 LTS and VirtualBox 4.3.20

The command is “VBoxManage modifyhd” and the vdi file is in “~/VirtualBox VMs/Win7/Win7.vdi”

$ sudo VBoxManage modifyhd ~/VirtualBox\ VMs/Win7/Win7.vdi --resize 45000
[sudo] password for hosung:

Now in the “Disk Management” I can check that there is Unallocated 14.65GB. Select “Extend Volume” as follows:

Screenshot from 2015-02-06 16:57:28

Now C drive size is 43.84 GB.

Screenshot from 2015-02-06 17:00:03