Diagnostic 912: could not set locale

Submit New Article

July 2, 2009 1:00 AM PDT


Cause:

This error occurs only when the LANG environment variable is set to an invalid locale. The compiler makes a call to setlocale() and if it fails then it issues this error.  For example:

$ export LANG=NULL
$ icc -c -V hello.cpp
Intel(R) C Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 Package ID: l_cproc_p_11.0.081
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

Catastrophic error: could not set locale "" to allow processing of multibyte characters

compilation aborted for hello.cpp (code 4)

Resolution:

To work around this error set "LANG" to a valid locale like "LANG=C" or "LANG=en_US.UTF-8".  Some systems may require that you set "LC_ALL=en_US" in addition to setting LANG.

$ export LANG=C
$ icc -c -V hello.cpp
Intel(R) C Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 Package ID: l_cproc_p_11.0.081
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

$ export LANG=en_US.UTF-8
$ export |grep LANG
declare -x LANG="en_US.UTF-8"
$ icc -c -V hello.cpp
Intel(R) C Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 Package ID: l_cproc_p_11.0.081
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.
$



Do you need more help?


This article applies to: Intel® C++ Compiler for Linux* Knowledge Base,   Intel® C++ Compiler for Mac OS X* Knowledge Base,   Intel® C++ Compiler for Windows* Knowledge Base