locale.c won't build if uselocale found but strtod_l isn't

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jbeck
Posts: 1
Joined: 2014-10-09T17:57:50-07:00
Authentication code: 6789

locale.c won't build if uselocale found but strtod_l isn't

Post by jbeck »

When updating to a new build of Solaris 12 where uselocale() and newlocale() had been introduced, we hit a build failure:

Code: Select all

  CCLD     magick/libMagickCore-6.Q16.la
Undefined                       first referenced
 symbol                             in file
AcquireCLocale                      magick/.libs/magick_libMagickCore_6_Q16_la-locale.o
ld: fatal: symbol referencing errors
It seems that AcquireCLocale is inside an #if defined(MAGICKCORE_HAVE_STRTOD_L) block but not all calls to it are. As we don't have strtod_l() we hit this. I was able to patch magick/locale.c as follows; the result builds on both the old build [that has neither uselocale() nor newlocale()] and the new build [that has both]. Note that this patch is against 6.8.3 but applies cleanly (modulo 98 lines of offset) against 6.8.9-8. Note also that a corresponding pair of lines may need to be tweaked for those who have vsnprintf_l().

Code: Select all

--- ImageMagick-6.8.3/magick/locale.c.orig      2012-12-07 05:14:16.000000000 -0800
+++ ImageMagick-6.8.3/magick/locale.c   2014-10-09 13:32:28.333380432 -0700
@@ -256,7 +256,7 @@
 #endif
   }
 #else
-#if defined(MAGICKCORE_HAVE_USELOCALE)
+#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
   {
     locale_t
       locale,
@@ -347,7 +347,7 @@
 #endif
   }
 #elif defined(MAGICKCORE_HAVE_VSNPRINTF)
-#if defined(MAGICKCORE_HAVE_USELOCALE)
+#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
   {
     locale_t
       locale,
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: locale.c won't build if uselocale found but strtod_l isn

Post by magick »

Thanks, we'll get you patch into the next point release of ImageMagick.
Post Reply