Note that there are some explanatory texts on larger screens.

plurals
  1. POstd::locale breakage on MacOS 10.6 with LANG=en_US.UTF-8
    text
    copied!<p>I have a C++ application that I am porting to MacOSX (specifically, 10.6). The app makes heavy use of the C++ standard library and boost. I recently observed some breakage in the app that I'm having difficulty understanding.</p> <p>Basically, the boost filesystem library throws a runtime exception when the program runs. With a bit of debugging and googling, I've reduced the offending call to the following minimal program:</p> <pre><code>#include &lt;locale&gt; int main ( int argc, char *argv [] ) { std::locale::global(std::locale("")); return 0; } </code></pre> <p>This program fails when I run this through g++ and execute the resulting program in an environment where <code>LANG=en_US.UTF-8</code> is set (which on my computer is part of the default bash session when I create a new console window). Clearing the environment variable (<code>setenv LANG=</code>) allows the program to run without issues. But I'm surprised I'm seeing this breakage in the default configuration.</p> <p>My questions are:</p> <ol> <li>Is this expected behavior for this code on MacOS 10.6?</li> <li>What would a proper workaround be? I can't really re-write the function because the version of the boost libraries we are using executes this statement internally as part of the filesystem library.</li> </ol> <p>For completeness, I should point out that the program from which this code was synthesized crashes when launched via the 'open' command (or from the Finder) but not when Xcode runs the program in Debug mode.</p> <p><strong>edit</strong> The error given by the above code on 10.6.1 is:</p> <pre>$ ./locale terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Abort trap </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload