r222393 - [CMake] Always include the Clang repo version, just like the autoconf build.

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Nov 24 17:43:08 PST 2014


So, how exactly does this work on Windows?  lib/Basic/CMakeLists.txt now regenerates SVNVersion.inc with GetSVN.cmake, which runs GetSourceVersion and GetRepositoryPath, which are Unix-y shell scripts.  I end up with empty strings for the revision and repository info.
Thanks,
--paulr

From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Zachary Turner
Sent: Thursday, November 20, 2014 5:09 PM
To: Jordan Rose
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: r222393 - [CMake] Always include the Clang repo version, just like the autoconf build.

Somehow a garbage value ended up in my .git/config, but only for clang.  It somehow added

          fetch = :refs/remotes/git-svn

to my svn remote config.  Deleting that seems to have resolved the problem.

On Thu, Nov 20, 2014 at 5:03 PM, Jordan Rose <jordan_rose at apple.com<mailto:jordan_rose at apple.com>> wrote:
This sounds like what happens when you run git svn but don't actually have any svn remotes. Do you have a git folder without svn remotes? Do you still have a .git/svn?

Jordan


On Nov 20, 2014, at 16:41, Zachary Turner <zturner at google.com<mailto:zturner at google.com>> wrote:

When I bulid on Ubuntu right now, ninja deadlocks while building clang.

I'm on Ubuntu 14.04 and I'm generating CMake as follows:

cmake -G Ninja -DCMAKE_CXX_COMPILER=clang -DCMAKE_C_COMPILER=clang -DCMAKE_SHARED_LINKER_FLAGS="-lstdc++ -lm" -DCMAKE_EXE_LINKER_FLAGS="-lstdc++ -lm" -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/../../install -DCMAKE_BUILD_TYPE=Debug -Wno-dev ../..

When I run ninja with -v, it gets to Linking libClangStaticAnalyzerFrontend.a, and then it just hangs.

If I Ctrl+C and then re-run ninja with -v, I see the following:

[1/51] cd ~/ssd/src/llvm/build/ninja/tools/clang/lib/Basic && /usr/bin/cmake -DFIRST_SOURCE_DIR=~/ssd/src/llvm -DFIRST_NAME=LLVM -DSECOND_SOURCE_DIR=~/ssd/src/llvm/tools/clang -DSECOND_NAME=SVN -DHEADER_FILE=~/src/llvm/build/ninja/tools/clang/lib/Basic/SVNVersion.inc -P ~/ssd/src/llvm/cmake/modules/GetSVN.cmake

ps aux | grep cmake shows the following:

zturner  28671  0.0  0.0  24448  1212 pts/2    S    16:38   0:00 /bin/sh -c cd ~/src/llvm/build/ninja/tools/clang/lib/Basic && /usr/bin/cmake -DFIRST_SOURCE_DIR=~/ssd/src/llvm -DFIRST_NAME=LLVM -DSECOND_SOURCE_DIR=~/ssd/src/llvm/tools/clang -DSECOND_NAME=SVN -DHEADER_FILE=~/ssd/src/llvm/build/ninja/tools/clang/lib/Basic/SVNVersion.inc -P ~/ssd/src/llvm/cmake/modules/GetSVN.cmake

zturner  28673  0.5  0.0 115752  5828 pts/2    S    16:38   0:00 /usr/bin/cmake -DFIRST_SOURCE_DIR=~/ssd/src/llvm -DFIRST_NAME=LLVM -DSECOND_SOURCE_DIR=~/ssd/src/llvm/tools/clang -DSECOND_NAME=SVN -DHEADER_FILE=~/ssd/src/llvm/build/ninja/tools/clang/lib/Basic/SVNVersion.inc -P ~/ssd/src/llvm/cmake/modules/GetSVN.cmake

Let me know if you need more information or if you have any suggestions.


On Wed, Nov 19, 2014 at 5:28 PM, Jordan Rose <jordan_rose at apple.com<mailto:jordan_rose at apple.com>> wrote:
Yup, just found that described online. .svn/entries seems to be the 1.6 version, .svn/wc.db the 1.7 one. As long as wc.db shows up first in the search, we should be good.

Jordan


On Nov 19, 2014, at 17:27, Nico Weber <thakis at chromium.org<mailto:thakis at chromium.org>> wrote:

.svn/wc.db seems to get updated on each `svn up` though. This is with "svn, version 1.7.17 (r1591372)" (which I think is the svn bundled with Xcode 6.1).

