ImageMagick: tests fail on freebsd 10

Andriy Gapon avg at
Wed Jan 11 22:22:28 UTC 2012

on 11/01/2012 12:44 Andriy Gapon said the following:
> on 11/01/2012 11:55 Rainer Hurling said the following:
>> On 11.01.2012 10:41 (UTC+1), Andriy Gapon wrote:
>>> For me the ImageMagick build on FreeBSD 10 amd64 fails at the tests stage.
>>> Is anyone else seeing this?
>> I just tried on 10.0-CURRENT (amd64) r229933 with option IMAGEMAGICK_TESTS
>> enabled and it seems all tests passed right.
> Thank you for your testing!
> Additional detail - my problem occurs with lang/gcc (gcc 4.6) as a compiler.
> With the base compiler all tests do pass indeed.

OK, I think I found the cause of the problem, but I still don't fully understand
what's going on.

The relevant code is all in magick/locale.c.  Apparently because of the recent
David's work on the xlocale API in FreeBSD we now have it in head (aka FreeBSD 10).
When we use the base gcc, then both presence and usability of the xlocale.h
header and presence and usability of the strtod_l function are detected

But with GCC 4.6 the ImageMagick configure script does detect strtod_l support
and MAGICKCORE_HAVE_STRTOD_L is set, but the xlocale.h header usability is not
correctly detected:
configure:21905: checking xlocale.h usability
configure:21905: /usr/local/bin/gcc46 -std=gnu99 -std=gnu99 -c  -fopenmp -O2
-pipe -O2 -fno-strict-aliasing -pipe -march=amdfam10
-I/usr/local/include/graphviz -I/usr/local/include/freetype2 -Wall
-D_THREAD_SAFE  -D__FreeBSD_cc_version=800001 -I/usr/local/include conftest.c >&5
In file included from conftest.c:109:0:
/usr/include/xlocale.h:160:3: error: unknown type name 'va_list'
/usr/include/xlocale.h:162:3: error: unknown type name 'va_list'
configure:21905: $? = 1

Because of the above the code tries to use strtod_l, but doesn't include
xlocale.h.  That results in the following warnings during compilation:
  CC     magick/magick_libMagickCore_la-locale.lo
magick/locale.c: In function 'FormatLocaleFileList':
magick/locale.c:255:7: warning: implicit declaration of function 'vfprintf_l'
magick/locale.c: In function 'FormatLocaleStringList':
magick/locale.c:346:7: warning: implicit declaration of function 'vsnprintf_l'
magick/locale.c: In function 'InterpretLocaleValue':
magick/locale.c:901:9: warning: implicit declaration of function 'strtod_l'

Nevertheless the code compiles and links.
And here comes the strange and interesting part.  I haven't checked what exact
code GCC 4.6 emits in this case, but the net result is that strtod_l appears to
always return zero regardless of its input.

If I forcefully add an include statement for xlocale.h, then the whole
strangeness goes away and strtod_l works as expected.

So basically, as demonstrated above, the main problem is that with GCC 4.6 the
ImageMagick configure script fails to correctly detect xlocale.h.
The secondary problem is that the main problem is well hidden behind the
mysterious run-time behavior rather than a helpful error at the configure or
build stage.

Back to the main problem.  I am not sure where the difference between the base
GCC and GCC 4.6 with respect to 'va_list' in xlocale.h comes from.
Any ideas?

Andriy Gapon

More information about the freebsd-ports mailing list