Closed Bug 1836723 Opened 11 months ago Closed 11 months ago

lld-link: error: undefined symbol: __declspec(dllimport) NtCreateFile

Categories

(Firefox Build System :: Toolchains, defect)

defect

Tracking

(firefox-esr102 fixed, firefox114 fixed, firefox115 fixed, firefox116 fixed)

RESOLVED FIXED
116 Branch
Tracking Status
firefox-esr102 --- fixed
firefox114 --- fixed
firefox115 --- fixed
firefox116 --- fixed

People

(Reporter: florian, Assigned: glandium)

References

Details

Attachments

(1 file)

Today I found that my Windows laptop can no longer build mozilla-central. This is after updating to the current mozilla-central. Running mach bootstrap and then mach clobber and mach build again didn't help. Here's the error message:

./mach build
 0:00.96 Clobber not needed.
 0:01.22 Adding make options from C:\buildhg\mozilla\mozconfig
    MOZ_OBJDIR=C:/buildhg/mozilla/obj-x86_64-pc-windows-msvc
    OBJDIR=C:/buildhg/mozilla/obj-x86_64-pc-windows-msvc
    FOUND_MOZCONFIG=C:/buildhg/mozilla/mozconfig
    export FOUND_MOZCONFIG
  Parallelism determined by memory: using 20 jobs for 20 cores based on 31.7 GiB RAM and estimated job size of 1.0 GiB
 0:01.22 C:/Users/florian/.mozbuild/mozmake/mozmake.exe -f client.mk -j20 -s
 0:01.71 Elapsed: 0.00s; From dist/public: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:01.71 Elapsed: 0.00s; From dist/private: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:01.73 Elapsed: 0.02s; From dist/xpi-stage: Kept 89 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:02.07 Elapsed: 0.36s; From _tests: Kept 0 existing; Added/updated 1361; Removed 0 files and 0 directories.
 0:02.27 Elapsed: 0.56s; From dist/bin: Kept 0 existing; Added/updated 2748; Removed 0 files and 0 directories.
 0:02.72 Elapsed: 1.02s; From dist/include: Kept 0 existing; Added/updated 7002; Removed 0 files and 0 directories.
 0:02.81 ./buildid.h.stub
 0:02.81 ./source-repo.h.stub
 0:03.64 ./application.ini.stub
 0:03.64 ./IsCombiningDiacritic.h.stub
 0:03.88 ./application.ini.h.stub
 0:04.54 browser/app
 0:09.84 browser/app/firefox.exe
 0:09.93 security/manager/ssl/builtins/dynamic-library/nssckbi.dll
 0:09.96 security/manager/ssl/ipcclientcerts/dynamic-library/ipcclientcerts.dll
 0:09.96 lld-link: error: undefined symbol: __declspec(dllimport) NtCreateFile
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\fs.rs:800
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::fs::open_link_no_reparse::h9b3d5753800c4b4f)
 0:09.96 lld-link: error: undefined symbol: __declspec(dllimport) RtlNtStatusToDosError
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\fs.rs:829
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::fs::open_link_no_reparse::h9b3d5753800c4b4f)
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:272
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_read::h609a485d92162e8d)
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:318
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_write::h5e143db420a86fa8)
 0:09.96 lld-link: error: undefined symbol: __declspec(dllimport) NtReadFile
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:241
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_read::h609a485d92162e8d)
 0:09.96 lld-link: error: undefined symbol: __declspec(dllimport) NtWriteFile
 0:09.96 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:290
 0:09.96 >>>               builtins_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_write::h5e143db420a86fa8)
 0:09.96 mozmake[4]: *** [C:/buildhg/mozilla/config/rules.mk:535: nssckbi.dll] Error 1
 0:09.97 mozmake[3]: *** [C:/buildhg/mozilla/config/recurse.mk:72: security/manager/ssl/builtins/dynamic-library/target] Error 2
 0:09.97 mozmake[3]: *** Waiting for unfinished jobs....
 0:09.99 lld-link: error: undefined symbol: __declspec(dllimport) NtCreateFile
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\fs.rs:800
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::fs::open_link_no_reparse::h9b3d5753800c4b4f)
 0:09.99 lld-link: error: undefined symbol: __declspec(dllimport) RtlNtStatusToDosError
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\fs.rs:829
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::fs::open_link_no_reparse::h9b3d5753800c4b4f)
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:272
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_read::h609a485d92162e8d)
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:318
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_write::h5e143db420a86fa8)
 0:09.99 lld-link: error: undefined symbol: __declspec(dllimport) NtReadFile
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:241
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_read::h609a485d92162e8d)
 0:09.99 lld-link: error: undefined symbol: __declspec(dllimport) NtWriteFile
 0:09.99 >>> referenced by /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys\windows\handle.rs:290
 0:09.99 >>>               ipcclientcerts_static.lib(std-391022a4250a8b9a.std.feb3b897-cgu.0.rcgu.o):(std::sys::windows::handle::Handle::synchronous_write::h5e143db420a86fa8)
 0:10.00 mozmake[4]: *** [C:/buildhg/mozilla/config/rules.mk:535: ipcclientcerts.dll] Error 1
 0:10.00 mozmake[3]: *** [C:/buildhg/mozilla/config/recurse.mk:72: security/manager/ssl/ipcclientcerts/dynamic-library/target] Error 2
 0:10.00 mozmake[2]: *** [C:/buildhg/mozilla/config/recurse.mk:34: compile] Error 2
 0:10.00 mozmake[1]: *** [C:/buildhg/mozilla/config/rules.mk:361: default] Error 2
 0:10.00 mozmake: *** [client.mk:60: build] Error 2
 0:10.03 358 compiler warnings present.
