Skip to content
Snippets Groups Projects
Commit 7070d9fc authored by Michael Kuhn's avatar Michael Kuhn Committed by Peter Scheibel
Browse files

Allow setting language of compiler messages (#9486)

* Add a build_language config.yaml option which controls the language
  of compiler messages
* build_language defaults to "C", in which case the compiler messages
  will be in English. This allows Spack log parsing to detect and
  highlight error messages (since the regular expressions to find
  error messages are in English)
* The user can use the default language in their environment by setting
  the build_language config variable to null or ''
parent 0f5f49f7
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,14 @@ config: ...@@ -77,6 +77,14 @@ config:
dirty: false dirty: false
# The language the build environment will use. This will produce English
# compiler messages by default, so the log parser can highlight errors.
# If set to C, it will use English (see man locale).
# If set to the empty string (''), it will use the language from the
# user's environment.
build_language: C
# When set to true, concurrent instances of Spack will use locks to # When set to true, concurrent instances of Spack will use locks to
# avoid modifying the install tree, database file, etc. If false, Spack # avoid modifying the install tree, database file, etc. If false, Spack
# will disable all locking, but you must NOT run concurrent instances # will disable all locking, but you must NOT run concurrent instances
......
...@@ -142,6 +142,13 @@ def clean_environment(): ...@@ -142,6 +142,13 @@ def clean_environment():
env.unset('LD_RUN_PATH') env.unset('LD_RUN_PATH')
env.unset('DYLD_LIBRARY_PATH') env.unset('DYLD_LIBRARY_PATH')
build_lang = spack.config.get('config:build_language')
if build_lang:
# Override language-related variables. This can be used to force
# English compiler messages etc., which allows parse_log_events to
# show useful matches.
env.set('LC_ALL', build_lang)
# Remove any macports installs from the PATH. The macports ld can # Remove any macports installs from the PATH. The macports ld can
# cause conflicts with the built-in linker on el capitan. Solves # cause conflicts with the built-in linker on el capitan. Solves
# assembler issues, e.g.: # assembler issues, e.g.:
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
'checksum': {'type': 'boolean'}, 'checksum': {'type': 'boolean'},
'locks': {'type': 'boolean'}, 'locks': {'type': 'boolean'},
'dirty': {'type': 'boolean'}, 'dirty': {'type': 'boolean'},
'build_language': {'type': 'string'},
'build_jobs': {'type': 'integer', 'minimum': 1}, 'build_jobs': {'type': 'integer', 'minimum': 1},
'ccache': {'type': 'boolean'}, 'ccache': {'type': 'boolean'},
'db_lock_timeout': {'type': 'integer', 'minimum': 1}, 'db_lock_timeout': {'type': 'integer', 'minimum': 1},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment