monotone

Issue 191: xdelta unit test fails to build due a symbol conflict with boost

Reported by Dan Horák, Sep 26, 2011

The xdelta unit test fails to build due a symbol conflict with boost 
>= 1.47

The problem a conflict of L() macro defined by monotone in sanity.hh 
and L as a template parameter in boost. I was told that single upper 
case letters are usually used for classes passed as template 
parameters in C++ code.

from the build log:
...
make[3]: Entering directory `/builddir/build/BUILD/monotone-1.0'
\
#	source='test/unit/tests/xdelta.cc' 
object='test/unit/tests/xdelta.o' libtool=no 
g++  -I.              -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 
-mtune=generic -Wall -W -Wno-unused -c -o test/unit/tests/xdelta.o 
test/unit/tests/xdelta.cc
In file included from 
/usr/include/boost/math/special_functions/gamma.hpp:43:0,
                 from 
/usr/include/boost/math/special_functions/detail/bessel_jy.hpp:14,
                 from 
/usr/include/boost/math/special_functions/bessel.hpp:17,
                 from 
/usr/include/boost/math/special_functions.hpp:18,
                 from 
/usr/include/boost/random/generate_canonical.hpp:22,
                 from /usr/include/boost/random.hpp:52,
                 from test/unit/tests/xdelta.cc:15:
/usr/include/boost/math/special_functions/detail/lgamma_small.hpp: 
In function ‘T boost::math::detail::lgamma_small_imp(T, T, T, const 
mpl_::int_<0>&, const Policy&, const L&)’:
/usr/include/boost/math/special_functions/detail/lgamma_small.hpp:483
:38: error: expected primary-expression before ‘do’
/usr/include/boost/math/special_functions/detail/lgamma_small.hpp:488
:38: error: expected primary-expression before ‘do’
make[3]: *** [test/unit/tests/xdelta.o] Error 1
make[3]: Leaving directory `/builddir/build/BUILD/monotone-1.0'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/builddir/build/BUILD/monotone-1.0'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/builddir/build/BUILD/monotone-1.0'
make: *** [check] Error 2

Comment 1 by Christian Cornelssen, Oct 18, 2011

Encountered the same problem with a fresh mtn clone today (revision 
22f47ba88188cc15e92de60cc2597df6054809a7).

Workaround was to #include <boost/random.hpp> before the local 
headers in test/unit/tests/xdelta.cc. A clean approach should avoid 
the definition of such a macro (in src/sanity.hh) however.

Comment 2 by Christian Cornelssen, Oct 18, 2011

After having read HACKING, I have moved the BOOST #include
after the #include of base.hh. Enjoy until you have worked out 
something solid regarding one-letter macros vs. C++ template 
parameters. With this patch, "make check" passes.

Comment 3 by Christian Cornelssen, Oct 18, 2011

Same patch, with corrected comment.

Comment 4 by Christian Cornelssen, Oct 19, 2011

"make distcheck" succeeds with the latest patch above (and 
with the patch of ticket 194).

Comment 5 by Christian Cornelssen, Oct 19, 2011

Note: According to HACKING, the first version of my patch should 
have caused "make distcheck" to fail. This did not happen. 
(I corrected the patch anyway.) With the patch of ticket 195, such 
violations are now found.

Comment 6 by Richard Levitte, Oct 25, 2011

Hmmmm, I wanted to verify this, but Debian [unstable] is still at 
boost 1.46...  Perhaps someone else?

Comment 7 by Dan Horák, Oct 25, 2011

Successful build with test-suite passed on the development version 
of Fedora (aka Fedora Rawhide) with boost 1.47 is at 
http://koji.fedoraproject.org/koji/taskinfo?taskID=3459113 (will be 
cleaned up after 2 weeks)

Comment 8 by Richard Levitte, May 2, 2012

I'm currently at boost 1.49 (on Debian), and I haven't run into this 
problem, could it be that the issue has been solved with that 
version of boost?

Anyhow, even though I can't see the issue in my environment, the 
patch seems harmless, so I've just applied it and am running a 
distcheck to see if anything comes up.  If not, I'll commit.

Comment 9 by Richard Levitte, May 2, 2012

Status: Started

Comment 10 by Richard Levitte, May 2, 2012

I just verified that the change doesn't cause any harm.

Committed and pushed, revision 
ab1768da0fde81a823a77f7b92cb6bf6f1662b45
Status: Verified

Comment 11 by Thomas Moschny, May 2, 2012

The L template parameter in Boost has been changed, see:

https://svn.boost.org/trac/boost/changeset/76278

and 

http://lists.boost.org/Archives/boost/2012/01/189247.php

so, for newer Boost versions (1.49.0 and later, I guess), the patch 
should not be necessary anymore.

Created: 13 years 2 months ago by Dan Horák

Updated: 12 years 7 months ago

Status: Verified

Followed by: 3 persons

Labels:
Type:Defect
Priority:Medium

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status