I have some strange problem with CMake when I press Configure button.
It reports me all the time that libiconv-2.dll is missing and fails to finish operation. However, this library is present in MinGW/bin folder.
I am using CodeBlocks-MinGW Makefiles and CMake version 3.6.1 - 32 bit version (although this same problem is with 64 bit version).
One interesting thing is that in consol it shows:
The CXX compiler identification is unknown
Check for working CXX compiler: C:/MinGW/bin/g++.exe
Check for working CXX compiler: C:/MinGW/bin/g++.exe -- broken
MinGW is correctly added to the system path and I was able to check version (GNU 4.8.1) and also compile simple hello world from command line using:
g++ test.cpp -o test
Testing this same CMakeLists file on another machine with this same configuration, but older CMake version 3.2.3 everything works. Doing some research online I've found that problem with this file is not new, so I doubt this is version problem.
Anyone has any idea what can be done more?
EDIT 1
This is the content of CMakeError.log
Compiling the CXX compiler identification source file
"CMakeCXXCompilerId.cpp" failed. Compiler: C:/MinGW/bin/g++.exe Build
flags: Id flags:
The output was: 1
Compiling the CXX compiler identification source file
"CMakeCXXCompilerId.cpp" failed. Compiler: C:/MinGW/bin/g++.exe Build
flags: Id flags: -c
The output was: 1
Checking whether the CXX compiler is IAR using "" did not match "IAR
.+ Compiler": g++.exe: fatal error: no input files compilation
terminated. Determining if the CXX compiler works failed with the
following output: Change Dir:
C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_c9a03/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_c9a03.dir\build.make
CMakeFiles/cmTC_c9a03.dir/build
mingw32-make.exe1: Entering directory
'C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj
C:\MinGW\bin\g++.exe -o
CMakeFiles\cmTC_c9a03.dir\testCXXCompiler.cxx.obj -c
C:\Users\testuser\Desktop\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
CMakeFiles\cmTC_c9a03.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj' failed
mingw32-make.exe1: ***
[CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj] Error 1
mingw32-make.exe1: Leaving directory
'C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp'
Makefile:125: recipe for target 'cmTC_c9a03/fast' failed
mingw32-make.exe: *** [cmTC_c9a03/fast] Error 2
I have manually compiled the file testCXXCompiler.cpp with g++ and it worked. There was no error during compilation.
EDIT 2
I have created SSCCE to test if problem isn't with some dependencies or some other code-related things. But testing this file:
test.cpp
#include <iostream>
int main()
{
std::cout << "Test" << std::endl;
return 0;
}
CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(Test)
add_executable(Test test.cpp)
I have still problems with missing library. The console output changed however slightly and now it is:
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: C:/MinGW/bin/gcc.exe
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
I suppose I have found the answer. At least it is working for me.
Apparently I needed to run the CMake on the other machine as an Administrator. This way I assume it could accessed to GCC files correctly. However, I am not completely sure why on the other machine it wasn't required and worked just fine.
You might need to reinstall the lib
mingw-get install --reinstall mingw32-libiconv-dll
I had a very similar problem, and it was fixed this way.
Related
In order to make use of newer C++ 17 and 20 features, I want to switch from Apple clang to a homebrew installed vanilla clang. I installed it via brew install llvm.
When trying to build a minimal CMake based test project like
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -G Ninja testProject
CMake fails with
-- The C compiler identification is Clang 13.0.0
-- The CXX compiler identification is Clang 13.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/usr/local/opt/llvm/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/me/Projects/testProject/build/CLion/Debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/local/bin/ninja cmTC_d2d4b && [1/2] Building C object CMakeFiles/cmTC_d2d4b.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_d2d4b
FAILED: cmTC_d2d4b
: && /usr/local/opt/llvm/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_d2d4b.dir/testCCompiler.c.o -o cmTC_d2d4b && :
ld: library not found for -lSystem
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
So it seems that it fails to locate the correct library search path out of the box.
When trying to build a simple hello world program from the command line like
/usr/local/opt/llvm/bin/clang++ main.cpp -isysroot /Library/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
It fails with even not finding some headers.
Supplying the header and library search path explicitly to the build command like
/usr/local/opt/llvm/bin/clang++ main.cpp -I"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" -L"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
makes it work. However, both are no solutions to make the built-in CMake compiler check work and they don't seem like the correct way to go.
Once this is working correctly, I'm furthermore interested in being able to compile ObjectiveC++ code which currently fails with even more errors.
I think I understand the problem that the compiler does not know the correct search paths, but I'm lacking some understanding about how it would normally figure out those search paths in a CMake project.
I finally managed to get it working by supplying a few linker flags through the LDFLAGS environment variable:
-L/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/lib
In order to find the system libraries needed by the C compiler check
-L/usr/local/opt/llvm/lib
In order to find the C++ libraries as needed by the C++ compiler check
In order to successfully compile Objective-C code that links to Apple frameworks, I furthermore needed to add
-F/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks -lobjc
With those flags, I now can successfully build my projects. Still, I'm not 100% sure if this is the right way, especially if the libraries linked from /usr/local/opt/llvm/lib can be expected to be present on all target systems?
I am trying to compile Assimp 5.0.1 for Windows 10 using CMake. The C/C++ compilers I have through MinGW are GCC and G++. If I understand the problem correctly, there is an issue with the MakeFile's whitespace somewhere. The /CMakeTmp/ directory is empty, and I am sure the answer is right in front of me somewhere:
Console Output:
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe - broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_a4ec5\fast && Makefile:37: *** missing separator. Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:54 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeOutput.log".
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeError.log".
CMakeError.log:
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_165dc\fast && Makefile:37: *** missing separator. Stop.
CMakeOutput.log:
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"
The C compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdC/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
The CXX compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdCXX/a.exe"
Which -G option did you use for cmake?
The /nologo parameter for make doesn't seem right, that looks like a Microsoft/MSVC parameter. If you didn't specify -G then CMake defaults to -G"NMake Makefiles" on Windows.
Make sure to use cmake flag -G"MinGW Makefiles" for mingw32-make or -G"MSYS Makefiles" if you use MSYS' make.
But to avoid all those make issues and improve speed -GNinja is the best solution, provided you have Ninja available (see https://ninja-build.org/).
Finally, you're still on MinGW GCC 9.2.0. Newer versions are available, see http://winlibs.com/ for standalone builds which also come with newer mingw32-make.
I am trying to build a LLVM from a working copy I have from another machine. The original source is build using configure and make. However, on the new systems the same build method fails (I have tried make clean). I tried the cmake option and it says the following:
Basically there seems to be some left over files from the earlier build, so the question is how do I remove it, elegantly, i.e not with a linux command but using the LLVM build system itself. make distclean says "No rule to make target `disctclean'. Stop."
-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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
CMake Error at CMakeLists.txt:57 (message):
Apparently there is a previous in-source build,
probably as the result of running `configure' and `make' on
/Users/me/scp/llvm_release.
This may cause problems. The suspicious files are:
/Users/me/scp/llvm_release/lib/Target/AArch64/AArch64GenAsmWriter.inc;
...
...
/Users/me/scp/llvm_release/lib/Target/XCore/XCoreGenSubtargetInfo.inc
/Users/me/scp/llvm_release/include/llvm/IR/Intrinsics.gen
Please clean the source directory.
-- Configuring incomplete, errors occurred!
The LLVM build system does not provide a solution for this problem. You can start from scratch with clean sources or use some linux shell voodoo to get rid of all .gen files.
This is one reason why we use a separate build directory in the directions here:
http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary
The easiest way would be to restart with a clean set of source and avoid using configure and make in the source directory.
If you checked the source out using source control you can just use that to remove all the untracked files and reset all the modified ones.
Just remove the mentioned files:
Users/me/scp/llvm_release/lib/Target/AArch64/AArch64GenAsmWriter.inc;
...
...
/Users/me/scp/llvm_release/lib/Target/XCore/XCoreGenSubtargetInfo.inc
/Users/me/scp/llvm_release/include/llvm/IR/Intrinsics.gen
and then run run make or cmake or ninja again. If it complains that a file is missing then copy the missing file from the original LLVM source code.
I'm trying to run this simple CMake command:
$ cmake -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_CXX_COMPILER=/usr/bin/g++ ./src/
I get the following output:
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.
The reason for the error is the following:
gcc: error: unrecognized command line option ‘-rpath’
because CMake is trying to link with the following command:
/usr/bin/gcc -rpath /usr/local/openblas/lib
CMakeFiles/cmTryCompileExec1190183239.dir/testCCompiler.c.o -o
cmTryCompileExec1190183239 -rdynamic
to my knowledge there is no stand alone '-rpath' option with gcc. I'm not sure why CMake is trying to do this.
Did anyone else come across this? Solutions?
Thanks!
PS: Some more info that maybe useful:
I'm trying to learn how to use CMake so the directory structure is very simple:
-cmake_test/
-bin/
-src/
-executable.cpp
-CMakeLists.txt
-CMakeLists.txt
Edit:
Complete output for
$ cmake ./src/
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec961681416/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec961681416.dir/build.make
CMakeFiles/cmTryCompileExec961681416.dir/build
make[1]: Entering directory
`/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp/CMakeFiles
1
Building C object
CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o
-c
/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec961681416
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec961681416.dir/link.txt --verbose=1
/usr/bin/cc -rpath /usr/local/openblas/lib
CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o -o
cmTryCompileExec961681416 -rdynamic
cc: error: unrecognized command line option ‘-rpath’
make[1]: *** [cmTryCompileExec961681416] Error 1
make[1]: Leaving directory
`/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec961681416/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
See also "/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeOutput.log".
See also "/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeError.log".
I apologize to everyone... The error resulted from me making a mistake a while ago.
The answer in short is that I had the following incorrect line in my .bashrc file:
export LDFLAGS="-rpath /usr/local/openblas/lib "$LDFLAGS
and CMake has the following line in the CMakeCommonLanguageInclude.cmake module:
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
Which obviously resulted in setting the CMAKE_EXE_LINKER_FLAGS to -rpath /usr/local/openblas/lib and
hence the error. After changing the .bashrc file to:
export LDFLAGS="-Wl,-rpath=/usr/local/openblas/lib "$LDFLAGS
the issue was resolved.
I have no idea why this didn't come up with the GUI version though :-)
I probably messed up the .bashrc file by reading an OSX forum or something.
Anyway thanks for the answers!
I started studying cmake about 2 weeks ago and like it. Thus far, I have been successful in building and packaging (with the native system packaging format) libc++abi, libc++, llvm 3.4 all with cmake (libc++abi with my own cmake setup) for RHEL 6.x, Fedora 20+, and Ubuntu 12.04 LTS+.
I would like to create a C++ build environment that
Frees us from dependency on GNU GCC and libstdc++ completely (thus we don't want any LLVM RPM/DEB from these aforementioned distros or the LLVM Debian/Ubuntu nightly packages download site)
Enables us to explore fully C++11 and C++1y. In other words, we can try even the bleeding edge LLVM/clang anytime we want to while keeping all our build systems clean with package management systems.
Nevertheless, I hit a snag in attempting to build clang 3.4 with cmake, on a build host running Ubuntu 12.04 LTS 64bit, with a pure clang 3.3 built by me without any dependency on GNU libstdc++, together with libc++ 3.3 and libc++abi. The later two have no libstdc++ dependency either. I built both that way too.
I know of the Clang - Getting Started Web page really well and have used the instructions there successfully. But these are exactly what I don't want to use. They are incorrect too: the CMakeLists.txt of clang 3.4 clearly states the following:
1 # If we are not building as a part of LLVM, build Clang as an
2 # standalone project, using LLVM as an external library:
3 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
4 project(Clang)
5 cmake_minimum_required(VERSION 2.8)
6
7 set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH
8 "Path to LLVM source code. Not necessary if using an installed LLVM.")
9 set(CLANG_PATH_TO_LLVM_BUILD "" CACHE PATH
10 "Path to the directory where LLVM was built or installed.")
See line 1 and 2. But, I have not found any LLVM documentation regarding how to set the CLANG_PATH_TO_LLVM_BUILD. I tried the following:
cmake -DCLANG_PATH_TO_LLVM_BUILD="../../llvm-3.4/build" ..
and got the following errors:
$ clang3.4/_tars/clang-3.4/build$ cmake -DCLANG_PATH_TO_LLVM_BUILD="../../llvm-3.4/build" ..
-- The C compiler identification is Clang 3.3.0
-- The CXX compiler identification is Clang 3.3.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:39 (include):
include could not find load file:
AddLLVM
CMake Error at CMakeLists.txt:40 (include):
include could not find load file:
TableGen
-- Performing Test C_SUPPORTS_FLAG
-- Performing Test C_SUPPORTS_FLAG - Success
-- Performing Test CXX_SUPPORTS_FLAG
-- Performing Test CXX_SUPPORTS_FLAG - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.7.8")
-- Clang version: 3.4
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Success
CMake Error at utils/TableGen/CMakeLists.txt:3 (add_tablegen):
Unknown CMake command "add_tablegen".
-- Configuring incomplete, errors occurred!
But that's not right! The LLVM + compiler-rt has been installed on the build host with our own DEB. And,
$ llvm/clang3.4/_tars/clang-3.4/build$ ls /usr/share/llvm/cmake
AddLLVM.cmake ChooseMSVCCRT.cmake linux_issue.cmake LLVMConfigVersion.cmake pkg.cmake
AddLLVMDefinitions.cmake GetSVN.cmake LLVM-Config.cmake LLVMParseArguments.cmake TableGen.cmake
arch.cmake HandleLLVMOptions.cmake LLVMConfig.cmake LLVMProcessSources.cmake
So, all required cmake modules are there - right on the system!
I would appreciate a hint as to how to coerce clang 3.4 to build with cmake, with an already installed LLVM 3.4 + compiler-rt 3.4.
Update:
I decided to do the following:
$ llvm/clang3.4/_tars/clang-3.4/build$ cmake -DCLANG_PATH_TO_LLVM_BUILD="/usr" ..
-- Building with -fPIC
-- Clang version: 3.4
-- Found Subversion: /usr/bin/svn (found version "1.6.17")
-- Configuring done
-- Generating done
-- Build files have been written to: ../llvm/clang3.4/_tars/clang-3.4/build
../llvm/clang3.4/_tars/clang-3.4/build$ make -j 2
Scanning dependencies of target ClangDriverOptions
Scanning dependencies of target clang-tblgen
[ 0%] Building Options.inc...
[ 0%] ../llvm/clang3.4/_tars/clang-3.4/include/clang/Driver/Options.td:15:9: error: Could not find include file 'llvm/Option/OptParser.td'
include "llvm/Option/OptParser.td"
^
.../llvm/clang3.4/_tars/clang-3.4/include/clang/Driver/Options.td:15:9: Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangASTNodesEmitter.cpp.o
error: Unexpected input at top level
include "llvm/Option/OptParser.td"
^
make[2]: *** [include/clang/Driver/Options.inc.tmp] Error 1
make[1]: *** [include/clang/Driver/CMakeFiles/ClangDriverOptions.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangAttrEmitter.cpp.o
[ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentCommandInfoEmitter.cpp.o
[ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp.o
[ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLTagsEmitter.cpp.o
[ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
[ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSACheckersEmitter.cpp.o
[ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o
[ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o
Linking CXX executable ../llvm/clang3.4/_tars/llvm-3.4/build/bin/clang-tblgen
[ 1%] Built target clang-tblgen
make: *** [all] Error 2
That's better. Looks like clang 3.4's default CMakeLists.txt is not even QA-ed x-( Yikes x-(
I decided to tough it out as any self-respecting engineer would do :) I simply vi-ed the following two files and add full path to the offending include, and then that's that.
Options.td
CC1AsOptions.td
Now I can build all desired LLVM main projects without libstdc++ dependency, all linked with libc++ and libc++abi. Hooray :)
So, I have confirmed that
Some instructions given in Getting Started: Building and Running Clang are misleading, e.g. 7.
All main LLVM projects (except compiler-rt AFAIK) can be built with cmake. There is no need to lump them together under the LLVM source tree for building. You definitely can build nearly all of them separately on Linux, unlike what these "official" documentation may lead you to believe :>
The LLVM team should really think through and minimize the apparent cyclic dependency among all projects. Bootstrapping LLVM/clang on various Linux distros (especially older ones such as RHEL 5.x) without GNU libstdc++ dependency is too tedious - speaking from my first hand experience. They can be done (I have done it :) but it's not for the faint of heart.
I think this project does what you're trying to do:
https://github.com/rsmmr/install-clang
I've used it on FC16+, but did run into bootstrapping issues on RHEL5.x.
I tried many ways and find that just copy llvm/include/llvm to this Driver dir and it will work.