JFX wrote: Fri Mar 03, 2023 2:21 pm
Hmm, I have no clue why this error disappeared, but it compiles fine now.
A quick test in QEMU did also gone well. Will test in next week on real ARM64 hardware.
Finally, I figured out why sometimes wimlib-imagex.exe is built or not built in cross-compiling.
We now have an official Windows ARM64 wimlib build, but documenting this issue would help other developers.
Workaround 1
When you have a functional toolchain in the MSYS2 shell, append the dummy --libdir argument to configure.
When invoking wimlib configure, append --libdir="${SRCDIR}". Any empty directory would do the same.
Code: Select all
$ cd /c/build/wimlib.1.14.3
$ ./configure --libdir=/c/build/wimlib-1.14.3 --host=aarch64-w64-mingw32 --disable-static
Workaround 2
Use an MSYS2 shell that does not have any functional toolchain.
I guess this is the reason why wimlib 1.14.x's official Windows arm64 build works.
Cause
The main culprit was libtool, which was appending a system library path (e.g. -LC:/msys64/ucrt64/lib) which it must not do.
This argument came from libtool libdir value, which denotes the path where .dll/.a/.la files would be located when installed.
That caused x64 libmsvcrt.a, libmingw32.a from the native toolchain to be linked to arm64 wimlib-imagex.exe, sabotaging the link process.
In Linux, the path to find libraries is hard-coded to binary itself. That is why libtool appends --libdir path.
But Windows does not have such 'fixed rpath' notation. Also, we do not 'make install' the wimlib in our case. We collect the .dll and .exe ourselves.
So libdir value is not that necessary. We can safely neutralize that value.
Reference
- Huge thanks to llvm-mingw devs who helped to debug this issue :
https://github.com/mstorsjo/llvm-mingw/ ... 1707621414
- My own size-optimized wimlib build script :
https://github.com/ied206/ManagedWimLib ... v1.14.x.sh
* It produces libwim-15.dll and statically built wimlib-imagex.exe.
* If libwim-15.dll is not built with a libtool error message, install a native MSYS2 toolchain and retry.