mach rusttests stylo_tests link failure on Windows

NEW
Unassigned

Status

defect
4 months ago
3 months ago

People

(Reporter: agashlin, Unassigned)

Tracking

({in-triage})

Trunk

Firefox Tracking Flags

(Not tracked)

Details

Running ./mach rusttests seems to properly run the tests for geckodriver, mozprofile, mozrunner, firefox_defaultpath, mozversion, and webdriver, but when linking stylo_tests it hits "315 unresolved externals", lines like:

 0:58.92   = note: libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.1t7qpizx0vv2o30j.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.92
 0:58.92           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.1x884cnqrsh6nh4j.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.92
 0:58.92           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.24sxny73i2e1a557.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.35l0lqxm1vhdyn2j.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.11sl79r1wn1rcds4.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.3fjhxommftc2as3m.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.1fu5ly06zbbz2z2j.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.2iif32sb4vggffgq.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.3ckxg9pmhz004239.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.94
 0:58.94           libstyle-c27f4e651ef7f93f.rlib(style-c27f4e651ef7f93f.516g9z390dpqnean.rcgu.o) : error LNK2001: unresolved external symbol "struct mozilla::detail::GkAtoms const mozilla::detail::gGkAtoms" (?gGkAtoms@detail@mozilla@@3UGkAtoms@12@B)
 0:58.95

...

 1:00.01 error: aborting due to previous error
 1:00.01 error: Could not compile `stylo_tests`.
 1:00.01 To learn more, run the command again with --verbose.
 1:00.01 mozmake.EXE[1]: *** [c:/mozilla-source/mozilla-central3/config/makefiles/rust.mk:247: force-cargo-test-run] Error 101
 1:00.01 mozmake.EXE: *** [c:/mozilla-source/mozilla-central3/config/recurse.mk:101: toolkit/library/rust/rusttests] Error 2
 1:00.05 230 compiler warnings present.

This happens regardless of whether I've set ac_add_options --enable-rust-tests in my mozconfig (not sure if it is necessary but just one thing I tried).

Flags: needinfo?(emilio)

Hmm, it seems to work fine here on Linux... How does your mozconfig look like?

Flags: needinfo?(emilio) → needinfo?(agashlin)

I have no mozconfig in this tree. I assume it's a Windows thing.

Flags: needinfo?(agashlin)

I'm not sure exactly what the fix needs to be here, but this seems to have to do with the optimization level. I'm able to reproduce but fix with --enable-release in my mozconfig. There's some discussion that seems relevant around https://bugzilla.mozilla.org/show_bug.cgi?id=1373878#c36. Emilio, does that ring a bell? Any ideas for a workaround here?

Flags: needinfo?(emilio)

Ah, that's right. I guess in debug builds the linker doesn't strip the symbols, and thus the build fails... As for what the right fix is, I'm not sure, we do need an executable in order to run the tests.

If all the missing symbols are gGkAtoms, we could maybe just provide the definition on the rust side for tests.

As for workarounds... Those errors look like link.exe errors: Does using lld rather than link.exe work?

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

As for workarounds... Those errors look like link.exe errors: Does using lld
rather than link.exe work?

It would be very desirable to stop using link.exe, but we can't until bug 1535177 is fixed.

In any case though, unresolved external symbol errors are usually a build issue and aren't fixable with a change of linker (I have seen it happen, but it's super rare).

I haven't seen this issue in a while, rusttests are running fine locally on Windows now. Maybe my build was just in a weird state, or maybe this was fixed by bug 1524396? I'm fine with closing this if no one is still looking into it.

You need to log in before you can comment on or make changes to this bug.