Closed Bug 2023335 Opened 8 months ago Closed 8 months ago

Unable to compile Windows ASan SpiderMonkey build (--enable-address-sanitizer) using configure

Categories

(Core :: Gecko Profiler, defect)

x86_64
Windows
defect

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox148 --- unaffected
firefox149 --- unaffected
firefox150 --- fixed

People

(Reporter: gkw, Assigned: dcarver)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [fp])

Attachments

(1 file, 1 external file, 1 obsolete file)

Using the following configure on gh rev 7dc5ce10ed470b11b8626d85a08a6f2d419095c5 on MozillaBuild 4.2.1:

'LDFLAGS="clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"' 'CLANG_LIB_DIR="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows"' 'MOZ_CLANG_RT_ASAN_LIB_PATH="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows/clang_rt.asan_dynamic-x86_64.dll"' 'LIB="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows"' 'PATH="C:\Users\omni14b\.mozbuild\clang\lib\clang\20\lib\windows;C:\Users\omni14b\trees\depot_tools;C:\Users\omni14b\AppData\Local\fnm_multishells\46548_1773477001811;C:\Users\omni14b\.deno\bin;C:\Users\omni14b\.cargo\bin;C:\mozilla-build\msys2\usr\share\doc\git\contrib\diff-highlight;C:\Users\omni14b\.local\bin;C:\Windows\System32\OpenSSH\;C:\mozilla-build\bin;C:\mozilla-build\kdiff3;C:\mozilla-build\python3;C:\mozilla-build\python3\Scripts;C:\mozilla-build\msys2\mingw64\bin;C:\mozilla-build\msys2\usr\local\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\opt\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\HP\HP One Agent;C:\Program Files\Tailscale;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Git\cmd;C:\Users\omni14b\.cargo\bin;C:\Users\omni14b\AppData\Local\Microsoft\WindowsApps;C:\Users\omni14b\AppData\Local\Programs\Microsoft VS Code\bin;C:\mozilla-build\msys2\usr\bin\site_perl;C:\mozilla-build\msys2\usr\bin\vendor_perl;C:\mozilla-build\msys2\usr\bin\core_perl"' sh C:/Users/omni14b/trees/firefox/js/src/configure --host=x86_64-pc-windows-msvc --target=x86_64-pc-windows-msvc --enable-fuzzing --enable-address-sanitizer --disable-jemalloc --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests

fails at:

