Cross-compiling to Linux

The linker C:\UnrealToolchains\v16_clang-9.0.1-centos7\x86_64-unknown-linux-gnu\bin\ld.lld.exe
can’t read C:\UnrealToolchains\v16_clang-9.0.1-centos7\x86_64-unknown-linux-gnu\lib64\libstdc++.a

because the latter contains a compressed section but zlib is not available.

Does anyone know how to give ld.lld.exe access to zlib on Windows?

I’m trying to cross-compile a custom Unreal project with plug-ins to Linux.

I’m compiling and linking against clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04 in order to get libc++.a and libc++abi.a which are required by the plug-in.

I’m hitting an issue where libc++abi.a requires “atexit” (undefined symbol __cxa_thread_atexit_impl).

Adding libstdc++.a results in a linker error:

“ld.lld: error: C:\UnrealToolchains\v16_clang-9.0.1-centos7\x86_64-unknown-linux-gnu\lib64\libstdc++.a(locale_init.o): contains a compressed section, but zlib is not available”

It looks like this is a bug in the LLVM linker that was fixed in may 2020. It is in version 10, 11, and 12.

The Unreal cross-compilation toolchains probably don’t have it.

I don’t suppose there are any instructions for rebuilding the cross-compilation toolchains for Unreal? Or at least what flags to use with a git pull.

Know its been a while, had any luck with this?

My issue was specific to using a plugin (clang, on linux), got this error when trying to link the libs which were in ‘.a’.
I resolved it by using the ‘.lib’ files instead.

Sharing so that this might help someone in someway.