-
Notifications
You must be signed in to change notification settings - Fork 418
Description
Hello, i build LLVM on windows under Visual Studio 2019 with the config like this:
cmake -S llvm\llvm -B build -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=On -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 -Thost=x64
C:\passes\december\HelloWorld>llvm-config --version
14.0.0git
now i download this tutor and want to compile it, i do:
C:\passes\december\HelloWorld>cmake -Bbuild -DLT_LLVM_INSTALL_DIR="C:\Program Files (x86)\LLVM"
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30137.0
-- The CXX compiler identification is MSVC 19.29.30137.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "opt" configuration "Debug".
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "opt" configuration "Release".
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "opt" configuration
"MinSizeRel".
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "opt" configuration
"RelWithDebInfo".
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
As you can see it produces weird result, i looked solution in this repository and found one suggestion to change CMakeLists.txt
:
add_llvm_library( HelloWorld SHARED BUILDTREE_ONLY
HelloWorld.cpp
DEPENDS
intrinsics_gen
PLUGIN_TOOL
opt
)
Changed MODULE
to SHARED
works it produced build files
cd build
cmake --build . --config Release --target ALL_BUILD
this produced HelloWorld.dll
.
Now i want to use this and do:
opt -load-pass-plugin="C:\passes\december\HelloWorld\build\Release\HelloWorld.dll" -passes="hello-world" -disable-output Source.bc
And get output
C:\passes\hello>opt -load-pass-plugin="C:\passes\december\HelloWorld\build\Release\HelloWorld.dll" -passes="hello-world" -disable-output Source.bc
Failed to load passes from 'C:\passes\december\HelloWorld\build\Release\HelloWorld.dll'. Request ignored.
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
Plugin entry point not found in 'C:\passes\december\HelloWorld\build\Release\HelloWorld.dll'. Is this a legacy plugin?PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt -load-pass-plugin=C:\\passes\\december\\HelloWorld\\build\\Release\\HelloWorld.dll -passes=hello-world -disable-output Source.bc
#0 0x00007ff71ae82935 C:\Program Files (x86)\LLVM\bin\opt.exe 0x1442935 (C:\Program Files (x86)\LLVM\bin\opt.exe+0x1442935)
#1 0x00007ff71ae82935
#2 0x00007ff71ae82935 (C:\Program Files (x86)\LLVM\bin\opt.exe+0x1442935)
#3 0x00007ff884fc1881 C:\Program Files (x86)\LLVM\bin\opt.exe 0x78b21 C:\Program Files (x86)\LLVM\bin\opt.exe 0x7dd5c
#4 0x00007ff884fc1881 C:\Program Files (x86)\LLVM\bin\opt.exe 0x8a7f0 C:\Program Files (x86)\LLVM\bin\opt.exe 0x1e0a600
#5 0x00007ff884fc1881 (C:\Windows\System32\ucrtbase.dll+0x71881)
#6 0x00007ff884fc2851 (C:\Windows\System32\ucrtbase.dll+0x72851)
0x00007FF71AE82935 (0x00007974991A16CF 0x0000000000000076 0x0000000000000016 0x00007FF71AE82930), HandleAbort() + 0x5 bytes(s)
0x00007FF884FC1881 (0x000001C9DC584301 0x0000000000000000 0x0000000000000000 0x000000500C58CEC0), raise() + 0x1E1 bytes(s)
0x00007FF884FC2851 (0x0000005000000003 0x0000005000000003 0x0000000000000000 0x000001C9DC5A2DB0), abort() + 0x31 bytes(s)
0x00007FF719AB8B21 (0x000001C9DC5A2DB0 0x000000500C58CFF0 0x0000000000000000 0x000001C9DC5A2DB0), ?erase@?$SmallPtrSetImpl@PEAVLiveInterval@llvm@@@llvm@@QEAA_NPEAVLiveInterval@2@@Z() + 0x111 bytes(s)
0x00007FF719ABDD5C (0x0000000000000000 0x0000000000000000 0x000000500C58E920 0x0000000000000000), ?run@?$AnalysisPassModel@VFunction@llvm@@VAAManager@2@VPreservedAnalyses@2@VInvalidator@?$AnalysisManager@VFunction@llvm@@$$V@2@$$V@detail@llvm@@UEAA?AV?$unique_ptr@U?$AnalysisResultConcept@VFunction@llvm@@VPreservedAnalyses@2@VInvalidator@?$AnalysisManager@VFunction@llvm@@$$V@2@@detail@llvm@@U?$default_delete@U?$AnalysisResultConcept@VFunction@llvm@@VPreservedAnalyses@2@VInvalidator@?$AnalysisManager@VFunction@llvm@@$$V@2@@detail@llvm@@@std@@@std@@AEAVFunction@3@AEAV?$Analys() + 0x28FC bytes(s)
0x00007FF719ACA7F0 (0x0000000000000000 0x0000000000000000 0x000001C9DC554DA0 0x0000000000000000), ?assign@?$SmallVectorImpl@PEBVValue@llvm@@@llvm@@QEAAX_KPEBVValue@2@@Z() + 0x4780 bytes(s)
0x00007FF71B84A600 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), ?identify_magic@llvm@@YA?AVerror_code@std@@AEBVTwine@1@AEAUfile_magic@1@@Z() + 0x1360 bytes(s)
0x00007FF887597034 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FF887882651 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
I checked HelloWord.dll and main entry point is DllEntryPoint
i assume i need llvmGetPassPluginInfo
as exported function?? How do you get this to work