js/src/build/js_static.lib
js/src/build/mozjs-150a1.dll
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components0.obj: locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components0.obj: locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components0.obj: locally defined symbol imported: void __cdecl mozilla::detail::InvalidArrayIndex_CRASH(unsigned __int64, unsigned __int64) (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components1.obj: locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components1.obj: locally defined symbol imported: void __cdecl mozilla::detail::InvalidArrayIndex_CRASH(unsigned __int64, unsigned __int64) (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components1.obj: locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components2.obj: locally defined symbol imported: void __cdecl mozilla::detail::InvalidArrayIndex_CRASH(unsigned __int64, unsigned __int64) (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components2.obj: locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components2.obj: locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components3.obj: locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components3.obj: locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components4.obj: locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\intl\components\Unified_cpp_intl_components4.obj: locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: warning: ..\..\..\config\external\icu\i18n\measunit_extra.obj: locally defined symbol imported: public: double __cdecl double_conversion::StringToDoubleConverter::StringToDouble(char const *, int, int *) const (defined in ..\..\..\mfbt\Unified_cpp_mfbt1.obj) [LNK4217]
lld-link: warning: ..\..\..\config\external\icu\i18n\number_decimalquantity.obj: locally defined symbol imported: public: double __cdecl double_conversion::StringToDoubleConverter::StringToDouble(unsigned short const *, int, int *) const (defined in ..\..\..\mfbt\Unified_cpp_mfbt1.obj) [LNK4217]
lld-link: warning: ..\..\..\config\external\icu\i18n\number_decimalquantity.obj: locally defined symbol imported: public: static void __cdecl double_conversion::DoubleToStringConverter::DoubleToAscii(double, enum double_conversion::DoubleToStringConverter::DtoaMode, int, char *, int, bool *, int *, int *) (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\config\external\icu\i18n\number_utils.obj: locally defined symbol imported: public: static void __cdecl double_conversion::DoubleToStringConverter::DoubleToAscii(double, enum double_conversion::DoubleToStringConverter::DtoaMode, int, char *, int, bool *, int *, int *) (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: ..\..\..\config\external\icu\i18n\units_converter.obj: locally defined symbol imported: public: double __cdecl double_conversion::StringToDoubleConverter::StringToDouble(char const *, int, int *) const (defined in ..\..\..\mfbt\Unified_cpp_mfbt1.obj) [LNK4217]
lld-link: warning: jsrust.lib(97cc2182c72ccc3b-wrappers.o): locally defined symbol imported: gMozCrashReason (defined in ..\..\..\mfbt\Unified_cpp_mfbt0.obj) [LNK4217]
lld-link: warning: jsrust.lib(97cc2182c72ccc3b-wrappers.o): locally defined symbol imported: void __cdecl mozalloc_handle_oom(unsigned __int64) (defined in ..\..\..\memory\mozalloc\Unified_cpp_memory_mozalloc0.obj) [LNK4217]
lld-link: warning: jsrust.lib(97cc2182c72ccc3b-wrappers.o): locally defined symbol imported: MozWalkTheStack (defined in ..\..\..\mozglue\misc\StackWalk.obj) [LNK4217]
lld-link: error: undefined symbol: private: static class mozilla::Atomic<unsigned int, 0, void> mozilla::baseprofiler::detail::RacyFeatures::sActiveAndFeatures
>>> referenced by C:\Users\omni14b\shell-cache\js-64-asan-windows-amd64-7dc5ce10ed47-613458\objdir-js\dist\include\mozilla\BaseProfilerState.h:292
>>>               ..\Unified_cpp_js_src0.obj:(public: static class mozilla::Maybe<unsigned int> __cdecl mozilla::baseprofiler::detail::RacyFeatures::FeaturesIfActive(void))
>>> referenced by C:\Users\omni14b\shell-cache\js-64-asan-windows-amd64-7dc5ce10ed47-613458\objdir-js\dist\include\mozilla\BaseProfilerState.h:292
>>>               ..\Unified_cpp_js_src0.obj:(public: static class mozilla::Maybe<unsigned int> __cdecl mozilla::baseprofiler::detail::RacyFeatures::FeaturesIfActive(void))
>>> referenced by C:\Users\omni14b\shell-cache\js-64-asan-windows-amd64-7dc5ce10ed47-613458\objdir-js\dist\include\mozilla\BaseProfilerState.h:292
>>>               ..\Unified_cpp_js_src0.obj:(public: static class mozilla::Maybe<unsigned int> __cdecl mozilla::baseprofiler::detail::RacyFeatures::FeaturesIfActive(void))
>>> referenced 1 more times
mozmake[3]: *** [C:/Users/omni14b/trees/firefox/config/rules.mk:533: ../../../dist/bin/mozjs-150a1.dll] Error 1
mozmake[2]: *** [C:/Users/omni14b/trees/firefox/config/recurse.mk:72: js/src/build/target] Error 2
mozmake[1]: *** [C:/Users/omni14b/trees/firefox/config/recurse.mk:34: compile] Error 2
mozmake: *** [C:/Users/omni14b/trees/firefox/config/rules.mk:359: default] Error 2

The command used to work with x86_64-pc-mingw32 which was removed in favour of x86_64-pc-windows-msvc.

I then switched to x86_64-pc-windows-gnu for both the target and host:

'LDFLAGS="clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"' 'CLANG_LIB_DIR="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows"' 'MOZ_CLANG_RT_ASAN_LIB_PATH="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows/clang_rt.asan_dynamic-x86_64.dll"' 'LIB="C:/Users/omni14b/.mozbuild/clang/lib/clang/20/lib/windows"' 'PATH="C:\Users\omni14b\.mozbuild\clang\lib\clang\20\lib\windows;C:\Users\omni14b\trees\depot_tools;C:\Users\omni14b\AppData\Local\fnm_multishells\46548_1773477001811;C:\Users\omni14b\.deno\bin;C:\Users\omni14b\.cargo\bin;C:\mozilla-build\msys2\usr\share\doc\git\contrib\diff-highlight;C:\Users\omni14b\.local\bin;C:\Windows\System32\OpenSSH\;C:\mozilla-build\bin;C:\mozilla-build\kdiff3;C:\mozilla-build\python3;C:\mozilla-build\python3\Scripts;C:\mozilla-build\msys2\mingw64\bin;C:\mozilla-build\msys2\usr\local\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\opt\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\HP\HP One Agent;C:\Program Files\Tailscale;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Git\cmd;C:\Users\omni14b\.cargo\bin;C:\Users\omni14b\AppData\Local\Microsoft\WindowsApps;C:\Users\omni14b\AppData\Local\Programs\Microsoft VS Code\bin;C:\mozilla-build\msys2\usr\bin\site_perl;C:\mozilla-build\msys2\usr\bin\vendor_perl;C:\mozilla-build\msys2\usr\bin\core_perl"' sh C:/Users/omni14b/trees/firefox/js/src/configure --host=x86_64-pc-windows-gnu --target=x86_64-pc-windows-gnu --enable-fuzzing --enable-address-sanitizer --disable-jemalloc --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests

But got a different error, see attached.

Serge, glandium, any ideas?

Flags: needinfo?(sguelton)

Set release status flags based on info from the regressing bug 1617793

Are you sure this is not a regression from bug 1635350?

Flags: needinfo?(nth10sd)

Oh, you're right! Backing out the patch for bug 1635350 seems to give a working Windows ASan build.

Component: General → JavaScript Engine
Flags: needinfo?(sguelton)
Flags: needinfo?(nth10sd)
Flags: needinfo?(dcarver)
Product: Firefox Build System → Core
Regressed by: 1635350
No longer regressed by: 1617793
Version: unspecified → Trunk
Component: JavaScript Engine → Gecko Profiler
Summary: Unable to compile Windows ASan build (--enable-address-sanitizer) using configure → Unable to compile Windows ASan SpiderMonkey build (--enable-address-sanitizer) using configure
Assignee: nobody → dcarver
Flags: needinfo?(dcarver)
Whiteboard: [fp]

Please help me reproduce the issue locally with MozillaBuild. I'm getting another error that I don't understand:

SUMMARY: AddressSanitizer: bad-malloc_usable_size (C:\windows\System32\ucrtbase.dll+0x18003d1c3) in strnicoll+0xa3
==31672==ABORTING
error: could not compile `mozglue-static` (build script)

Here is the .mozconfig that I used

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-js-asan
ac_add_options --enable-project=js
ac_add_options --enable-address-sanitizer
ac_add_options --disable-jemalloc
export PATH=$PATH:~/.mozbuild/clang/lib/clang/20/lib/windows/

I get the same result with PATH=$PATH:~/.mozbuild/clang/lib/clang/20/lib/windows/ ../configure --enable-address-sanitizer --disable-jemalloc && ~/.mozbuild/mozmake/mozmake.exe

Flags: needinfo?(nth10sd)

I don't know if this is the issue you are having, but last time I needed to compile on Windows with sanitizers (over a year ago), I also needed to add this to my mozconfig:

export CFLAGS="-fms-runtime-lib=static"
export CXXFLAGS="-fms-runtime-lib=static"
export RUSTFLAGS="-C target-feature=+crt-static"

I'll keep this on my to-do list, unfortunately I'm busy over the next few days.

platform.cpp is not included in standalone mode, and
RacyFeatures::sActiveAndFeatures is needed against
--enable-address-sanitizer.

Instead of including the whole platform.cpp in standalone mode (it
proved to bring its own set of dependencies), just make the
RacyFeatures::sActiveAndFeatures definition inline.

It's no longer initialized explicitly to zero, but it is implicitly.

Attached file Bug 2023335 - Remove unused include r=sergesanspaille,canaltinova — Details

I confirm that the patch in comment 8 above, fixes the issue!

Flags: needinfo?(nth10sd)
OS: Unspecified → Windows
Hardware: Unspecified → x86_64
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch

Reopened for an unpublished changeset.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

fwiw, latest changeset that includes this change compiles Windows ASan builds just fine now, so I guess this can be resolved however needed.

Flags: needinfo?(sguelton)
Flags: needinfo?(dcarver)
Attachment #9553909 - Attachment is obsolete: true
Status: REOPENED → RESOLVED
Closed: 8 months ago → 8 months ago
Flags: needinfo?(dcarver)
Resolution: --- → FIXED
Flags: needinfo?(sguelton)
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: