diff --git a/etc/spack/defaults/config.yaml b/etc/spack/defaults/config.yaml index 738720386766f43c4b49beb915d0409e6c1466a6..f032a64e34ecbffa9a95e500098b04cc9fda49da 100644 --- a/etc/spack/defaults/config.yaml +++ b/etc/spack/defaults/config.yaml @@ -77,6 +77,14 @@ config: 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 # avoid modifying the install tree, database file, etc. If false, Spack # will disable all locking, but you must NOT run concurrent instances diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 71edc65ce7fc47336e8baaa3312a015a48ef6ad3..fa79683717b0b7711ebc8b3ab65b602b3965c433 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -142,6 +142,13 @@ def clean_environment(): env.unset('LD_RUN_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 # cause conflicts with the built-in linker on el capitan. Solves # assembler issues, e.g.: diff --git a/lib/spack/spack/schema/config.py b/lib/spack/spack/schema/config.py index 0ebcd74ade71e5db79ca5c81e821b799f80013a5..583fe79fbffea297a403701cee8bba2889d515ec 100644 --- a/lib/spack/spack/schema/config.py +++ b/lib/spack/spack/schema/config.py @@ -49,6 +49,7 @@ 'checksum': {'type': 'boolean'}, 'locks': {'type': 'boolean'}, 'dirty': {'type': 'boolean'}, + 'build_language': {'type': 'string'}, 'build_jobs': {'type': 'integer', 'minimum': 1}, 'ccache': {'type': 'boolean'}, 'db_lock_timeout': {'type': 'integer', 'minimum': 1},