From owner-freebsd-ports@FreeBSD.ORG Wed Jan 11 22:22:28 2012 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0744106564A; Wed, 11 Jan 2012 22:22:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 757DE8FC12; Wed, 11 Jan 2012 22:22:27 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA23259; Thu, 12 Jan 2012 00:22:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Rl6Yq-000BFP-Bf; Thu, 12 Jan 2012 00:22:24 +0200 Message-ID: <4F0E0B9E.2000600@FreeBSD.org> Date: Thu, 12 Jan 2012 00:22:22 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Rainer Hurling , FreeBSD Ports References: <4F0D595B.2000901@FreeBSD.org> <4F0D5CA5.5010409@gwdg.de> <4F0D681A.9020600@FreeBSD.org> In-Reply-To: <4F0D681A.9020600@FreeBSD.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=x-viet-vps Content-Transfer-Encoding: 7bit Cc: David Chisnall , Martin Matuska Subject: Re: ImageMagick: tests fail on freebsd 10 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 22:22:28 -0000 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 correctly. Thus both MAGICKCORE_HAVE_XLOCALE_H and MAGICKCORE_HAVE_STRTOD_L are defined. 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' [-Wimplicit-function-declaration] magick/locale.c: In function 'FormatLocaleStringList': magick/locale.c:346:7: warning: implicit declaration of function 'vsnprintf_l' [-Wimplicit-function-declaration] magick/locale.c: In function 'InterpretLocaleValue': magick/locale.c:901:9: warning: implicit declaration of function 'strtod_l' [-Wimplicit-function-declaration] 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