[Beignet] [PATCH v2] cmake: Fix linking with LLVM/Terminfo

Igor Gnatenko i.gnatenko.brain at gmail.com
Sun Feb 16 21:06:10 CET 2014


On Sat, 2014-02-15 at 14:40 +0800, Boqun Feng wrote: 
> About this fix, in some distros, there is only libncurses.so 
> as a single terminfo library. In such a distro, `-ltinfo' may
> introduce a linkage error. It's better to use the find_library
> function to decide which one to be used, as follow:
> 
> 
> if (LLVM_VERSION_NODOT VERSION_EQUAL 34) 
> -  target_link_libraries(gbe tinfo)
> +  find_library(TERMINFO NAMES tinfo ncurses)
> +  if (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
> +    message(FATAL_ERROR "no libtinfo or libncurses is found in
> system")
> +  else (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
> +    target_link_libraries(gbe ${TERMINFO})
> +    message(STATUS "use ${TERMINFO} as terminal control library")
> +  endif (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
>  endif(LLVM_VERSION_NODOT VERSION_EQUAL 34) 
Could you prepare new patch ?
> 
> 
> 
> 
> 
> 
> 
> On Thu, Feb 13, 2014 at 3:16 PM, Igor Gnatenko
> <i.gnatenko.brain at gmail.com> wrote:
>         DEBUG: [  9%] Building CXX object
>         backend/src/CMakeFiles/gbe_bin_generater.dir/gbe_bin_generater.cpp.o
>         DEBUG: Linking CXX executable gbe_bin_generater
>         DEBUG: /usr/lib64/llvm/libLLVMSupport.a(Process.o): In
>         function `llvm::sys::Process::FileDescriptorHasColors(int)':
>         DEBUG: (.text+0x717): undefined reference to `setupterm'
>         DEBUG: /usr/lib64/llvm/libLLVMSupport.a(Process.o): In
>         function `llvm::sys::Process::FileDescriptorHasColors(int)':
>         DEBUG: (.text+0x727): undefined reference to `tigetnum'
>         DEBUG: /usr/lib64/llvm/libLLVMSupport.a(Process.o): In
>         function `llvm::sys::Process::FileDescriptorHasColors(int)':
>         DEBUG: (.text+0x730): undefined reference to `set_curterm'
>         DEBUG: /usr/lib64/llvm/libLLVMSupport.a(Process.o): In
>         function `llvm::sys::Process::FileDescriptorHasColors(int)':
>         DEBUG: (.text+0x738): undefined reference to `del_curterm'
>         
>         Signed-off-by: Igor Gnatenko <i.gnatenko.brain at gmail.com>
>         ---
>          backend/src/CMakeLists.txt | 4 ++++
>          1 file changed, 4 insertions(+)
>         
>         diff --git a/backend/src/CMakeLists.txt
>         b/backend/src/CMakeLists.txt
>         index 33494a0..6db4a2a 100644
>         --- a/backend/src/CMakeLists.txt
>         +++ b/backend/src/CMakeLists.txt
>         @@ -188,6 +188,10 @@ target_link_libraries(
>                                ${CMAKE_THREAD_LIBS_INIT}
>                                ${CMAKE_DL_LIBS})
>         
>         +if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
>         +  target_link_libraries(gbe tinfo)
>         +endif(LLVM_VERSION_NODOT VERSION_EQUAL 34)
>         +
>          link_directories (${LLVM_LIBRARY_DIR})
>          ADD_EXECUTABLE(gbe_bin_generater gbe_bin_generater.cpp)
>          TARGET_LINK_LIBRARIES(gbe_bin_generater gbe)
>         --
>         1.8.5.3
>         
>         _______________________________________________
>         Beignet mailing list
>         Beignet at lists.freedesktop.org
>         http://lists.freedesktop.org/mailman/listinfo/beignet 
> 
> 


-- 
-Igor Gnatenko



More information about the Beignet mailing list