Question for Autotools wizards (Linking MATIO library)

I am modifying Dynare for the purposes of a modelling project. Currently I would like to invoke functions from MATIO library in my modified preprocessor code.

Without changing the Makefile, building the preprocessor is failing for me. I am getting errors of the kind “undefined reference to Mat_CreateVer”.

The problem is neither with the modified code nor with MATIO installation. I wrote some test code invoking MATIO, which builds (using qmake) and runs as a standalone executable just fine. I also successfully rebuilt the preprocessor with dynare++ option.

I suspected the need to modify the Makefile, which does not have references to matio objects. The ax_matio.m4 Autotools script suggests that this could be done by configuring with the flag “—with-matio=DIR”. I don’t know which DIR I should specify, I’ve tried a few, none of which work.
I am wondering whether the automated detection fails due to absence of libmatio.lib, so the LDFLAGS remains empty?

I have this problem both under MSYS2 and Debian. I am attaching config logs for both environments.

configMSYS2.log (47.1 KB) configDebian.log (53.9 KB)

Could someone suggest which Autotools script to modify and how, in order to link to Matio when building the preprocessor?

Many thanks!

Dear @goubochlepp,

Looking at the config log for Debian, it appears that MatIO is correctly detected by the configure script. So your problem is elsewhere.

My guess is that you forgot to modify the file so that the preprocessor binary is effectively linked with MatIO.

More precisely, you need to add $(LIBADD_MATIO) on the right hand side of the definition of the dynare_m_LDADD variable.

Hope this helps,

Dear Sebastien,
thanks a lot for responding to my question.

I tried adding the designation to dynare_m_LDADD, ran the config command again, but failed to build with the same error messages as before in both environments.

I also tried adding $(LDFLAGS_MATIO) to dynare_m_LDFLAGS, and $(CPPFLAGS_MATIO) to dynare_m_CPPFLAGS,as I saw it in dynare++/, but this also failed. I am an Autotools noob, so I might be missing something obvious?


At this stage of the discussion, I think I can hardly help you without looking at your code (at least to the build system files). So you should make them accessible to me by one way or another.

Also, is your work based on Dynare 4.5 or unstable? I’m asking because in unstable the preprocessor has its own separate configure script.