Popular Posts

Saturday, January 7, 2012

Compiling and Installing WFDB version 10.5 on Debian Squeeze

Today I tried to compile and install the WFDB tools from the PhysioToolkit (PhysioNet) on my Debian Squeeze system. I am documenting this experience here!

  1. Download the source package from http://www.physionet.org/physiotools/wfdb.tar.gz
  2. Install the needed Debian packages first. I needed the following Debian packages
    • libcurl4-gnutls-dev (for NETFILES feature support in WFDB, which allows you to work on portions of the PhysioBank data records online, without having to download the entire record on your computer)
    • libexpat1-dev (for XML parsing, some files did not compile successfully while installig the WFDB library because this package was missing)
  3. Follow the steps under "if you download the sources (recommended):" in the official quick start guide. If you are on a 64-bit system (like me!) then do NOT install the WAVE application now
  4. If you installed the WFDB library in a non-standard path (as I did), then probably you will need to adjust the $PATH and $LD_LIBRARY_PATH environment variables. I added the following snippet to my ~/.bashrc, (this will be automatically executed every time you login into a shell -- run '. ~/.bashrc' ('DOT SPACE ~/.bashrc') to execute the profile script immediately!) -- I also needed to manually copy the 'man' folder from the "(path to WFDB installation)/share/man" to '/usr/share/man' for manual enteries to be installed into the system!
  5. # add WFDB binaries to PATH
    PATH="$PATH:(path to WFDB installation)/bin"

    # add WFDB libraries to LD_LIBRARY_PATH
    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:(path to WFDB installation)/lib64"
  6. Now you are ready to install the optional WAVE application in case you are running a 64-bit system. For this, I followed the instructions in this post. (Note: package ia32-libs must be installed!) Finally, you will need to further modify your ~/.bashrc to append the following
# add WFDB-32 binaries to PATH
PATH="$PATH:(path to WFDB-32 installation)/bin"

# add WFDB-32 libraries to LD_LIBRARY_PATH
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:(path to WFDB-32 installation)/lib"
Update1: With WFDB version 10.5.13 on Ubuntu 12.04, I had to manually change two lines in each Makefile of the subdirectories (app,checkpkg,convert,examples,fortran,psd,xml) to compile with libcurl successfully
LC = `curl-config --cflags`
LL = `curl-config --libs`

Otherwise, I was getting errors such as
ann2rr.c: In function ‘help’:
ann2rr.c:370:6: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_global_cleanup'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_easy_perform'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_global_init'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_easy_init'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_version'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_easy_setopt'
/home/islam/wfdb/wfdb-10.5.13/build/lib64/libwfdb.so: undefined reference to `curl_easy_cleanup'
collect2: ld returned 1 exit status
make[2]: *** [ann2rr] Error 1

Update2: Check the solution posted by Murari Srinivasan and George Moody (the author of WFDB) in the comments below. The error above is temporary and should be resolved soon out-of-the-box.