[cfe-dev] Clang plugin help
John Brawn via cfe-dev
cfe-dev at lists.llvm.org
Fri Jul 19 09:03:40 PDT 2019
What's happening here is that the PE/COFF file format used by windows has a maximum of (2^16)-1 entries in the
export table, but the clang executable contains way more than that many symbols. The export_symbols.py script,
which is run automatically when you use -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, is supposed to handle
this by using some heuristics to exclude symbols that wouldn't be able to be imported anyway, but it looks like
it isn't working correctly here for some reason.
Unfortunately I currently don't have any spare time to help you with this. Building a release build, if you're currently
doing a debug build, may help as the debug build has far more symbols.
John
From: Callum Laird [mailto:callum-laird98 at hotmail.co.uk]
Sent: 18 July 2019 11:44
To: John Brawn
Subject: Re: Clang plugin help
Hi John,
Thanks very much for your help. I tried using your method, but I'm having some difficulties. After a long time, the build (LLVM.sln) eventually failed, with the following error messages:
errors:
Severity Code Description Project File Line Suppression State
Error LNK1189 library limit of 65535 objects exceeded clang C:\Users\longspatula\llvm-project\build\tools\clang\tools\driver\LINK 1
Error LNK1104 cannot open file '..\..\..\..\Debug\lib\clang.lib' AnnotateFunctions C:\Users\longspatula\llvm-project\build\tools\clang\examples\AnnotateFunctions\LINK 1
Error LNK1104 cannot open file '..\..\..\..\Debug\lib\clang.lib' PrintFunctionNames C:\Users\longspatula\llvm-project\build\tools\clang\examples\PrintFunctionNames\LINK 1
Error MSB6006 "link.exe" exited with code 1104. PrintFunctionNames C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 725
Error LNK1189 library limit of 65535 objects exceeded clang-interpreter C:\Users\longspatula\llvm-project\build\tools\clang\examples\clang-interpreter\LINK 1
If it's an issue with the size of the build, is there a good way to build only some of the libraries? I am only after those related to clang plugins.
Thanks again for your help,
Callum
________________________________
From: John Brawn <John.Brawn at arm.com>
Sent: 17 July 2019 12:28
To: Callum Laird
Cc: cfe-dev at lists.llvm.org; nd
Subject: RE: Clang plugin help
If you're using cmake and Visual Studios on Windows, then you need to:
* Add -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON to the cmake command. Due to
the way dynamic linking works on Windows the symbols that the plugin needs have to
be explicitly exported from clang, and this isn't done by default. (Using
-DBUILD_SHARED_LIBS=ON would be a better solution, but last I checked it didn't
work with Visual Studio.)
* For the example plugins to build you need to make sure you run cmake with
-DCLANG_BUILD_EXAMPLES=ON, as it's off by default.
With that the example plugins should build as part of the default target when running
make. If you see in the cmake output the message "Loadable modules not supported on
this platform" then that means that something has caused plugins to be disabled.
John
From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Callum Laird via cfe-dev
Sent: 16 July 2019 09:26
To: cfe-dev at lists.llvm.org
Subject: [cfe-dev] Clang plugin help
Hi all,
I've been trying to get a Clang plugin working for a couple of weeks now on Windows/Visual Studio 2019, and I'm struggling quite a lot. So far, I've followed the instructions on the clang/llvm getting started page, and I've got the Clang complier working for C code in visual studio. I then tried to build one of the example plugins provided (such as PrintFunctionNames) using cmake and later make, but I'm having trouble knowing which file I'm supposed to use and I can't find much in the way of resources/documentation online for windows stuff. Any and all help would be appreciated.
Thanks!
Callum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190719/986ffd8a/attachment.html>
More information about the cfe-dev
mailing list