[Pkg-phototools-devel] Bug#788102: The code doesn't compile on kfreebsd
Andreas Metzler
ametzler at bebt.de
Sat Aug 8 16:30:33 UTC 2015
On 2015-07-22 Steven Chamberlain <steven at pyro.eu.org> wrote:
[...]
> I see that FreeBSD Ports has ilmbase-2.20 and succeeded building
> libIexMath, yet they don't seem to have patched this source file.
> I should try building it on a real FreeBSD system, to compare the
> build log with that of a GNU/kFreeBSD system.
IexMath/IexMathFpu.cpp
static inline void
setCw (uint16_t cw)
{
asm volatile ("fldcw %0" : : "m" (cw) );
}
[...]
static inline void
setMxcsr (uint32_t mxcsr, bool clearExceptions)
{
mxcsr &= clearExceptions ? 0xffffffc0 : 0xffffffff;
asm volatile ("ldmxcsr %0" : : "m" (mxcsr) );
}
[...]
#ifdef ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
inline void
restoreControlRegs (const ucontext_t & ucon, bool clearExceptions)
{
setCw ((ucon.uc_mcontext.fpregs->cwd & cwRestoreMask) | cwRestoreVal);
setMxcsr (ucon.uc_mcontext.fpregs->mxcsr, clearExceptions);
}
#else
[ the failing code ]
and while autoconf tests for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
with
--------------------------------
AC_MSG_CHECKING(for fpe support handling)
control_register_support="no"
AC_TRY_COMPILE([
#include <stdint.h>
#include <ucontext.h>
],[
ucontext_t ucon;
uint32_t mxcsr = ucon.uc_mcontext.fpregs->mxcsr;
uint16_t cw = ucon.uc_mcontext.fpregs->cwd;
],
AC_DEFINE(ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT) control_register_support=yes)
AC_MSG_RESULT($control_register_support)
--------------------------------
This test fails on kfreebsd-x (and also on e.g. i386).
the respective part of the cmake setup simply looks like this:
IF (WIN32)
[...]
ELSE ()
IF (APPLE)
[...]
ELSE ()
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT 1\n")
ENDIF ()
ENDIF ()
FreeBSD Ports uses cmake instead of autoconf (which Debian uses) and
therefore ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is #defined.
I do not know whether
a) the autoconf test for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is
broken and should actually succeed and kfreebsd (and any other Debian
architecture or
b) the cmake setup is broken and incorrecty enables
ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT and causes broken code.
cu Andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
More information about the Pkg-phototools-devel
mailing list