Closed Bug 1587913 Opened 1 year ago Closed 1 year ago

Mingw builds fail with "ERROR: Don't know how to translate i686-w64-mingw32 for rustc" with rustc 1.38

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox-esr68 fixed, firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox-esr68 --- fixed
firefox71 --- fixed

People

(Reporter: chmanchester, Assigned: chmanchester)

References

Details

Attachments

(1 file)

1.38 added *-uwp-windows-gnu targets, which makes mingw ambiguous.
It also added a armv7-unknown-linux-gnueabi target which breaks armv7-unknown-linux-gnueabihf detection.
And a x86_64-pc-solaris that breaks the x86_64-sun-solaris2 test.

Reproducible with:

diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
index 4e4ec162a6454..67918446b5de4 100755
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -1585,28 +1585,52 @@ def gen_invoke_rustc(version, rustup_wrapper=False):
                 ]
             # Additional targets from 1.36
             if Version(version) >= '1.36.0':
                 rust_targets += [
                     'wasm32-wasi',
                 ]
                 rust_targets.remove('wasm32-unknown-wasi')
                 rust_targets.remove('x86_64-unknown-bitrig')
+            # Additional targets from 1.37
+            if Version(version) >= '1.37.0':
+                rust_targets += [
+                    'x86_64-pc-solaris',
+                ]
+            # Additional targets from 1.38
+            if Version(version) >= '1.38.0':
+                rust_targets += [
+                    'aarch64-unknown-redox',
+                    'aarch64-wrs-vxworks',
+                    'armv7-unknown-linux-gnueabi',
+                    'armv7-unknown-linux-musleabi',
+                    'armv7-wrs-vxworks',
+                    'hexagon-unknown-linux-musl',
+                    'i586-wrs-vxworks',
+                    'i686-uwp-windows-gnu',
+                    'i686-wrs-vxworks',
+                    'powerpc-wrs-vxworks',
+                    'powerpc-wrs-vxworks-spe',
+                    'powerpc64-wrs-vxworks',
+                    'riscv32i-unknown-none-elf',
+                    'x86_64-uwp-windows-gnu',
+                    'x86_64-wrs-vxworks',
+                ]
             return 0, '\n'.join(sorted(rust_targets)), ''
         if (len(args) == 6 and args[:2] == ('--crate-type', 'staticlib') and
             args[2].startswith('--target=') and args[3] == '-o'):
             with open(args[4], 'w') as fh:
                 fh.write('foo')
             return 0, '', ''
         raise NotImplementedError('unsupported arguments')
     return invoke_rustc
 
 
 class RustTest(BaseConfigureTest):
-    def get_rust_target(self, target, compiler_type='gcc', version='1.36.0',
+    def get_rust_target(self, target, compiler_type='gcc', version='1.38.0',
                         arm_target=None):
         environ = {
             'PATH': os.pathsep.join(
                 mozpath.abspath(p) for p in ('/bin', '/usr/bin')),
         }
 
         paths = {
             mozpath.abspath('/usr/bin/cargo'): gen_invoke_cargo(version),
@@ -1678,16 +1702,18 @@ class RustTest(BaseConfigureTest):
         # Windows
         for autoconf, building_with_gcc, rust in (
             ('i686-pc-mingw32', 'cl', 'i686-pc-windows-msvc'),
             ('x86_64-pc-mingw32', 'cl', 'x86_64-pc-windows-msvc'),
             ('i686-pc-mingw32', 'gcc', 'i686-pc-windows-gnu'),
             ('x86_64-pc-mingw32', 'gcc', 'x86_64-pc-windows-gnu'),
             ('i686-pc-mingw32', 'clang', 'i686-pc-windows-gnu'),
             ('x86_64-pc-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
+            ('i686-w64-mingw32', 'clang', 'i686-pc-windows-gnu'),
+            ('x86_64-w64-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
         ):
             self.assertEqual(self.get_rust_target(autoconf, building_with_gcc), rust)
 
         # Arm special cases
         self.assertEqual(
             self.get_rust_target('arm-unknown-linux-androideabi',
                                  arm_target=ReadOnlyNamespace(
                                      arm_arch=7, fpu='neon', thumb2=True, float_abi='softfp')),

In the case of armv7-unknown-linux-gnueabihf it seems like our test has just been invalidated, because we're providing a default arm_target with float_abi='softfp'. We're already checking that target with a more realistic arm_target later in the test. For the others it looks like we need to start taking manufacturer into account.

Assignee: nobody → cmanchester
Pushed by cmanchester@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fbcb7dcd82ac
Fix rust target detection for rustc 1.38. r=firefox-build-system-reviewers,glandium
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Duplicate of this bug: 1594746
Duplicate of this bug: 1619449

Comment on attachment 9100521 [details]
Bug 1587913 - Fix rust target detection for rustc 1.38.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Build issues with more modern rust compiler. Dependency for bug 1595218.
  • User impact if declined:
  • Fix Landed on Version: 71
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Only a configure check. This brings rust.configure close to being on par with what we have in central (and I'm going to a? some more that will get us even closer)

Note there's a trivial conflict in init.configure that needs manual application of the patch. I can provide an updated patch if necessary.

  • String or UUID changes made by this patch:
Attachment #9100521 - Flags: approval-mozilla-esr68?

Comment on attachment 9100521 [details]
Bug 1587913 - Fix rust target detection for rustc 1.38.

approved for 68.9esr

Attachment #9100521 - Flags: approval-mozilla-esr68? → approval-mozilla-esr68+
You need to log in before you can comment on or make changes to this bug.