Category: Programming

Anjuta: an alternative IDE for pyGI

This tutorial will show you how to compile Anjuta from the source, this is necessary because the latest version available on repository is not always updated. The following steps are tested on Xubuntu 14.04.

 

Install dependencies
sudo apt-get git install flex bison g++ libglib2.0-dev libgtk-3-dev libxml2-dev libgdl-3-dev libgda-5.0-dev libgtksourceview-3.0-dev intltool itstool libxml2-utils

If you want to build also the documentation:

sudo apt-get install yelp-tool gtk-doc-tools

 

Plugins dependencies

if you need the Glade plugin:

sudo apt-get install libgladeui-dev

if you need the DevHelp plugin:

sudo apt-get install libdevhelp-dev

if you need the terminal plugin:

sudo apt-get install libvte-2.90-dev

if you need the python plugin:

sudo apt-get install python-dev python-rope

if you need the subversion plugin:

sudo apt-get install libsvn-dev

if you need the vala plugin:

sudo apt-get install libvala-0.22-dev valac

 

Get source from repository
git clone https://github.com/GNOME/anjuta.git anjuta-git
cd anjuta-git

 

 Configure and compile
./autogen.sh

if you have installed all packages needed by each plugin, you should get:

-------------------------------------------------------------------
 Conditionally built plugins:
 -------------------------------------------------------------------
 Building subversion plugin: ............................YES
 Building glade plugin: .................................YES
 Building devhelp plugin: ...............................YES
 Building terminal plugin: ..............................YES
 Building Vala support: .................................YES
 Building python plugin loaeder: ........................YES
 -------------------------------------------------------------------

then

make -j4
sudo make install

The executable file will be placed in /usr/local/bin/anjuta but if you lauch Anjuta from command line you will encounter this error:

$ anjuta
anjuta: error while loading shared libraries: libanjuta-3.so.0: cannot open shared object file: No such file or directory

In fact if we check the loaded libraries we will find out that the problem concerns libanjuta-3.so.0 (not found) which is not in the path

ldd /usr/local/bin/anjuta
linux-vdso.so.1 =>  (0x00007fff0e9c9000)
libgtksourceview-3.0.so.1 => /usr/lib/x86_64-linux-gnu/libgtksourceview-3.0.so.1 (0x00007f68faff9000)
libgdl-3.so.5 => /usr/lib/x86_64-linux-gnu/libgdl-3.so.5 (0x00007f68fadca000)
...
libanjuta-3.so.0 => not found
...

libanjuta-3.so.0 is located in /usr/local/lib which is not included in the default path:

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Add /usr/local/lib to the path permanently:

sudo touch /etc/profile.d/local_lib.sh

Edit /etc/profile.d/local_lib.sh as follow:

# set PATH so it includes local lib if it exists
if [ -d "/usr/local/lib" ] ; then
    PATH="/usr/local/lib:$PATH"
fi

Update the path:

. /etc/profile.d/local_lib.sh

Finally we can launch Anjuta:

anjuta -v

Anjuta 3.18.2

Disable output buffering on stdout

Why does printf not flush after the call unless a newline is in the format string?

By default, the stdout stream is buffered while stderr is not, so stdout will only display what’s in the buffer after it reaches a newline (or when it’s told to). You have a few options to print immediately:

Print to stderr instead using fprintf:

fprintf(stderr, "I will be printed immediately");

Flush stdout whenever you need it to using fflush:

printf("buffered, will be flushed");
fflush(stdout); /* will now print everything in the stdout buffer */

flush everything:

fflush(NULL)

disable buffering on stdout by using setbuf:

setbuf(stdout, NULL);

WordPress Themes