Notes about open source software, computers, other stuff.

Month: October 2012

Testing for the presence of the “Eigen” headers using autoconf

For the ProbABEL project I’m working on I wanted to test for the presence of the Eigen header files using . Eigen is a C++ template library for linear algebra. It basically consists of a bunch of header files. On my PC the Eigen files are installed in /usr/include/eigen3/ since I used the Debian/Ubuntu libeigen3-dev package.

I first tried to test for the headers by simply including

AC_CHECK_HEADERS([eigen3/Eigen/Dense])

in configure.ac, but that didn’t work:

...
checking eigen3/Eigen/Dense usability... no
checking eigen3/Eigen/Dense presence... no
checking for eigen3/Eigen/Dense... no
...

It turns out that you have to add the following lines to configure.ac:

AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([eigen3/Eigen/Dense])
AC_LANG_POP([C++])

Now I get the following output when running ./configure:

...
checking how to run the C++ preprocessor... g++ -E
checking eigen3/Eigen/Dense usability... yes
checking eigen3/Eigen/Dense presence... yes
checking for eigen3/Eigen/Dense... yes
...

To go into a bit more detail, these are the errors in config.log without the AC_LANG options:

...
configure:4877: checking eigen3/Eigen/Dense usability
configure:4877: gcc -c -g -O2 -Wall conftest.c >&5
In file included from /usr/include/eigen3/Eigen/Core:35:0,
                 from /usr/include/eigen3/Eigen/Dense:1,
                 from conftest.c:67:
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:188:5: error: unknown type name 'namespace'
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:188:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
In file included from /usr/include/eigen3/Eigen/Dense:1:0,
                 from conftest.c:67:
/usr/include/eigen3/Eigen/Core:98:12: error: expected identifier or '(' before string constant
In file included from /usr/include/eigen3/Eigen/Dense:1:0,
                 from conftest.c:67:
/usr/include/eigen3/Eigen/Core:144:18: fatal error: cerrno: No such file or directory
...

It seems to be the case that AC_LANG is set to C instead of C++ and consequently compilation of autoconf’s test programme fails. The AC_LANG_PUSH option forces autoconf to use C++.

Thanks to this post on Stack Overflow I could solve this problem.

Related Images:

Subversion: merging updates in trunk to a branch

Yesterday I was working on ProbABEL, an open source package for running GWAS (genome-wide association studies). We use R-Forge and they provide us with a Subversion (SVN) server for revision control.

Some time ago we created a branch in which one of the co-developers is doing some major refactoring of the code. In the mean time I have been fixing bugs and adding new features to trunk. Now that the work in the refactoring branch comes to an end I thought it was high time to integrate the changes in trunk with the changes in the branch so that we can later promote the branch to trunk.

Since I had never done this before I decided to try the merge in the doc directory first, because I knew that in that directory nothing had changes since the branch was created, so all changes from trunk should be imported. At first I followed the SVN book instructions so I went into the doc dir in the branch and ran

$ svn merge ^/pkg/ProbABEL/doc

Unfortunately that didn’t work out. For some reasons conflicts appeared as wel as files that weren’t supposed to be there at all.

Thanks to Google and this blog post I found a solution. It boils down to explicitly telling SVN which revisions to use for the merge.

First I used

$ svn log | grep -C3 branch

to find out at which revision I created the branch:

------------------------------------------------------------------------
r864 | lckarssen | 2012-03-27 17:38:05 +0200 (Tue, 27 Mar 2012) | 1 line

Creating ProbABEL branch for code refactoring

Next I went to trunk and ran

$ svn update
At revision 987.

to find out at which revision trunk currently was. Back in the doc directory in the brach I ran

svn merge -r 864:987 ^/pkg/ProbABEL/doc

to merge al the changes since the branch was split off and it worked like a charm! All changes in trunk applied cleanly.

I then id the same for the other directories which also had changes in the branch. It turns out that when SVN find a conflict it is easier to postpone resolving the conflict because Emacs has a great SVN merge minor mode called SMerge! It highlights your changes vs. the incoming ones and allows you to select a resolution and move to the next conflict with a few easy keystrokes. After all conflicts have been resolved Emacs automtically removes the intermediate files SVN created and you are ready to commit.

Related Images:

© 2024 Lennart's weblog

Theme by Anders NorĂ©nUp ↑