Compilation using Visual Studio 2022 #970
-
Did anybody successfully built clad on Windows? I'm failing to do so, since a couple of days now. I'm using LLVM 18.1.0, which I also built form source. When I do not add LLVM_ENABLE_PLUGINS and LLVM_EXPORT_SYMBOLS_FOR_PLUGINS for the LLVM compilation and compile clad with STATI, then compilation succeeds. However, I cannot execute any program without getting the console output "clad failed to place the generated derivative in the object. Make sure calls to clad are within a #pragma clad ON region." So I thought the reason is that I need to "attach" the clad plugin to the clang compiler. But currently no DLL is generated. I only got a "cladPlugin.lib" and "cladDifferentiator.lib". So, I guess I need to add LLVM_ENABLE_PLUGINS and LLVM_EXPORT_SYMBOLS_FOR_PLUGINS. However, 2 projects fail then (due to DLL symbol export limit of 65535). Is there any instruction how to use clad on Windows? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 24 replies
-
Hi @de-sholl, Clang plugins are not supported on Windows, yet. @fsfod is actively working on this you can take a look at his recent work in llvm/llvm-project#96630. I hope in llvm 19 he succeeds to make LLVM_ENABLE_PLUGINS work for Windows. That being said, Clad works on Windows in the ROOT project. The trick is to build clang and statically link |
Beta Was this translation helpful? Give feedback.
It finally works! I had to add
/WHOLEARCHIVE:cladPlugin.lib /WHOLEARCHIVE:cladDifferentiator.lib
to Linker -> Command Line -> Additional Options in the clang.sln. Now compilation and also execution of the BasicUsage examples works without an error.Thank you very much for your help along!