mstorsjo / llvm-mingw

An LLVM/Clang/LLD based mingw-w64 toolchain
Other
1.75k stars 176 forks source link

Missing LLVM header files in resulting zip when building with FULL_LLVM=1 #415

Closed trilader closed 3 months ago

trilader commented 3 months ago

(If I'm simply misunderstanding what FULL_LLVM=1 is supposed to do: What is the correct way to get what I made the scripts do with the stuff below:)

When building with FULL_LLVM=1 the resulting archive includes lib/libLLVM*.a, lib/libclang*.a, lib/liblldb*.a as well as the corresponding *.dll.a files.

What it doesn't include is the needed files in include, e.g. when building the Qt6 qttools submodule it wants to #include <llvm/ADT/StringRef.h> which isn't part of the archive as prepare-cross-toolchain.sh:55 nukes the include folder before copying the architecture one.

I had a look at the state of the container before prepare-cross-toolchain.sh gets run and saw that there would be no conflicts if we were to merge that folder with the architecture one.

So I commented out line 55 and adjusted line 64 to cp -a $SRC/generic-w64-mingw32/include/. $DEST/include, so it merges the architecture include folder into the regular one instead of replacing it.

With that you get a FULL_LLVM version that you where the extra parts are actually usable.

I'm not sure if that is actually the correct thing to do (I've only tested it with building a pure x86_64 compiler as I don't need the other architectures), but it gets me something that works for me.

mstorsjo commented 3 months ago

Thanks for looking into this! The suggested fix sounds correct to me, feel free to open a PR that does that. (FWIW I haven't tested FULL_LLVM builds much at all, in particular, 2-stage builds like these probably haven't been tested in that configuration.)