Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Cross-Compile Firefox 68 on Ubuntu 16.04 for Windows Linker Error

87 views
Skip to first unread message

oceanl

unread,
Jun 10, 2020, 10:13:21 PM6/10/20
to

Hi,
I'm cross-compiling Firefox 68 for Windows on Ubuntu 16.04 and have run into these errors when mozglue.dll is being built.

The errors are the following:
0:00.49 lld-link: error: unknown file type: ssp.o
0:00.49 lld-link: error: unknown file type: ios.cpp.o
0:00.49 lld-link: error: unknown file type: locale.cpp.o
0:00.49 lld-link: error: unknown file type: new.cpp.o
0:00.49 lld-link: error: unknown file type: string.cpp.o

I'm using the instructions and tool binary downloads from this page.
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Cross_Compile_Mozilla_for_Mingw32

The error message and my .mozconfig are listed below.

Any help will be greatly appreciated!


Error Message:
0:00.48 InstalledDir: /home/oceanl/tooltool/clang/bin
0:00.48 "/home/oceanl/tooltool/clang/bin/ld.lld" --sysroot=/home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32 -m i386pep --subsystem windows --shared -Bdynamic -e DllMainCRTStartup --enable-auto-image-base -o mozglue.dll /home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/lib/dllcrt2.o /home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/lib/crtbegin.o -L/home/oceanl/tooltool/clang/lib -L/home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/x86_64-w64-mingw32/lib -L/home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/lib -L/home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/mingw/lib --gc-sections --out-implib libmozglue.a -pdb mozglue.pdb Authenticode.o SSE.o UntrustedDllsHandler.o WindowsDllBlocklist.o ../../memory/build/Unified_cpp_memory_build0.o ../../memory/mozalloc/mozalloc_abort.o ../../memory/mozalloc/winheap.o ../../memory/mozalloc/Unified_cpp_memory_mozalloc0.o ../misc/AutoProfilerLabel.o ../misc/ConditionVariable_windows.o ../misc/Mutex_windows.o ../misc/Printf.o ../misc/StackWalk.o ../misc/TimeStamp.o ../misc/TimeStamp_windows.o ../misc/WindowsMapRemoteView.o ../misc/WindowsProcessMitigations.o ../../ipc/mscom/mozglue/Unified_cpp_ipc_mscom_mozglue0.o ../../mfbt/lz4.o ../../mfbt/Compression.o ../../mfbt/Decimal.o ../../mfbt/Unified_cpp_mfbt0.o ../../mfbt/Unified_cpp_mfbt1.o ./module.res -S -lssp --dynamicbase --icf=safe mozglue.def -Xlink=-DELAYLOAD:user32.dll -Xlink=-DELAYLOAD:crypt32.dll -Xlink=-DELAYLOAD:wintrust.dll -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -ldbghelp -lcrypt32 -lversion -lwintrust -ldelayimp -lc++ -lssp_nonshared -lssp -lmingw32 /home/oceanl/tooltool/clang/lib/clang/8.0.1/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 /home/oceanl/tooltool/clang/lib/clang/8.0.1/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt /home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/lib/crtend.o
0:00.49 lld-link: error: unknown file type: ssp.o
0:00.49 lld-link: error: unknown file type: ios.cpp.o
0:00.49 lld-link: error: unknown file type: locale.cpp.o
0:00.49 lld-link: error: unknown file type: new.cpp.o
0:00.49 lld-link: error: unknown file type: string.cpp.o
0:00.49 clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
0:00.49 /home/oceanl/mozilla-source/current/config/rules.mk:680: recipe for target 'mozglue.dll' failed
0:00.49 make[4]: *** [mozglue.dll] Error 1
0:00.49 /home/oceanl/mozilla-source/current/config/recurse.mk:74: recipe for target 'mozglue/build/target' failed
0:00.49 make[3]: *** [mozglue/build/target] Error 2
0:00.49 /home/oceanl/mozilla-source/current/config/recurse.mk:32: recipe for target 'compile' failed
0:00.49 make[2]: *** [compile] Error 2
0:00.49 /home/oceanl/mozilla-source/current/config/recurse.mk:152: recipe for target 'compile' failed
0:00.49 make[1]: *** [compile] Error 2
0:00.49 /home/oceanl/mozil

.mozconfig
CROSS_COMPILE=1

mk_add_options MOZ_MAKE_FLAGS=-j4

TOOLTOOL_DIR=/home/oceanl/tooltool

# MinGW does not have (or need) makecab
unset MAKECAB

RUSTC="${TOOLTOOL_DIR}/rustc/bin/rustc"
CARGO="${TOOLTOOL_DIR}/rustc/bin/cargo"
RUSTFMT="${TOOLTOOL_DIR}/rustc/bin/rustfmt"
CBINDGEN="${TOOLTOOL_DIR}/cbindgen/cbindgen"

mk_add_options AUTOCLOBBER=1

ac_add_options --enable-crashreporter
ac_add_options --enable-js-shell

