-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Description
Status quo: We are able to build Enzyme on macos and linux in CI, and libload (dlopen) it into rustc.
@kiranshila tried to help me with getting Windows (MinGW) builds up. MSVC ins't supported due to some black magic in Enzyme.
On Linux, we have rustc linking dynamically against LLVM, so libEnzyme also dynamically links against it.
On Apple, we use static linking, so at first libEnzyme also tried to statically link LLVM, and we ended up with two LLVM copies, which causes bugs. We solved this via cmake flags, telling libEnzyme to look for llvm symbols only at dlopen time. This way libEnzyme reuses the LLVM symbols from rustc.
On MinGW, we also use static linking, and due to the limited number of public symbols per library, we can't really change that from my understanding. Unlike Macos, we can not tell the linker to resolve LLVM symbols at dlopen time (the flags used for MacOS aren't recognized), but we also can't ship a second LLVM copy. So, from our limited understanding of linkers, there isn't really a way around statically linking Enzyme into rustc and just always distributing it?
I got permission from the infra team to do that a while ago, even though it is not the preferred solution. We also had static linking of rustc and enzyme work in the past, so it should be doable to get it to work again. I just hate that we have 3 different approaches on 3 systems, but I guess that's just the way it is.
@bjorn3 does that sound sensible to you, or do you see a better solution for mingw?
fyi @Kobzol
I don't necessarily intend to block nightly release on MinGW, but since we're waiting on #150992 anyway, I thought it would be nice to try to get Windows in as well.
Summary
Command used
https://rustc-dev-guide.rust-lang.org/autodiff/installation.html#build-instructions
Expected behaviour
Actual behaviour
A variety of errors based on the concrete setup. When trying to copy the MacOS solution, Kiran ended up with:
undefined reference to `llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)'****Bootstrap configuration (bootstrap.toml)
<config>Operating system
HEAD
Additional context
Build Log
<log>