Opened 10 years ago

Closed 10 years ago

#7987 closed Bugs (invalid)

Problem compiling code to use the Bessel functions

Reported by: Pedro Giffuni <giffunip@…> Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

Hello;

I am having fun replacing some of the math functionality in Apache OpenOffice with boost functions. My platform is FreeBSD 9.1.

I noticed that for Bessel functions there is no documentation about which header(s) to use.

I assume you only need: #include <boost/math/special_functions/bessel.hpp>

Everything seems fine in my code but I get this: .... /usr/ports/editors/openoffice-3-devel/work/ooo/main/scaddins/source/analysis/bessel.cxx:92: instantiated from here /usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:63: error: no matching function for call to 'fabs(long double&)' /usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:63: error: no matching function for call to 'fabs(long double&)' /usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:75: error: no matching function for call to 'fabs(long double&)'

/usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:63: error: no matching function for call to 'fabs(long double&)' /usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:63: error: no matching function for call to 'fabs(long double&)' /usr/local/include/boost/math/special_functions/detail/bessel_kn.hpp:75: error: no matching function for call to 'fabs(long double&)' ...

I have tried including <math.h> <cmath> and even the boost math libraries but still no luck.

While here let me also mention this warning which should be easy to fix:

/usr/local/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp:21:7: warning: no newline at end of file

Change History (6)

comment:1 by anonymous, 10 years ago

Looks like there's no std::fabs(long double) on that platform?

Try defining BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS before including the header, if that fixes things can you please let me know:

  • Whether NO_LONG_DOUBLE_MATH is defined.
  • What values DBL_MANT_DIG and LDBL_MANT_DIG have?

I'll fix the missing mention of the header file shortly.

Cheers, John Maddock.

comment:2 by John Maddock, 10 years ago

(In [82763]) Add bessel function header to docs. Refs #7987.

comment:3 by Pedro Giffuni <giffunip@…>, 10 years ago

Thank you,

I guess it might be a libstdc++ issue: libc does have fabsl().

I will try that but it takes about a day(!) to rebuild OpenOffice.

comment:4 by Pedro Giffuni <giffunip@…>, 10 years ago

(It's still building)

Ugh.. I found an explanation in this posting:

http://lists.freebsd.org/pipermail/freebsd-hackers/2009-March/028030.html

FreeBSD <= 9 uses it's own BSD libc and the GNU libstdc++ (from gcc 4.2.1) and both don't seem to get along too well. The good news is that starting with FreeBSD 10 they/we moved to clang/libc++ so this will not be a problem for too long.

comment:5 by Pedro Giffuni <giffunip@…>, 10 years ago

I found the problem:

The boost maintainer in FreeBSD re-enabled the long double support which is off by default in standard Boost. http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/boost-libs/files/patch-freebsd-has-long-double?rev=1.1

Please close this ticket and thank you for your help!

comment:6 by John Maddock, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.