Problem building 102.3.0ESR on Windows

Hi,
I’m trying to upgrade our embedding from 91 to 102 so I followed the following steps to try to build on windows (using VS2019)

  1. Installed Rust (version 1.63)
  2. Installed LLVM/clang-cl 12.0.1
  3. Installed mozillabuild
  4. Download http://ftp.mozilla.org/pub/firefox/releases/102.3.0esr/source/firefox-102.3.0esr.source.tar.xz
  5. Made mozjs-102.3.0.tar.xz by running ‘python3 make-source-package.py’ in the js/src directory
  6. Made a mozconfig file containing

ac_add_options --enable-application=js
ac_add_options --prefix=C:/SOURCE20/spidermonkey_dir/js102_release
ac_add_options --disable-jemalloc
ac_add_options --disable-debug-symbols
ac_add_options --enable-optimize
ac_add_options --enable-strip
ac_add_options --enable-install-strip
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/js/src/releaseob

  1. Started mozillabuild, added Rust and LLVM to path with
    export PATH=$PATH:"/c/Program Files/LLVM/bin"
    export PATH=$PATH:"/c/Users/miles.thornton/AppData/Local/Programs/Rust stable MSVC 1.63/bin"
    and set the mozconfig file with
    export MOZCONFIG=/c/SOURCE20/javascript_dir/mozconfig/js102_win_release
  2. Tried to build with
    ./mach build

This churns away for a while and gives the following error

6:15.14 js/src/build/js_static.lib
6:15.21 js/src/build/mozjs-102.dll
6:16.03 lld-link: error: duplicate symbol: DllMain
6:16.03 >>> defined at …\Unified_cpp_js_src8.obj
6:16.03 >>> defined at …\mozglue\misc\WindowsDllMain.obj
6:16.08 gmake.exe[4]: *** [C:/SOURCE20/spidermonkey_dir/mozjs-102.3.0/config/rules.mk:540: mozjs-102.dll] Error 1
6:16.08 gmake.exe[3]: *** [C:/SOURCE20/spidermonkey_dir/mozjs-102.3.0/config/recurse.mk:72: js/src/build/target] Error 2
6:16.08 gmake.exe[2]: *** [C:/SOURCE20/spidermonkey_dir/mozjs-102.3.0/config/recurse.mk:34: compile] Error 2
6:16.08 gmake.exe[1]: *** [C:/SOURCE20/spidermonkey_dir/mozjs-102.3.0/config/rules.mk:361: default] Error 2
6:16.08 gmake.exe: *** [client.mk:63: build] Error 2
6:16.11 13 compiler warnings present.

Can anybody give me any help? What am I doing wrong?
In older versions I remember that the mozjs tarball did not contain mozglue/dllservices and I had to manually add it but it looks like things have changed in the build since then.
Is there something similar that I need to do?
I would be very grateful for any help.

Thanks

Miles

It looks like my comments in my mozconfig file starting with ‘#’ have been turned into markup in my post above. Apologies. I hope it still makes sense…
Actually, I’ve just realised that I can edit it so I have removed the comments…

This seems to be a known issue: Bug 1751561

You should be able to work around it by commenting out the DllMain function mozglue/misc/WindowsDllMain.cpp.

1 Like

Thanks for the reply and info.
I had managed to build it in the end yesterday by doing something similar (I edited mozglue/misc/moz.build and removed WindowsDllMain.cpp from SOURCES so it just didn’t compile it). However, I wasn’t sure if this was the “correct” thing to do and whether I would just get problems later on, so thanks for the info. Good to know that what I did was OK.

Thanks again for the prompt response.

Miles