LLVM from source assembly: loadable modules not supported (on Linux)

I compiled and installed LLVM from trunk on debian wheezy a few weeks ago (configure and build) and now tried from the llvm-mutate pass source compilation. AFAICC, llvm-mutate follows cmake from the source code build instructions .

When trying to create llvm-mutate

mkdir build cd build cmake -DCMAKE_MODULE_PATH=/usr/local/share/llvm/cmake ../ 

I get:

- Mutate is ignored - loadable modules are not supported on this platform.

hmm? opt and loadable passages (on llvm_trunk / build / Debug + Asserts / lib / xxx.so) are present and working (they were compiled using configure and make, not cmake).

So, does this problem seem to be related to cmake? Someone else has encountered issues such as in Win when using cygwin: here

Any idea? Thanks Alex

+6
source share
3 answers

AddLLVM The cmake module needs some prerequisites. Add to CMakeLists.txt:

 # AddLLVM needs these set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib) include(HandleLLVMOptions) # important: matches compiler flags to LLVM/Clang build include(AddLLVM) 

Some inspiration came from this post .

+2
source

Adding to alexei answer

also add list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") to the CMakeLists.txt file before the include(AddLLVM) line include(AddLLVM) , and then

In your PATH LLVM binary directory for llvm-config , invoke cmake with

 CXX=clang++ cmake -DLLVM_DIR=$(llvm-config --prefix)/share/llvm/cmake .. 
+1
source

Just for the sake of completeness, if someone encounters this error. However, this bug is fixed in LLVM 3.8.0, so you need to enable AddLLVM to create the plugin. The HandleLLVMOption include file is only useful for getting the correct compiler flags, as indicated in the post above.

+1
source

Source: https://habr.com/ru/post/980770/


All Articles