<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Karl and company,<div class=""><br class=""></div><div class="">I succeeded in building everything on Sierra. I got 406 executables and no test errors.</div><div class=""><br class=""></div><div class="">Looking more closely at my original log file, I discovered that all the errors came from</div><div class="">a single file,</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>splinefont.h</div><div class=""><br class=""></div><div class="">which is in</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>source/texk/dvisvgm/dvisvgm-src/libs/ff-wolf/fontforge</div><div class=""><br class=""></div><div class="">This file seems to have been written in 2000-2012 by George Williams. The errors come</div><div class="">from the last lines of this file, which deal with "threaded locals". Don't ask me what these</div><div class="">are. </div><div class=""><br class=""></div><div class="">The interesting piece of code in splinefont.h starts with the following</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>#ifdef _WIN32</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>#define BAD_LOCALE_HACK</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>typedef char* locale_t;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>#define LC_GLOBAL_LOCALE ((locale_t)-1)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>#define LC_ALL_MASK LC_ALL</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#define LC_COLLATE_MASK LC_COLLATE</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#define LC_CTYPE_MASK LC_CTYPE</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>#define LC_MONETARY_MASK LC_MONETARY</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>#define LC_NUMERIC_MASK LC_NUMERIC</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#define LC_TIME_MASK LC_TIME</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>#endif</div><div class=""><br class=""></div><div class="">This is then followed by two fairly short code blocks, both of the form</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>#ifndef BAD_LOCALE_HACK</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>...</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>#else</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>...</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>#endif</div><div class=""><br class=""></div><div class="">The file then has nine lines of code and that's that. </div><div class=""><br class=""></div><div class="">The first #else above is followed by a comment:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>// Yes, it is dirty. But so is an operating system that doesn't support threaded locales</div><div class=""><br class=""></div><div class="">I think you can guess my fix. In the displayed code, I commented out "#ifdef _WIN32", so the block of</div><div class="">code applied to everyone, and of course commented out "#endif" at the end of the block.</div><div class=""><br class=""></div><div class="">--------------</div><div class=""><br class=""></div><div class="">Then I looked for "threaded locale" on the web and discovered that in Standard C, a locale is a global resource,</div><div class="">while in C++, it is a class and there can be several instances of the locale class. By itself, that is not a problem.</div><div class="">But can threads change locale?</div><div class=""><br class=""></div><div class="">Stackoverflow had more information:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><table style="margin: 0px; padding: 0px; border: 0px; font-size: 13px; border-spacing: 0px; border-collapse: collapse; color: rgb(36, 39, 41); font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;" class=""><tbody style="margin: 0px; padding: 0px; border: 0px;" class=""><tr style="margin: 0px; padding: 0px; border: 0px;" class=""><td class="votecell" style="margin: 0px; padding: 0px 15px 0px 0px; border: 0px; vertical-align: top;"><div class="vote" style="margin: 0px; padding: 0px; border: 0px; text-align: center; min-width: 46px;"><span itemprop="upvoteCount" class=" vote-count-post" style="margin: 8px 0px; padding: 0px; border: 0px; font-size: 20px; display: block; color: rgb(106, 115, 124);">3</span><a class="vote-down-off" title="This answer is not useful" style="margin: 0px auto 10px; padding: 0px; border: 0px; font-size: 1px; color: rgb(0, 119, 204); cursor: pointer; background-image: url(https://cdn.sstatic.net/Sites/stackoverflow/img/sprites.svg?v=9e2f3a77c910), none; overflow: hidden; display: block; text-indent: -9999em; width: 40px; height: 30px; background-position: 0px -220px; background-repeat: no-repeat no-repeat;">down vote</a></div></td><td class="answercell" style="margin: 0px; padding: 0px; border: 0px; vertical-align: top;"><div class="post-text" itemprop="text" style="margin: 0px 0px 5px; padding: 0px; border: 0px; font-size: 15px; width: 660px; word-wrap: break-word; line-height: 1.3;"><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; clear: both;" class="">In the C++11 standard threads are now a supported part of the language. The standard explicitly calls out that setlocale() calls introduce data races with other calls to setlocale() or calls to functions that are affected by the current C locale including strtod(). The locale::global() function is considered to behave as-if it called setlocale(), so it also can introduce a data race (noted below).</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; clear: both;" class="">On Linux with glibc it is <a href="https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html#index-setlocale" rel="nofollow noreferrer" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">MT-unsafe (const:locale env)</a> to have threads call setlocale() concurrently with a non-NULL argument and call any other function which might use the global locale (data race and thus undefined behaviour in C11). It is suggested to use <a href="http://man7.org/linux/man-pages/man3/uselocale.3.html" rel="nofollow noreferrer" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">uselocale()</a> instead which is MT-safe and changes only the calling thread's locale. On Linux with libstdc++ in C++ code you should avoid locale::global (process wide change) and create a locale for the thread's use (the locale::global is MT-unsafe for the same reasons as the C runtime). Given your goal to use strtod (a C API) you should use uselocale().</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; clear: both;" class="">On Linux using glibc the setlocale() function itself is MT-unsafe unless you meet 2 strict criteria, and as required by POSIX changes the locale for the entire process. The new Linux man pages (part of the <a href="http://man7.org/linux/man-pages/man7/attributes.7.html" rel="nofollow noreferrer" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">Red Hat and Fujitsu work to specify MT-safety notations for all APIs</a>) mark <a href="http://man7.org/linux/man-pages/man3/setlocale.3.html#ATTRIBUTES" rel="nofollow noreferrer" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">setlocale()</a> as "MT-Unsafe const:locale env", which means that setlocale is MT-safe IFF you keep the locale constant (by not modifying it, just querying it by passing NULL), and if you keep the locale and environment constant (to avoid changes to the locale if the argument is ""). On Linux using glibc you should use uselocale() if you want to change just the locale of the calling thread, since this is MT-safe and does not rely on your environment in any way and strtod will use the thread's locale. Similarly all systems that implement POSIX should provide uselocale() for use in a thread context (MT-safe).</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; clear: both;" class="">OS X implements uselocale() so you can use that.</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; clear: both;" class="">On Windows use _configthreadlocale to change if setlocale() operates on the whole process or threads (turns it into uselocale which is what you need), but for C++ code you should again <a href="https://msdn.microsoft.com/en-us/library/ms235302.aspx" rel="nofollow noreferrer" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">use an instance of the locale class and avoid locale::global</a>.</p><div class=""><br class=""></div><div class=""><br class=""></div></div></td></tr></tbody></table><div class="">Maybe this information could be used to fix then TeXLive source so it will work on many more systems. Of course systems which do not support C++11 may have to avoid dvisvgm.</div></div><div class=""><br class=""></div><div class="">Dick Koch</div><div class=""><a href="mailto:koch@uoregon.edu" class="">koch@uoregon.edu</a></div></body></html>