Compiling BeBOP Sparse Matrix Converter under Cygwin

The text below is now obsolete, as in the newer version of BEBOP, the compiling under Cygwin goes without a problem. See Compiling BeBOP Sparse Matrix Converter under Cygwin.

BeBOP Sparse Matrix Converter contains an executable that allows us to convert between different sparse matrix formats. I was given a file in the Harwell-Boeing format generated by Mathematica that caused troubles and I wanted to check it with this tool.

Below I will describe shortly how I have compiled BeBOP under Cygwin with gcc 3.4.4. It happens that it is not too difficult but some hacking was still necessary.

It is assumed that both archives bebop_util.tar.gz and sparse_matrix_converter.tar.gz are in the current directory.

First it is necessary to unpack the archives

$ tar zxvf bebop_util.tar.gz
$ tar zxvf sparse_matrix_converter.tar.gz

Now let us try to compile bebop library

$ cd bebop_util

Inspection of Makefile.include shows that it would be necessary to change



but as I was not interested in DLL, I have left this variable without changes.

Running make

$ make

produces an error

../include/bebop/util/complex.h:98:23: complex.h: No such file or directory

There are also warning related to –fPIC but they could be safely ignored.

It seems that gcc under Cygwin does not have complex.h. Exploring include/bebop/util/complex.h shows that complex.h is included provided HAVE_COMPLEX_H is defined. So, the would be solution is to undefined this macro.

Well, the BeBOP documentation says that this is a known error:

It is always good to read the documentation. So, the solution is to edit file include/bebop/util/config.h and remove or comment out lines 61 and 64:

# define HAVE__COMPLEX 1
# define HAVE_COMPLEX_H 1

After that

$ make

produces the static library libbebop_util.a that we need and also a dynamic library that we do not need.

Now let us compile the tool.

$ cd ../sparse_matrix_converter
$ make

However there is an error

csr_matmatmult.c:118: error: `FP_NAN' undeclared (first use in this function)

Search in Google shows that this marco is related to C99 and it seems that gcc under Cygwin does not define it. It could be that I have to update my Cygwin but anyway the look at the file shows that this line is used if the macro HAVE_C99 is defined. So the solution is to undefine this macro. This macro is defined in the line 54 in bebop_util/include/bebop/util/config.h und it is enough just delete or comment out this line. Another solution would be to remove a compiler flag -std=c99 but this should be done twice: in Makefile.include and then also in src/Makefile.

After that make compiles the tool but then there is a lot of linking errors when make tries to compile a shared library. It seems that it depends on the first shared library and gcc just cannot find it. I have just ignored this, as I needed just a tool sparse_matrix_converter.exe and it was already available. Alternatively it is possible to change in src/Makefile the line 120

all: $(EXEOUT) dynamic


all: $(EXEOUT)

and then there will be no error messages.

Now I was able to troubleshoot the Harwell-Boeing file Mca_crash. It cases the crash of BeBOP indeed:

$ sparse_matrix_converter.exe Mca_crash "HB" tt "MM"

After debugging I have found the reason. For some strange reason BeBOP does not like when the format specifications in the line 4 start not from the first designated position. Try file Mca and it goes okay

$ sparse_matrix_converter.exe Mca "HB" tt "MM"

The difference between two files is

$ diff Mca Mca_crash
< (26I3)          (40I2)          (3E26.16)
> (26I3)          (40I2)           (3E26.16)

in extra space between the third format specification. Actually this is perfectly okay according to the Harwell-Boeing standard and in my view should be considered as a bug in BeBOP. However, this is a small bug and the tool seems to be quite good. Well, if you want to fix this, I can give a tip – this happens somewhere in the function ParseRfmt in iohb.c.


Compiling BeBOP Sparse Matrix Converter under Cygwin.

Comments are closed.