I wandered into something curious. Source is checked out from svn following this guide: <http://clang.llvm.org/get_started.html> which is linked from this page: <http://releases.llvm.org/4.0.0/docs/index.html> - like this:
Adam Jensen via llvm-dev <llvm-dev@lists.llvm.org> writes:
I wandered into something curious. Source is checked out from svn
following this guide:
<http://clang.llvm.org/get_started.html>
which is linked from this page:
<http://releases.llvm.org/4.0.0/docs/index.html>
like this:----
mkdir build
export BASE=$HOME/build
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_400/final/ $BASE/llvm_Rel400
cd $BASE/llvm_Rel400/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_400/final/ clang
svn co http://llvm.org/svn/llvm-project/lld/tags/RELEASE_400/final/ lld
svn co http://llvm.org/svn/llvm-project/polly/tags/RELEASE_400/final/ polly
cd $BASE/llvm_Rel400/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_400/final/ extra
cd $BASE/llvm_Rel400/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_400/final/ compiler-rt
svn co http://llvm.org/svn/llvm-project/openmp/tags/RELEASE_400/final/ openmp
svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_400/final/ libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_400/final/ libcxxabi
svn co http://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_400/final/ test-suite
----Then following this guide: <http://releases.llvm.org/4.0.0/docs/CMake.html>
----
mkdir $BASE/build_llvm
cd $BASE/build_llvm
cmake3 -G "Unix Makefiles" \
-DLLVM_TARGETS_TO_BUILD=all \
-DLLVM_BUILD_TOOLS=on \
-DLLVM_BUILD_EXAMPLES=on \
-DLLVM_BUILD_TESTS=on \
-DLLVM_ENABLE_PROJECTS=all \
-DCMAKE_INSTALL_PREFIX=$HOME/.local/llvm \
-DCMAKE_BUILD_TYPE=Release $BASE/llvm_Rel400 \
$BASE/llvm_Rel400
----Results in:
----
CMake Error at CMakeLists.txt:122 (message):
LLVM_ENABLE_PROJECTS requests clang but directory not found:
/home/hanzer/build/llvm_Rel400/../clang
----view $BASE/llvm_Rel400/CMakeLists.txt
----
116 if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
117 set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})
118 endif()
119 foreach(proj ${LLVM_ENABLE_PROJECTS})
120 set(PROJ_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
121 if(NOT EXISTS "${PROJ_DIR}" OR NOT IS_DIRECTORY "${PROJ_DIR}")
122 message(FATAL_ERROR "LLVM_ENABLE_PROJECTS requests ${proj} but directory not found: ${PROJ_DIR}")
123 endif()
----If CMakeLists.txt expects clang to be somewhere other than
"$BASE/llvm_Rel400/tools/clang", is there some incongruity with the
documentation?
So what's happened here is that there are two very different styles that
are somewhat supported for checking out and building llvm and its
projects, and you've managed to pick up some pieces from each.
The official directory layout and way to build llvm and clang is the
"nested" layout, as you've done and is described in the various getting
started guides. The LLVM_ENABLE_PROJECTS flag, on the other hand, is
used in the "flat" layout - it expects a top level directory with each
project checked out side by side. Some people are experimenting with
working in that sort of layout, but at this point it isn't the official
way to do things.
So in short, if you remove the -DLLVM_ENABLE_PROJECTS=all flag this
should all start working for you, but it's definitely confusing that
there's such a big difference between specifying that as all and not
specifying it at all in this case.