Rob Jansen
2015-Jan-22 00:04 UTC
[LLVMdev] LLVM out of source pass build: Loadable modules not supported
I am [also] having problems when trying to build an out-of-source loadable module on Fedora 21: -- LLVMHoistGlobals ignored -- Loadable modules not supported on this platform. Thinking it was a packaging issue, I tried downloading/building/installing both 3.5.0 and 3.5.1 from source, but to no avail. (Using 3.5.0 from the package archives on an Ubuntu 11.10 VM also had problems.) The 3.4 packages in Fedora 20 work great. What changed between 3.4 and 3.5 that would have caused loadable modules to fail? There is a similar problem posted on stackoverflow: http://stackoverflow.com/questions/27863706/llvm-out-of-source-pass-build-loadable-modules-not-supported-on-linux -Rob Message: 5> Date: Tue, 13 Jan 2015 08:03:25 +0100 > From: Alexander Poddey <alexander.poddey at gmx.net> > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] LLVM out of source pass build: Loadable modules not > supported (on Linux) > Message-ID: <m92fiv$6ad$1 at ger.gmane.org> > Content-Type: text/plain; charset="ISO-8859-1" > > Hi all, > > I compiled and installed LLVM from trunk on debian wheezy some weeks ago > (configure & make) and now tried to out of source compile an opt pass > following the cmake out of source pass build instructions from the docu. > > When trying to build (cMakeLists appended below) > > mkdir build > cd build > cmake -DCMAKE_MODULE_PATH=/usr/local/share/llvm/cmake ../ > > I get: > > -- MyOutOfSourcePass ignored -- Loadable modules not supported on this > platform. > > hmm? opt and the loadable passes (at > llvm_trunk/build/Debug+Asserts/lib/xxx.so) are present and work (have been > compiled using configure & make, not cmake). > > > Any idea? Thx Alex > > > P.S.: > My questions are user questions and it seems to me the dev list is not > appropriate. Please point me to the correct place if you feel the same and > know where to discuss llvm user questions! Thx! > > > > > ===================================> APPENDIX > ===================================> > > Dir structure: > project > | MypassDir > > > project-dir's CMakeLists.txt: > ===================================> > # following http://llvm.org/docs/CMake.html and llvm-mutate's cmake files > cmake_minimum_required(VERSION 2.8) > > set(CMAKE_C_FLAGS "-fPIC") #position independent code genration > set(CMAKE_CXX_FLAGS "-fPIC -Wno-c++11-extensions") > > find_package(LLVM REQUIRED CONFIG) > > # to be able to merge into LLVM source tree later on > list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") > include(AddLLVM) > > > add_definitions(${LLVM_DEFINITIONS}) > include_directories(${LLVM_INCLUDE_DIRS}) > link_directories(${LLVM_LIBRARY_DIRS}) #not present in llvm example > > add_subdirectory(MypassDir) > > > > > Mypass dir's CMakeLists.txt: > ===================================> add_llvm_loadable_module(MyPass > MyPass.cpp > ) > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150121/cdc0751b/attachment.html>
Rob Jansen
2015-Jan-22 21:49 UTC
[LLVMdev] LLVM out of source pass build: Loadable modules not supported
OK, some progress with LLVM/Clang 3.5.1 built from source, as well as LLVM/Clang 3.5.0 installed from the Fedora 21 repositories. So to get around the “Modules not supported” error, I believe one must now use the following before including the AddLLVM.cmake file: set(LLVM_ENABLE_PLUGINS ON) include(AddLLVM) Enabling the plugins like this revealed some fragile code (i.e. bugs) inside of share/llvm/cmake/AddLLVM.cmake. The first error was: CMake Error at /home/rob/.shadow/share/llvm/cmake/AddLLVM.cmake:282 (set_output_directory): set_output_directory Function invoked with incorrect arguments for function named: set_output_directory Call Stack (most recent call first): /home/rob/.shadow/share/llvm/cmake/AddLLVM.cmake:400 (llvm_add_library) src/hoist/CMakeLists.txt:30 (add_llvm_loadable_module) Which I worked around by setting this in my CMakeLists.txt file: set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib) The second error was: CMake Error at /home/rob/.shadow/share/llvm/cmake/AddLLVM.cmake:294 (set_target_properties): set_target_properties called with incorrect number of arguments. Call Stack (most recent call first): /home/rob/.shadow/share/llvm/cmake/AddLLVM.cmake:402 (llvm_add_library) src/hoist/CMakeLists.txt:32 (add_llvm_loadable_module) The problem is in this function call: set_target_properties(${name} PROPERTIES PREFIX "" SUFFIX ${LLVM_PLUGIN_EXT} ) because when ${LLVM_PLUGIN_EXT} is empty, the SUFFIX property has no associated value. I worked around it by setting some arbitrary value: set(LLVM_PLUGIN_EXT “so”) Are these considered bugs? I hope this helps someone else. Rob On Wed, Jan 21, 2015 at 7:04 PM, Rob Jansen <jansen at cs.umn.edu> wrote:> I am [also] having problems when trying to build an out-of-source loadable > module on Fedora 21: > > -- LLVMHoistGlobals ignored -- Loadable modules not supported on this > platform. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150122/b4ee0be7/attachment.html>