If you recently tried to emerge the latest Firefox in Gentoo (firefox 58.0/58.0.1) and you ended up with a compilation error of this kind:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 142-144: ordinal not in range(128) 35:47.22 0 compiler warnings present. 35:47.31 Exception when writing resource usage file: u'compile' 35:47.32 We know it took a while, but your build finally finished successfully! To view resource usage of the build, run |mach resource-usage|. Error running mach: ['build', '-v'] The error occurred in code that was called by the mach command. This is either a bug in the called code itself or in the way that mach is calling it. You should consider filing a bug for this issue. If filing a bug, please include the full output of mach, including this error message. The details of the failure are as follows: KeyError: u'compile'
The thing is that the build reports successful completion as you can see below from the report, but the emerge process is terminated with error, so in this situation, when the build process is finished successfully we can manually install the package with:
[root@local ]# cd /usr/portage/www-client/firefox [root@local firefox]# ebuild firefox-58.0.1.ebuild install && ebuild firefox-58.0.1.ebuild qmerge
* The whole output of the error
Exception in thread ProcessReader: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 986, in _read callback(line.rstrip()) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 904, in __call__ e(*args, **kwargs) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mach/mach/mixin/process.py", line 86, in handleLine line_handler(line) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 720, in on_line self.log(logging.INFO, 'build_output', {'line': line}, '{line}') File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mach/mach/mixin/logging.py", line 54, in log extra={'action': action, 'params': params}) File "/usr/lib64/python2.7/logging/__init__.py", line 1231, in log self._log(level, msg, args, **kwargs) File "/usr/lib64/python2.7/logging/__init__.py", line 1286, in _log self.handle(record) File "/usr/lib64/python2.7/logging/__init__.py", line 1296, in handle self.callHandlers(record) File "/usr/lib64/python2.7/logging/__init__.py", line 1336, in callHandlers hdlr.handle(record) File "/usr/lib64/python2.7/logging/__init__.py", line 759, in handle self.emit(record) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 548, in emit self.fh.write(msg) UnicodeEncodeError: 'ascii' codec can't encode characters in position 142-144: ordinal not in range(128) 35:47.22 0 compiler warnings present. 35:47.31 Exception when writing resource usage file: u'compile' 35:47.32 We know it took a while, but your build finally finished successfully! To view resource usage of the build, run |mach resource-usage|. Error running mach: ['build', '-v'] The error occurred in code that was called by the mach command. This is either a bug in the called code itself or in the way that mach is calling it. You should consider filing a bug for this issue. If filing a bug, please include the full output of mach, including this error message. The details of the failure are as follows: KeyError: u'compile' File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/mach_commands.py", line 170, in build mach_context=self._mach_context) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 1232, in build telemetry_data = monitor.get_resource_usage() File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 433, in get_resource_usage o['tiers'] = self.tiers.tiered_resource_usage() File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 150, in tiered_resource_usage self.add_resources_to_dict(t_entry, phase=tier) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/python/mozbuild/mozbuild/controller/building.py", line 159, in add_resources_to_dict end=end, phase=phase, per_cpu=False) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py", line 468, in aggregate_cpu_percent data = self.phase_usage(phase) File "/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py", line 427, in phase_usage time_start, time_end = self.phases[phase] * ERROR: www-client/firefox-58.0.1::gentoo failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 124: Called src_compile * environment, line 5006: Called die * The specific snippet of code: * MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 ./mach build -v || die * * If you need support, post the output of `emerge --info '=www-client/firefox-58.0.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=www-client/firefox-58.0.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/www-client/firefox-58.0.1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/www-client/firefox-58.0.1/temp/environment'. * Working directory: '/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1' * S: '/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1' >>> Failed to emerge www-client/firefox-58.0.1, Log file: >>> '/var/tmp/portage/www-client/firefox-58.0.1/temp/build.log' * Messages for package www-client/firefox-58.0.1: * You are enabling official branding. You may not redistribute this build * to any users on your network or the internet. Doing so puts yourself into * a legal problem with Mozilla Foundation * You can disable it by emerging firefox _with_ the bindist USE-flag * LINGUAS value bg is not enabled using L10N use flags * ERROR: www-client/firefox-58.0.1::gentoo failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 124: Called src_compile * environment, line 5006: Called die * The specific snippet of code: * MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 ./mach build -v || die * * If you need support, post the output of `emerge --info '=www-client/firefox-58.0.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=www-client/firefox-58.0.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/www-client/firefox-58.0.1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/www-client/firefox-58.0.1/temp/environment'. * Working directory: '/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1' * S: '/var/tmp/portage/www-client/firefox-58.0.1/work/firefox-58.0.1'