On Tuesday 23 April 2013 23:44:57 William S Fulton wrote:
> On 20/04/13 14:00, Geert Janssens wrote:
> > Guile has one testcase labeled as an external test. Compared to the
> > other tests, this uses a different path in the makefiles: it uses
> > swig_and_compile_external.
> > Looking through the rest of the swig modules, I find only the chicken
> > module to use this as well (the chicken module looks to be very similar
> > to the guile module in many ways).
> > Unfortunately, this test is failing (the external cxx file is not
> > found). As I don't find tests in any of the more mainstream modules
> > (like python, perl,...) using swig_and_compile_external, I'm starting to
> > wonder if perhaps this is a deprecated swig feature, to be replaced with
> > something else ?
> > So what's the story behind swig_and_compile_external ? I didn't find
> > much by seaching the web.
> Looks like the testcase got renamed, but not all of it. I've committed a
> patch on master to fix.
Thanks for the fix. I had to fix a bug I introduce myself before the test ran on my branch. That is done now.
One caveat: the external test will only work when testing in-tree (ie use source dir as build dir). Out-of-tree configure and test will fail. I have spent the better part of the day trying to fix this, but was not successful.
The cause of the failure is that in case of an out-of-tree build the external cxx file is not in the same directory as the generated wrap.cxx file. As a result make complains that guile_ext_test_external.cxx can't be found.
I tried several things to fix it:
1. Adding $(srcdir) to the filename in common.mk (in rule swig_and_compile_external). The compile step then works, but the link step complains that $(srcdir)/guile_ext_test_external.o can't be found. Obviously, because it ends up in the build dir.
2. Played with VPATH, but couldn't get it to work.
3. added CXXSRCS as requirement to build guile_cpp, no difference.
Two possible solutions I haven't tested yet:
- at compile time, create a softlink from the build directory to $(srcdir)/guile_ext_test_external.cxx (only when building out-of-tree obviously).
- make a separate make variable EXT_CXXSRCS to hold all the external source files. These sources could be added with the proper $(srcdir) prefix. The variable then has to be added to OBJS, but with a different filtering (ie the srcdir should be removed in addition to changing the suffix). I'm not sure if this is possible/easy.
For now I'll leave that as an exercise for later. I have more pressing matters to attend to.