Problem in LLVM CMake modules

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem in LLVM CMake modules

Eli Gottlieb
Hi again,
     I'm trying to upgrade my LLVM bindings in Java from 2.9 to 3.1. To
do so, I regenerated the JNI bindings from fresh LLVM 3.1 headers, and
did a slight rewrite of my CMakeLists.txt file for building the C code.

     Problem is, cmake no longer finishes at all.  I receive the
following output, and then it just runs forever (while still responding
to a CTRL-C):

> eli@eli-netbook:~/Programs/jllvm/src/org/jllvm/bindings$ 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
> -- Found Java: /usr/lib/jvm/java-6-openjdk-amd64/bin/java (found
> version "1.6.0.24")
> -- Found JNI: /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/libjawt.so
Running CMake with --debug-output yields no additional information, and
running cmake with gdb attached just gives me a backtrace with no signs
of abnormal operation.

I've tried the old "comment stuff out and see what causes the symptom to
reappear" method of debugging, and it's definitely the
llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES all) line in my
CMakeLists.txt.  I've attached CMakeLists.txt for reference.

Could anyone perhaps tell me why CMake can't finish?

Cheers,
--Eli Gottlieb

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

CMakeLists.txt (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem in LLVM CMake modules

Óscar Fuentes
Eli Gottlieb <[hidden email]> writes:

>     I'm trying to upgrade my LLVM bindings in Java from 2.9 to 3.1. To
> do so, I regenerated the JNI bindings from fresh LLVM 3.1 headers, and
> did a slight rewrite of my CMakeLists.txt file for building the C
> code.
>
>     Problem is, cmake no longer finishes at all.  I receive the
> following output, and then it just runs forever (while still
> responding to a CTRL-C):

Yep, llvm_map_components_to_libraries gets confused by the existence of
both gtest and gtest_main and enters an infinite loop. A workaround is
to not pass "all" to llvm_map_components_to_libraries but a list of
required components.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem in LLVM CMake modules

Óscar Fuentes
Óscar Fuentes <[hidden email]> writes:

> Yep, llvm_map_components_to_libraries gets confused by the existence of
> both gtest and gtest_main and enters an infinite loop. A workaround is
> to not pass "all" to llvm_map_components_to_libraries but a list of
> required components.

This patch *seems* to fix the problem (cmake regexps are not thoroughly
documented):

--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -160,7 +160,7 @@ function(explicit_map_components_to_libraries out_libs)
     list(REVERSE expanded_components)
     list(APPEND processed ${lib})
     # Find the maximum index that doesn't have to be re-processed:
-    while(NOT "${expanded_components}" MATCHES "^${processed}.*" )
+    while(NOT "${expanded_components}" MATCHES "^${processed}(;)|(.*)")
       list(REMOVE_AT processed -1)
     endwhile()
     list(LENGTH processed cursor)


However, using "all" as the component to be linked is still broken, as
it passes to the linker -lLTO_static and -lprofile_rt-static, which are
non-existant libraries on a static build.

On the case of LTO_static the fix probably is

diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
index 9112976..60fc902 100644
--- a/tools/lto/CMakeLists.txt
+++ b/tools/lto/CMakeLists.txt
@@ -23,5 +23,4 @@ endif()
 
 if( NOT BUILD_SHARED_LIBS )
   add_llvm_library(${LTO_STATIC_TARGET_NAME} ${SOURCES})
-  set_property(TARGET ${LTO_STATIC_TARGET_NAME} PROPERTY OUTPUT_NAME "LTO")
 endif()



In the case of profile_rt-static, the fix probably is:

diff --git a/runtime/libprofile/CMakeLists.txt b/runtime/libprofile/CMakeLists.txt
index 414ad00..2794c4d 100644
--- a/runtime/libprofile/CMakeLists.txt
+++ b/runtime/libprofile/CMakeLists.txt
@@ -9,9 +9,6 @@ set(SOURCES
   )
 
 add_llvm_library( profile_rt-static ${SOURCES} )
-set_target_properties( profile_rt-static
-  PROPERTIES
-  OUTPUT_NAME "profile_rt" )
 
 add_llvm_loadable_module( profile_rt-shared ${SOURCES} )
 set_target_properties( profile_rt-shared



And do we really want gtest, gtest_main and maybe other internal
libraries to be listed when the user requires "all" LLVM components?

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem in LLVM CMake modules

Óscar Fuentes
Óscar Fuentes <[hidden email]> writes:

> This patch *seems* to fix the problem (cmake regexps are not thoroughly
> documented):
>
> --- a/cmake/modules/LLVM-Config.cmake
> +++ b/cmake/modules/LLVM-Config.cmake
> @@ -160,7 +160,7 @@ function(explicit_map_components_to_libraries out_libs)
>      list(REVERSE expanded_components)
>      list(APPEND processed ${lib})
>      # Find the maximum index that doesn't have to be re-processed:
> -    while(NOT "${expanded_components}" MATCHES "^${processed}.*" )
> +    while(NOT "${expanded_components}" MATCHES "^${processed}(;)|(.*)")
>        list(REMOVE_AT processed -1)
>      endwhile()
>      list(LENGTH processed cursor)

The patch above doesn't make any sense. This looks more correct:

--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -160,7 +160,7 @@ function(explicit_map_components_to_libraries out_libs)
     list(REVERSE expanded_components)
     list(APPEND processed ${lib})
     # Find the maximum index that doesn't have to be re-processed:
-    while(NOT "${expanded_components}" MATCHES "^${processed}.*" )
+    while(NOT "${expanded_components}" MATCHES "^${processed};|$")
       list(REMOVE_AT processed -1)
     endwhile()
     list(LENGTH processed cursor)

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev