another try: lastest ubuntu 14.10 + gcc4.9.1 can't build clang

i have found no solution to build clang svn under my ubuntu 14.04 x64 + gcc 4.9.2
still getting this error

/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/cstddef:51:11:

error:
        no member named 'max_align_t' in the global namespace
    using ::max_align_t;
          ~~^

today i tried a fresh ubuntu 14.10 x64 (lastest + updates) default: gcc.4.9.1 installation with clang svn 228566 in a virtual machine
the max_align_t problem does not occure but i was still not able to compile clang out of the box getting this error from make

llvm[2]: Compiling llvm-lto.cpp for Debug+Asserts build
llvm[2]: Linking Debug+Asserts executable llvm-lto
collect2: error: ld terminated with signal 9 [Killed]
/home/test/llvm/Makefile.rules:1427: recipe for target '/home/test/build/Debug+Asserts/bin/llvm-lto' failed
make[2]: *** [/home/test/build/Debug+Asserts/bin/llvm-lto] Error 1
make[2]: Leaving directory '/home/test/build/tools/llvm-lto'
/home/test/llvm/Makefile.rules:873: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/test/build/tools'
/home/test/llvm/Makefile.rules:873: recipe for target 'all' failed
make: *** [all] Error 1

i've built svn clang serveral times before on former ubuntu version without any problem
is there something still to fix in the svn version or should i use cmake or is the description
on http://clang.llvm.org/get_started.html only for release revisions?

What does your CMakeCache.txt file say?

  • Marc

P.S. I build the entire offering, several times daily, on Debian Sid, sans debian package building.

the tutorial on http://clang.llvm.org/get_started.html just uses "make"

the page states "It is also possible to use CMake instead of the makefiles."
so i assume im using make when following the build guide

maybe someone should update the build guide if cmake should be prefered

You could just patch cstddef, e.g. something like:

diff --git a/libstdc++-v3/include/c_std/cstddef b/libstdc++-v3/include/c_std/cstddef
index f4845f024329..f12570e53947 100644
--- a/libstdc++-v3/include/c_std/cstddef
+++ b/libstdc++-v3/include/c_std/cstddef
@@ -48,7 +48,9 @@
namespace std
{
   // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h.
+#ifndef __clang__
   using ::max_align_t;
+#endif
}
#endif

libstdc++ is designed to work with gcc only. So if you want to avoid
these issues, you either need to patch libstdc++ or use libcxx instead.

I believe the ::max_align_t problem was fixed in http://llvm.org/viewvc/llvm-project?rev=201729&view=rev which is part of clang 3.5 (but not 3.4). So if you’re using a recent clang, you shouldn’t see this problem. It sounds like you’re indeed not seeing this problem with clang head; you’re getting “ld terminated with signal 9 [Killed]” instead. Searching for this error message finds http://stackoverflow.com/questions/5682854/why-is-the-linker-terminating-on-me-when-i-build-clang which suggests that you don’t have enough ram (maybe you’re using a 32-bit linux?)

libstdc++ is designed to work with gcc only. So if you want to avoid
these issues, you either need to patch libstdc++ or use libcxx instead.

While it is true that libstdc++ is developed in parallel with gcc, clang explicitly tries to be able to parse it. If it doesn’t, that’s a clang bug. Patching your system headers isn’t the right thing to do.

The system has moved to using cmake quite a while ago. That page is heavily outdated.

  • Marc

See my attached CMakeCache.txt file to see what’s being configured.

I recommend you install Clang 3.5 from Ubuntu and all its packages. Just cut out using gcc4.9 all together.

Seeing as how Debian and Ubuntu share most of it when you build your configuration:

build-clang$ cmake -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ …/llvm.

This also assumes you have the following checked out:

llvm

clang underneath llvm/tools/clang
clang-extra underneath llvm/tools/clang/tools/extra
lldb underneath llvm/tools/lldb
test-suite underneath llvm/projects/tests-suite
libcxxabi underneath llvm/projects/libcxxabi
libcxx underneath llvm/projects/libcxx
compiler-rt underneath llvm/projects/compiler-rt

You can diff through your CMakeCache.txt file and compare it to mine. Edit by hand works just fine.

  • Marc

CMakeCache.txt (89.2 KB)

The system has moved to using cmake quite a while ago. That page is
heavily outdated.

This too isn't true. configure/make is still one of llvm's supported build
configurations.

It may still be supported but are you going to say it is the preferred solution?

CMake is also a lot more verbose and easy to maintain and file bugs against.

  • Marc

Most people working on clang use cmake as far as I know. I don’t know what most users use (probably a binary from their package manager?).

I’m just saying that both cmake and make are supposed to work (and do work and there are bots using each system checking that they work).

you're getting "ld terminated with signal 9 [Killed]" instead.
which suggests that you don't have enough ram (maybe you're using a 32-bit
linux?

i've got an ubuntu 14.10 x64 VM with 4GB of RAM(3GBs free for compile)
  - before your post ~2GBs - more RAM is currenlty not possible
that amount of RAM let me compile more then before but still stops with ld terminated with signal 9

what amount of RAM is currently needed for building clang head? it wasn't that much before
   

I believe the ::max_align_t problem was fixed in
http://llvm.org/viewvc/llvm-project?rev=201729&view=rev which is part of
clang 3.5 (but not 3.4). So if you're using a recent clang, you shouldn't
see this problem. It sounds like you're indeed not seeing this problem with
clang head;

not with gcc4.9.1 but it seems with gcc4.9.2 (https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/ppa/+build/6539169)
i will retest if i get more RAM for my tests

You can never have too much RAM.

The FX-8350 with 32GB Ram just screams on builds.

  • Marc

That’s why one of the first things I do on my VMs is replace ld with gold.