Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build HelloWorld on windows (llvm 12.0.1) #42

Open
kiwings opened this issue Jul 20, 2021 · 5 comments
Open

can't build HelloWorld on windows (llvm 12.0.1) #42

kiwings opened this issue Jul 20, 2021 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@kiwings
Copy link

kiwings commented Jul 20, 2021

when I try to build HelloWorld project with VS2019, I got LINK error( my cmake command is: cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 ../):
image

if I modify add_llvm_library MODULE to SHARED, VS2019 can successfully compile the HelloWolrd
image2

but got the following warning:
image3

and then opt.exe failed to load passes
image4

In addition, the cmake invocation for llvm is:
cmake -DLLVM_ENABLE_PROJECTS="clang;lld;libcxx;llvm" -DLLVM_EXPORT_SYMOBLS_FOR_PLUGINS=On -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\

@banach-space
Copy link
Owner

Hi, thanks for visiting and creating this issue!

I don't have access to a Windows machine, so I won't be too helpful. But this error message is pretty clear, so I would just replace SHARED with MODULE. See:

I hope that this will solve your problem! But please keep in mind that the support for plugins on Windows is a rather grey area.

-Andrzej

@kiwings
Copy link
Author

kiwings commented Jul 22, 2021

thanks for your reply, Finally solved this problem by modifying the hellowolrd code.
It seems that the demo does not conform to llvm12.0.1.

but I can't can't directly using -load-pass-plugin ./HelloWorld.dll -passes=hello to load HelloWolrd.dll, I need to copy the HelloWorld.dll to the LLVM_DIR\bin, and then use command LLVM_DIR\bin\opt.exe -load=HelloWolrd.dll -hello -disable-output input_for_hello.dll

image

@banach-space
Copy link
Owner

What modifications did you have to make?

@kiwings
Copy link
Author

kiwings commented Jul 23, 2021

I just deleted the code about New pass manager .
After trying again, it was not a code compatibility problem, The problem is that New pass manager has no way to compile to a dll on windows(Maybe I haven't found the right way).

@banach-space
Copy link
Owner

Thanks for sharing. I suspect that the required symbols are not exported.

So are you using the legacy pass manager and everything works fine for you on Windows?

@banach-space banach-space added the help wanted Extra attention is needed label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants