Open Bug 1489320 Opened 6 years ago Updated 2 years ago

GeckoDriver broken on mingw build

Categories

(Firefox Build System :: General: Unsupported Platforms, defect, P5)

defect

Tracking

(Not tracked)

People

(Reporter: tjr, Unassigned)

References

(Blocks 1 open bug)

Details

Bug 1417646 enabled geckodriver by default, and it exposed that it is broken in the MinGW build.

Here's a failure: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f3a57d37b78ffc534c3113f6e94150a62ac9c27a&selectedJob=197865901

This is because rust passes "-Wl,--enable-long-section-names" to the linker (here: https://github.com/rust-lang/rust/blame/master/src/librustc_target/spec/windows_base.rs#L42 ) on Windows.

It seems from https://github.com/rust-lang/rust/issues/32859 that we need to specify the linker explicitly (as [i686/x86_64]-w64-mingw32-gcc) instead of letting it pick up ld as the linker.
I did totally forget that mingw is also cross-compiling..

FWIW the error is;
 https://treeherder.mozilla.org/logviewer.html#?job_id=197865901&repo=try&lineNumber=48884

 error: linking with `gcc` failed: exit code: 1 
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" ...
  = note: /bin/ld: unrecognized option '--enable-long-section-names'
          /bin/ld: use the --help option for usage information
          collect2: error: ld returned 1 exit status
Thanks for reporting this.

(In reply to Tom Ritter [:tjr] from comment #0)

> Bug 1417646 enabled geckodriver by default, and it exposed that it
> is broken in the MinGW build.

Just a slight correction: this bug enabled geckodriver in
cross-compilation on macOS on try, not by default in local builds.
https://bugzilla.mozilla.org/show_bug.cgi?id=1471281 tracks enabling
geckodriver by default in local developer builds.  At the moment
you need ac_add_options --enable-geckodriver in your mozconfig for
it to be built locally.
So I had a try at fixing this, and didn't: https://treeherder.mozilla.org/#/jobs?repo=try&revision=18c0672163951a70b147c67e3c710cc2c8453ea4&selectedJob=198574476

I used this patch: https://hg.mozilla.org/try/rev/cb1726358ba4 which specifies the linker to be the mingw compiler I'm using; but I don't see any indication it's being used. The errors/output from the build still say "linking with `gcc` failed"

If anyone has any suggestions I'd be happy to try something else!
https://bugzilla.mozilla.org/show_bug.cgi?id=1471281 is now on
inbound, which will enable geckodriver by default in local builds.

You can use "ac_add_options --disable-geckodriver" to opt out of
building it, but we should probably have a mingw check around
https://hg.mozilla.org/mozilla-unified/rev/3a859a6f0720#l1.44.
Priority: -- → P5

/bin/ld: unrecognized option '--enable-long-section-names' means Binutils are too old, you need version 2.20 or higher.
This option won't work with LLD.

(In reply to Tom Ritter [:tjr] (needinfo for responses to sec-[approval/ratings/advisories/cve's]) from comment #3)

So I had a try at fixing this, and didn't:
https://treeherder.mozilla.org/#/
jobs?repo=try&revision=18c0672163951a70b147c67e3c710cc2c8453ea4&selectedJob=1
98574476

I used this patch: https://hg.mozilla.org/try/rev/cb1726358ba4 which
specifies the linker to be the mingw compiler I'm using; but I don't see any
indication it's being used. The errors/output from the build still say
"linking with gcc failed"

If anyone has any suggestions I'd be happy to try something else!

I think you are hitting https://github.com/mstorsjo/llvm-mingw/issues/56 on the llvm-mingw side and https://github.com/rust-lang/rust/issues/62576 on the rust side.

This got recently solved, though, by https://github.com/rust-lang/rust/pull/66257. You can easily backport the patch as the longer section names were only needed for .note.rustc but that was changed long ago in f9846e902dae169255c2d2b1766e7b9846488a89 and 1bb14445160329c2ca5ff9c202e791ca0098d944 (which landed in Rust 1.2.0 and 1.12.0 respectively).

I gave that a try and the result looks much better now. The final geckodriver linking breaks, though:

8:46.48 = note: lld: error: unable to find library -lgcc_eh
8:46.48 clang-8: error: linker command failed with exit code 1 (use -v to see invocation)

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.