Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

cmake produces invalid c++ SVNVersion.inc #17202

Closed Quuxplusone closed 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR17203
Status RESOLVED FIXED
Importance P normal
Reported by Tobias Markmann (tm@ayena.de)
Reported on 2013-09-12 04:07:35 -0700
Last modified on 2013-09-13 07:43:17 -0700
Version trunk
Hardware Macintosh MacOS X
CC daniel.sanders@imgtec.com, jrose@belkadan.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Revision: 190595

Using cmake for build configuration and ninja for building.
CMake produces SVNVersion.inc that linebreaks LLVM_REPOSITORY line and thereby
making it invalid.

cmake version 2.8.11.2

[63/364] Building CXX object
tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Version.cpp.o
FAILED: /usr/bin/c++   -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -
DCLANG_ENABLE_STATIC_ANALYZER -DHAVE_SVN_VERSION_INC -D_DEBUG -D_GNU_SOURCE -
D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -
fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -
Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -
Wnon-virtual-dtor -fcolor-diagnostics -fno-common -Woverloaded-virtual -Wcast-
qual -fno-strict-aliasing -fno-rtti -O2 -g -DNDEBUG -Itools/clang/lib/Basic -
I/Users/tobias/dev/rep/llvm/tools/clang/lib/Basic -
I/Users/tobias/dev/rep/llvm/tools/clang/include -Itools/clang/include -Iinclude
-I/Users/tobias/dev/rep/llvm/include    -UNDEBUG -fno-exceptions -MMD -MT
tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Version.cpp.o -MF
"tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Version.cpp.o.d" -o
tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Version.cpp.o -c
/Users/tobias/dev/rep/llvm/tools/clang/lib/Basic/Version.cpp
In file included from
/Users/tobias/dev/rep/llvm/tools/clang/lib/Basic/Version.cpp:22:
tools/clang/lib/Basic/SVNVersion.inc:2:25: warning: missing terminating '"'
character [-Winvalid-pp-token]
#define LLVM_REPOSITORY "http://llvm.org/svn/llvm-project/llvm/trunk
                        ^
tools/clang/lib/Basic/SVNVersion.inc:3:3: error: expected unqualified-id
 ^/llvm/trunk"
  ^
tools/clang/lib/Basic/SVNVersion.inc:3:14: warning: missing terminating '"'
character [-Winvalid-pp-token]
 ^/llvm/trunk"
             ^
tools/clang/lib/Basic/SVNVersion.inc:5:24: warning: missing terminating '"'
character [-Winvalid-pp-token]
#define SVN_REPOSITORY "http://llvm.org/svn/llvm-project/cfe/trunk
                       ^
tools/clang/lib/Basic/SVNVersion.inc:6:13: warning: missing terminating '"'
character [-Winvalid-pp-token]
 ^/cfe/trunk"
            ^
/Users/tobias/dev/rep/llvm/tools/clang/lib/Basic/Version.cpp:32:17: error:
expected expression
  StringRef URL(SVN_REPOSITORY);
                ^
tools/clang/lib/Basic/SVNVersion.inc:5:24: note: expanded from macro
'SVN_REPOSITORY'
#define SVN_REPOSITORY "http://llvm.org/svn/llvm-project/cfe/trunk
                       ^
/Users/tobias/dev/rep/llvm/tools/clang/lib/Basic/Version.cpp:59:17: error:
expected expression
  StringRef URL(LLVM_REPOSITORY);
                ^
tools/clang/lib/Basic/SVNVersion.inc:2:25: note: expanded from macro
'LLVM_REPOSITORY'
#define LLVM_REPOSITORY "http://llvm.org/svn/llvm-project/llvm/trunk
                        ^
4 warnings and 3 errors generated.
Quuxplusone commented 11 years ago

Daniel Sanders has a patch for this: http://llvm-reviews.chandlerc.com/D1659

Quuxplusone commented 11 years ago

It's true that the first version of my patch would fix this build but I don't think the updated version does. Those look like subversion URLs so I don't think this is the multi-remote git repository problem I was trying to fix. I think it's taking one of the other two paths through utils/GetRepositoryPath.

Tobias: Is your checkout from svn, git-svn, or git? Also, can you attach your tools/clang/lib/Basic/SVNVersion.inc? I find that the file is deleted before the end of the build so you might need to comment the 'file(REMOVE ...)' command at the end of cmake/modules/GetSVN.cmake and attach the SVNVersion.inc.txt instead.

Quuxplusone commented 11 years ago
I think it's a normal svn repo.

URL: http://llvm.org/svn/llvm-project/llvm/trunk
Relative URL: ^/llvm/trunk
Repository Root: http://llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8

--- Content of SVNVersion.inc
llvm_build  cat tools/clang/lib/Basic/SVNVersion.inc
#define LLVM_REVISION "190668"
#define LLVM_REPOSITORY "http://llvm.org/svn/llvm-project/llvm/trunk
 ^/llvm/trunk"
#define SVN_REVISION "190668"
#define SVN_REPOSITORY "http://llvm.org/svn/llvm-project/cfe/trunk
 ^/cfe/trunk"
Quuxplusone commented 11 years ago
I think I see whats going on. GetRepositoryPath is grepping for 'URL:' and is
picking up the 'Relative URL:' line in addition to the intended line.

It doesn't happen on my svn checkout though. What version of svn are you using?
I'm on 1.7.5 (r1336830).

It should be a one character fix. Try changing util/GetRepositoryPath so that:
  svn info | grep 'URL:' | cut -d: -f2-
becomes:
  svn info | grep '^URL:' | cut -d: -f2-
Quuxplusone commented 11 years ago
$ svn --version
svn, version 1.8.0 (r1490375)
   compiled Aug 27 2013, 22:21:07 on x86_64-apple-darwin12.4.0

Your proposed fix works for me. Thanks.
Quuxplusone commented 11 years ago

Great. It's a pretty simple fix so I'll go ahead and commit it.

Thanks for the bug report

Quuxplusone commented 11 years ago

Fix committed in r190685