On Wed, Nov 19, 2014 at 5:25 PM, Jordan Rose <jordan_rose at apple.com<mailto:jordan_rose at apple.com>> wrote:
Shoot! And you actually got new revisions? Okay, will poke at this some more tonight.

Jordan


On Nov 19, 2014, at 17:24, Nico Weber <thakis at chromium.org<mailto:thakis at chromium.org>> wrote:

Nice!

But .svn/entries doesn't seem to be touched when I `svn up` my llvm checkout.

On Wed, Nov 19, 2014 at 2:03 PM, Jordan Rose <jordan_rose at apple.com<mailto:jordan_rose at apple.com>> wrote:
Author: jrose
Date: Wed Nov 19 16:03:48 2014
New Revision: 222393

URL: http://llvm.org/viewvc/llvm-project?rev=222393&view=rev
Log:
[CMake] Always include the Clang repo version, just like the autoconf build.

Now that LLVM's helper script GetSVN.cmake actually works consistently,
there's no reason not to use it. We avoid having to regenerate SVNVersion.inc
every time by marking it as dependent on Git's reflog or SVN's entries file.

This should end most of the issues of the AST format changing and breaking
old module files: CMake-Clang should now detect that the version changed just
like Autoconf-Clang has.

Based on r190557. Depends on LLVM r222391.

Modified:
    cfe/trunk/lib/Basic/CMakeLists.txt

Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=222393&r1=222392&r2=222393&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Wed Nov 19 16:03:48 2014
@@ -4,6 +4,48 @@ set(LLVM_LINK_COMPONENTS
   Support
   )

+# Figure out if we can track VC revisions.
+function(find_first_existing_file out_var)
+  foreach(file ${ARGN})
+    if(EXISTS "${file}")
+      set(${out_var} "${file}" PARENT_SCOPE)
+      return()
+    endif()
+  endforeach()
+endfunction()
+
+find_first_existing_file(llvm_vc
+  "${LLVM_MAIN_SRC_DIR}/.git/logs/HEAD"
+  "${LLVM_MAIN_SRC_DIR}/.svn/entries")
+find_first_existing_file(clang_vc
+  "${CLANG_SOURCE_DIR}/.git/logs/HEAD"
+  "${CLANG_SOURCE_DIR}/.svn/entries")
+
+if(DEFINED llvm_vc AND DEFINED clang_vc)
+  # Create custom target to generate the VC revision include.
+  add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc"
+    DEPENDS "${llvm_vc}" "${clang_vc}"
+    COMMAND
+    ${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
+                     "-DFIRST_NAME=LLVM"
+                     "-DSECOND_SOURCE_DIR=${CLANG_SOURCE_DIR}"
+                     "-DSECOND_NAME=SVN"
+                     "-DHEADER_FILE=${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc"
+                     -P "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake")
+
+  # Mark the generated header as being generated.
+  set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc"
+    PROPERTIES GENERATED TRUE
+               HEADER_FILE_ONLY TRUE)
+
+  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
+  set_source_files_properties(Version.cpp
+    PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
+  set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
+else()
+  set(version_inc)
+endif()
+
 add_clang_library(clangBasic
   Attributes.cpp
   Builtins.cpp
@@ -29,30 +71,6 @@ add_clang_library(clangBasic
   VersionTuple.cpp
   VirtualFileSystem.cpp
   Warnings.cpp
+  ${version_inc}
   )

-# Determine Subversion revision.
-# FIXME: This only gets updated when CMake is run, so this revision number
-# may be out-of-date!
-if( NOT IS_SYMLINK "${CLANG_SOURCE_DIR}" )  # See PR 8437
-  find_package(Subversion)
-endif()
-if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
-  set(FIRST_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
-  set(FIRST_REPOSITORY LLVM_REPOSITORY)
-  set(SECOND_SOURCE_DIR ${CLANG_SOURCE_DIR})
-  set(SECOND_REPOSITORY SVN_REPOSITORY)
-  set(HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc)
-  include(GetSVN)
-
-  # Mark the generated header as being generated.
-  message(STATUS "Expecting header to go in ${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
-  set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc
-    PROPERTIES GENERATED TRUE
-               HEADER_FILE_ONLY TRUE)
-
-  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
-  set_source_files_properties(Version.cpp
-    PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
-
-endif()


_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu<mailto:cfe-commits at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu<mailto:cfe-commits at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141125/74b8741f/attachment.html>


More information about the cfe-commits mailing list