Duplicate of this bug: 1836742

This is fixed by bug 1821228, but let's keep this to track this specific issue on other branches.

Bug 1821228 is being backed out so let's fix this separately.

Assignee: nobody → mh+mozilla

Building with rustc 1.70 adds a dependency to the ntdll library through
libstd using NtCreateFile/NtWriteFile (it previously picked the symbols
at runtime).

Pushed by smolnar@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/3a79e9a1c11d
Link against ntdll for rustc 1.70. r=firefox-build-system-reviewers,ahochheiden
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch

Thank you for fixing this! This has been vexing me for a few days, and I only just barely got bandwidth to even consider filing a bug. 🙏🏻

The patch landed in nightly and beta is affected.
:glandium, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox115 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(mh+mozilla)

Comment on attachment 9337549 [details]
Bug 1836723 - Link against ntdll for rustc 1.70.

Beta/Release Uplift Approval Request

  • User impact if declined: Build failures with rustc 1.70 on Windows
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It only adds an extra DLL dependency, which in most cases is already pulled some other way anyways (it's a very central DLL in Windows)
  • String changes made/needed: N/A
  • Is Android affected?: No
Flags: needinfo?(mh+mozilla)
Attachment #9337549 - Flags: approval-mozilla-beta?

Comment on attachment 9337549 [details]
Bug 1836723 - Link against ntdll for rustc 1.70.

Approved for 115.0b3.

Attachment #9337549 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Can we please get release and ESR approval requests for this as well?

Flags: needinfo?(mh+mozilla)

Comment on attachment 9337549 [details]
Bug 1836723 - Link against ntdll for rustc 1.70.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Build failures with rustc 1.70 on Windows
  • User impact if declined: Build failures with rustc 1.70 on Windows
  • Fix Landed on Version: 116
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It only adds an extra DLL dependency, which in most cases is already pulled some other way anyways (it's a very central DLL in Windows)

Beta/Release Uplift Approval Request

  • User impact if declined: Build failures with rustc 1.70 on Windows
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It only adds an extra DLL dependency, which in most cases is already pulled some other way anyways (it's a very central DLL in Windows)
  • String changes made/needed: N/A
  • Is Android affected?: No
Flags: needinfo?(mh+mozilla)
Attachment #9337549 - Flags: approval-mozilla-release?
Attachment #9337549 - Flags: approval-mozilla-esr102?

Comment on attachment 9337549 [details]
Bug 1836723 - Link against ntdll for rustc 1.70.

Approved for our planned dot release this week, thanks.

Attachment #9337549 - Flags: approval-mozilla-release? → approval-mozilla-release+

:glandium esr102 doesn't have security/manager/ssl/builtins/dynamic-library/moz.build - looks like it was added in Bug 1789520
Is it safe to leave this out in the uplifting to esr102 or is a new patch needed for esr102?

Flags: needinfo?(mh+mozilla)

yes, you can skip that one file.

Flags: needinfo?(mh+mozilla)

Comment on attachment 9337549 [details]
Bug 1836723 - Link against ntdll for rustc 1.70.

Approved for 102.13esr.

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

Attachment

General

Created:
Updated:
Size: