Linux Development Links

This is a list useful resources for Linux development and can be used as a cheat sheet or link collection. If you find errors or want to add something please post a comment below!

API Documentations

Autotools

  • Standard bootstrap: First try maintainer supplied autogen.sh:
    sh autogen.sh

    Second try:

    autoreconf -i
    ./configure
    
  • configure - Passing extra CFLAGS, LDFLAGS, ...
    ./configure "CFLAGS=-Wall -Wextra -I/opt/mylib/include" "LDFLAGS=-Lmy"

CI Solutions

Compiler

  • GCC - Mix Static and Dynamic Linking
  • GCC - Link all static
    gcc -static ...
  • GCC - Link libgcc static
    gcc -static-gcc ...
  • GCC - Partial static linking
    gcc ... -Wl,-Bstatic <list of static libs> -Wl,Bdynamic <list of dynamic libs>
  • GCC - Useful warnings
    -Wall -Wunused -Wextra -Wno-pointer-sign -Wno-unused-parameter

Database

Debugging

Debugging Memory Leaks

  • Glib - mtrace(): Enable tracing by calling mtrace() right on startup and set environment variable
    export MALLOC_TRACE=alloc.log

    and analyze the result log with

    mtrace [<executable>] alloc.log
  • Glib - Slice Allocation Checking
    export G_SLICE=debug-blocks
  • Valgrind
    valgrind --leak-check=yes <executable> [ [...]]
  • JVM - Verbose GC:
    -verbose:gc –XX:+PrintGCDetails –XX:+PrintGCTimeStamps –Xloggc:/gc.log
  • JVM - jstat:

git Cheat Sheet

GTK+/GNOME

  • Glib Debugging
    # Stop on assertions:
    export G_DEBUG=fatal_warnings
    export G_DEBUG=fatal_criticals
    
    # Logging from all glib based libraries
    export G_MESSAGES_DEBUG=all
    
    # Check memory allocation 
    export G_SLICE=debug-blocks
    
  • GConf - Access config trees:
    # Print a key's schema
    gconftool-2 --get /schemas/apps/liferea/browser
    
    # Print a key value
    gconftool-2 --get /apps/liferea/browser
    
    # Set a key
    gconftool-2 --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled false
    
  • dconf - Access GSettings config trees:
    # Print a key value
    gsettings get org.gnome.liferea browser
    
    # Set a key value
    gsettings set net.sf.liferea browser 'firefox %s'
    
    # Print subtree (mandatory trailing slash!)
    dconf dump /apps/liferea/
    
    # Dump and Restore non-default values
    dconf dump /apps/liferea/  >liferea.dump
    dconf load liferea.dump
    
    # Reset a single key to schema default
    dconf reset /apps/liferea/last-window-height
    
    # Reset an entire tree to schema
    dconf reset -f /apps/liferea/
    
  • Testing for GConf/DConf schema migration:
    cd /usr/share/GConf/gsettings
    # Here you find .convert files per application
    
    # Check for conversion using
    gsettings-data-convert --verbose --dry-run <.conver file name>

Packaging

  • Build Tarballs with XZ: Build different types of tarballs
    make dist            # .tar.gz
    make dist-bzip2      # .tar.bz2
    make dist-lzma       # .tar.lzma
    make dist-xz         # .tar.xz
    
    # Extract with
    tar zxf archive.tar.gz
    tar jxf archive.tar.bz2
    tar Jxf archive.tar.lzma
    tar Jxf archive.tar.xz
    
  • AppData freedesktop.org specification: Standard for end user SW description markup.
  • AppData - Validation:
    appdata-validate /usr/share/appdata/myapplication.appdata.xml

Scripting

Translating

  • gettext - Update .pot file
    cd po && make update-po
  • gettext - Statistics: Show translation statistics
    for pofile in *.po; do echo -n "$pofile "; msgfmt --statistic $pofile; done

Technologies

  • CORBA: a mind map about CORBA terminology and architecture
  • FMC: a mind map on FMC modelling (German)
  • Gearman - Jobserver

Web

These are not strictly Linux...

XML

  • Pretty-print XML:
    xmllint --format my.xml
  • XPath on the command line
    # Print subtree of tag 'sometag'
    xmllint --xpath "//sometag" data.xml
    
    # Match an attribute 'someattr' of 'sometag' to have literal 'string'
    xmllint --xpath "//sometag[contains(@someattr, 'string')" data.xml
    

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
Syndicate content