Closed Bug 1414370 Opened 2 years ago Closed 2 years ago

Ensure ldflags are emitted for directories containing only rust compilation

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set

Tracking

(firefox58 fixed)

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: chmanchester, Assigned: chmanchester)

References

Details

Attachments

(1 file)

As a side effect of bug 1411712 I'm seeing MOZ_CARGO_WRAP_LDFLAGS empty in a lot of command lines.
Is this bug here or bug 1411712 responsible for the Mac build bustage on Thunderbird? Apparently the linker crashes:

error: linking with `/builds/slave/tb-c-cen-m64-00000000000000000/build/mozilla/build/cargo-linker` failed: exit code: 1
  |
  = note: "/builds/slave/tb-c-cen-m64-00000000000000000/build/mozilla/build/cargo-linker" "-m64" "-L" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/objdir-tb/toolkit/library/release/build/core-foundation-sys-de315f6b16b22143/build_script_build-de315f6b16b22143.0.o" "-o" "/builds/slave/tb-c-cen-m64-00000000000000000/build/objdir-tb/toolkit/library/release/build/core-foundation-sys-de315f6b16b22143/build_script_build-de315f6b16b22143" "/builds/slave/tb-c-cen-m64-00000000000000000/build/objdir-tb/toolkit/library/release/build/core-foundation-sys-de315f6b16b22143/build_script_build-de315f6b16b22143.crate.allocator.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/builds/slave/tb-c-cen-m64-00000000000000000/build/objdir-tb/toolkit/library/release/deps" "-L" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libstd-a4cb6a5cdd439628.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/librand-d0d8801a35685ad6.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-bf40ace258e8c400.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-232b33d68f8d8793.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-518d4b2a103f523e.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libunwind-ae44887349ff2666.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/liblibc-547714683d755c8a.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/liballoc-ee8c941dfe26cb03.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libstd_unicode-ed28cc142b5072c0.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libcore-2e89074855638f2b.rlib" "/builds/slave/tb-c-cen-m64-00000000000000000/build/rustc/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-3cf04f5feabf9eee.rlib" "-l" "System" "-l" "resolv" "-l" "pthread" "-l" "c" "-l" "m"
  = note: Assertion failed: (_mode == modeFinalAddress), function finalAddress, file /SourceCache/ld64/ld64-123.2.1/src/ld/ld.hpp, line 573.
          0  0x103a9971c  __assert_rtn + 76
          1  0x103b1201c  ld::tool::OutputFile::addressOf(ld::Internal const&, ld::Fixup const*, ld::Atom const**) + 172
          2  0x103b14a25  ld::tool::OutputFile::applyFixUps(ld::Internal&, unsigned long long, ld::Atom const*, unsigned char*) + 3909
          3  0x103b10f70  ld::tool::OutputFile::writeOutputFile(ld::Internal&) + 816
          4  0x103b09ab9  ld::tool::OutputFile::write(ld::Internal&) + 153
          5  0x103a99caa  main + 1178
          clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
Duplicate of this bug: 1414711
Attachment #8925122 - Flags: review?(mshal)
Attachment #8925122 - Flags: review?(core-build-config-reviews)
Attachment #8925122 - Flags: review+
Attachment #8925122 - Flags: review?(nfroyd)
Attachment #8925122 - Flags: review+
Comment on attachment 8925122 [details]
Bug 1414370 - Emit ldflags in directories containing only rust programs for the benefit of cargo.

https://reviewboard.mozilla.org/r/196370/#review201960
Attachment #8925122 - Flags: review?(nfroyd) → review+
Pushed by cmanchester@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/82e2afb4d904
Emit ldflags in directories containing only rust compilation for the benefit of cargo. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/82e2afb4d904
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
It appears this still doesn't handle directories that only have `RustProgram`s in them.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #8925122 - Flags: review+ → review?(nfroyd)
Attachment #8925122 - Flags: review?(nfroyd)
Comment on attachment 8925122 [details]
Bug 1414370 - Emit ldflags in directories containing only rust programs for the benefit of cargo.

https://reviewboard.mozilla.org/r/196370/#review202292

Sorry for missing this last time...I thought the programs would show up in the linkables list, but I guess not!

::: python/mozbuild/mozbuild/frontend/emitter.py:554
(Diff revision 4)
> +            if kind == 'RUST_PROGRAMS':
> +                self._rust_compile_dirs.add(context.objdir)

Why are we avoiding this for host rust programs?  I guess the workarounds we have in `rules.mk` only apply to target programs, so we don't need to care so much for host programs?  Might be reasonable to say something about that in a comment.
Attachment #8925122 - Flags: review?(nfroyd) → review+
Comment on attachment 8925122 [details]
Bug 1414370 - Emit ldflags in directories containing only rust programs for the benefit of cargo.

https://reviewboard.mozilla.org/r/196370/#review202292

> Why are we avoiding this for host rust programs?  I guess the workarounds we have in `rules.mk` only apply to target programs, so we don't need to care so much for host programs?  Might be reasonable to say something about that in a comment.

Right, we're only passing these flags to target programs/libraries, so I don't want emit them and let us pick up an implicit dependency along the way.
Pushed by cmanchester@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ee8c2f65351c
Emit ldflags in directories containing only rust programs for the benefit of cargo. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/ee8c2f65351c
Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.