On Tue, Oct 9, 2012 at 9:25 PM, Jun Koi <junkoi2004 at gmail.com>
wrote:> On Fri, Oct 5, 2012 at 3:45 PM, Jun Koi <junkoi2004 at gmail.com>
wrote:
>> On Fri, Oct 5, 2012 at 3:39 PM, David Chisnall
>> <David.Chisnall at cl.cam.ac.uk> wrote:
>>> On 5 Oct 2012, at 08:34, Jun Koi wrote:
>>>
>>>> any idea on how to fix the problem?
>>>
>>> The correct solution is to fix the LLVM build to install the .cmake
files in a location that CMake knows about.
>>
>> could you please elaborate?
>>
>>> The hacky solution that I've used is just to copy them into
the correct place manually.
>>
>> could you please elaborate? what do i need to copy, and where?
>>
>> if that matters, i compiled and installed llvm 3.1 from source in
normal way:
>>
>> ./configure; make; make install
>
> any help on this sample LLVM pass, please?
any help, please? i am still stuck on this problem.
i fixed CMakeLists.txt in the root directory to be like below:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
# A convenience variable:
set(LLVM_ROOT "/usr" CACHE /usr/ "Root of LLVM install.")
# A bit of a sanity check:
if( NOT EXISTS ${LLVM_ROOT}/include/llvm )
message(FATAL_ERROR "LLVM_ROOT (${LLVM_ROOT}) is not a valid LLVM
install")
endif()
# We incorporate the CMake features provided by LLVM:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${LLVM_ROOT}/share/llvm/cmake")
#include(LLVMConfig)
# Now set the header and library paths:
include_directories( ${LLVM_INCLUDE_DIRS} )
link_directories( ${LLVM_LIBRARY_DIRS} )
add_definitions( ${LLVM_DEFINITIONS} )
# Let's suppose we want to build a JIT compiler with support for
# binary code (no interpreter):
# llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native)
# Finally, we link the LLVM libraries to our executable:
target_link_libraries(myHello ${REQ_LLVM_LIBRARIES})
add_subdirectory(Hello)
#####
and the content of Hello/CMakeLists.txt is like below:
$ cat Hello/CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_llvm_loadable_module(LLVMHello
Hello.cpp
)
####
now i compiled again, but there is still one error:
$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at Hello/CMakeLists.txt:3 (add_llvm_loadable_module):
Unknown CMake command "add_llvm_loadable_module".
-- Configuring incomplete, errors occurred!
#####
so CMake doesnt understand "add_llvm_loadable_module". how to fix
this?
thanks,
Jun