# MinGW Stuff
ac_add_options --target=x86_64-w64-mingw32
ac_add_options --with-toolchain-prefix=x86_64-w64-mingw32-

ac_add_options --disable-warnings-as-errors
export MOZ_COPY_PDBS=1

# Temporary config settings until we get these working on mingw
ac_add_options --disable-accessibility # https://sourceforge.net/p/mingw-w64/bugs/648/

# These aren't supported on mingw at this time
ac_add_options --disable-maintenance-service
ac_add_options --disable-webrtc # Bug 1393901
ac_add_options --disable-stylo
ac_add_options --disable-tests
ac_add_options --disable-geckodriver # Bug 1489320

# Find our toolchain
HOST_CC="$TOOLTOOL_DIR/clang/bin/clang"
HOST_CXX="$TOOLTOOL_DIR/clang/bin/clang++"
CC="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang"
CXX="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang++"
CXXFLAGS="-fms-extensions -Wno-incompatible-ms-struct"
AR=llvm-ar
RANLIB=llvm-ranlib

# For Stylo
BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include"

# Bug 1471698 - Work around binutils corrupting mingw clang binaries.
LDFLAGS="-Wl,-S"
STRIP=/bin/true
OBJCOPY=/bin/true

# We want to make sure we use binutils and other binaries in the tooltool
# package.
mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"

LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64:$TOOLTOOL_DIR/clang/lib
mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"

ac_add_options --with-branding=browser/branding/unofficial




Tom Ritter

unread,
Jun 11, 2020, 10:48:38 AM6/11/20
to
So it looks like your mozconfig is a little out of date compared to the one in the -esr68 branch. e.g. Bug 1471698 was fixed and uplifted to esr68, so the bits about that workaround are not needed anymore. To eb safe I would go through and compare your mozconfig with https://searchfox.org/mozilla-esr68/source/browser/config/mozconfigs/win32/mingwclang

But these errors don't really seem to be related to that at a guess.

ssp is a library that we have wrestled with for a bit, so I would probably focus on that one first. You should see {libssp.a,libssp_nonshared.a} in /home/oceanl/tooltool/clang/bin/../x86_64-w64-mingw32/lib/ - it looks like you downloaded the toolchain but it might be outdated, because that wiki page is outdated (I've updated it, but with links for -central, not -esr68). I would strongly recommend downloading the toolchain vs trying to build it yourself.

The correct toolchains for x86/x64 for esr68 are:

https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-3.toolchains.v3.linux64-clang-8-mingw-x86.latest/artifacts/public/build/clangmingw.tar.xz

https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-3.toolchains.v3.linux64-clang-8-mingw-x64.latest/artifacts/public/build/clangmingw.tar.xz

Try updating the toolchain and cleaning the mozconfig and report back!
Message has been deleted

oceanl...@gmail.com

unread,
Jun 12, 2020, 11:59:54 AM6/12/20
to
On Thursday, June 11, 2020 at 4:07:19 PM UTC-7, oceanl...@gmail.com wrote:
> Hi Tom,
>
> The updated toolchain and .mozconfig cleanup fixed the link issue.
>
> Thank you for your help and the quick turn around.
> Much appreciated!

Hi Tom,
One question is there a location for the source that built the toolchain in clangmingw.tar.xz ?

Thanks

Tom Ritter

unread,
Jun 12, 2020, 12:42:12 PM6/12/20
to
On Fri, Jun 12, 2020 at 3:59 PM <oceanl...@gmail.com> wrote:
> Hi Tom,
> One question is there a location for the source that built the toolchain in clangmingw.tar.xz ?

Yup, it's in mozilla-central.

For -central:
https://searchfox.org/mozilla-central/source/taskcluster/scripts/misc/build-clang-mingw.sh
calls
https://searchfox.org/mozilla-central/source/build/build-clang/build-clang.py
with
https://searchfox.org/mozilla-central/source/build/build-clang/clang-9-mingw.json
(note this will change when we upgrade to clang-10 soonish)

The task defining this is
https://searchfox.org/mozilla-central/rev/0e09b9191c02097034e46b193930f91c45b7885d/taskcluster/ci/toolchain/clang.yml#74-96
(permalink to a specific revision to keep the line numbers happy)

In the fetch section you can see the names of the sources we fetch,
which are mapped to specific versions
https://searchfox.org/mozilla-central/rev/0e09b9191c02097034e46b193930f91c45b7885d/taskcluster/ci/fetch/toolchains.yml#363,377,412
(again, permalink)

The whole process is a bit tricky to follow.

-tom
Message has been deleted

oceanl

unread,
Jun 12, 2020, 4:27:45 PM6/12/20
to
On Friday, June 12, 2020 at 9:42:12 AM UTC-7, Tom Ritter wrote:
Hi Tom,
The updated toolchain and .mozconfig cleanup fixed the link issue.
Thank you for your help and the quick turn around.
And the links to how to build the toolchain.
0 new messages