Page 1 of 1

[patch] AIX 7.1 has uselocale but lacks strtod_l

Posted: 2015-04-14T09:12:21-07:00
by haubi
Hi,

on AIX 7.1 I'm encountering this linker error with ImageMagick-6.8.8:

Code: Select all

ld: 0711-317 ERROR: Undefined symbol: .AcquireCLocale
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
Makefile:6457: recipe for target 'magick/libMagickCore-6.Q16.la' failed
make[3]: *** [magick/libMagickCore-6.Q16.la] Error 1
Problem is that AcquireCLocale() is defined upon available strtod_l only, but used upon available strtod_l, vfprintf_l, vsnprintf_l and uselocale. Although there is changeset 16685 since ImageMagick-6.9.0, I fail to find a reason to not use AcquireCLocale() when there is uselocale() but no strtod_l().

So I'm proposing this patch for current trunk, including the reversion of r16685:

Code: Select all

Index: MagickCore/locale.c
===================================================================
--- MagickCore/locale.c (revision 18390)
+++ MagickCore/locale.c (working copy)
@@ -97,7 +97,7 @@
 static SplayTreeInfo
   *locale_cache = (SplayTreeInfo *) NULL;
 
-#if defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_STRTOD_L) || defined(MAGICKCORE_HAVE_USELOCALE)
 static volatile locale_t
   c_locale = (locale_t) NULL;
 #endif
@@ -110,7 +110,7 @@
   LoadLocaleCache(SplayTreeInfo *,const char *,const char *,const char *,
     const size_t,ExceptionInfo *);
 
-#if defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_STRTOD_L) || defined(MAGICKCORE_HAVE_USELOCALE)
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -240,7 +240,7 @@
   return(locale_cache);
 }
 
-#if defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_STRTOD_L) || defined(MAGICKCORE_HAVE_USELOCALE)
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -358,7 +358,7 @@
 #endif
   }
 #else
-#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_USELOCALE)
   {
     locale_t
       locale,
@@ -449,7 +449,7 @@
 #endif
   }
 #elif defined(MAGICKCORE_HAVE_VSNPRINTF)
-#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_USELOCALE)
   {
     locale_t
       locale,
@@ -1429,7 +1429,7 @@
   LockSemaphoreInfo(locale_semaphore);
   if (locale_cache != (SplayTreeInfo *) NULL)
     locale_cache=DestroySplayTree(locale_cache);
-#if defined(MAGICKCORE_HAVE_STRTOD_L)
+#if defined(MAGICKCORE_HAVE_STRTOD_L) || defined(MAGICKCORE_HAVE_USELOCALE)
   DestroyCLocale();
 #endif
   UnlockSemaphoreInfo(locale_semaphore);
Thanks!
/haubi/

Re: [patch] AIX 7.1 has uselocale but lacks strtod_l

Posted: 2015-04-14T14:07:08-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.1-2 Beta, available by sometime tomorrow. Thanks.