[LLVMdev] make error building llvm/clang 3.2 on Linux

Michael Young
Sun, 24 Feb 2013 04:03:56 -0000

I'm continuing this here in llvm-dev since the thread was started here,
but, in hindsight, it may have been better in cfe-dev, because the
problem seems to be related to clang.

I turned on "verbose" mode in make (VERBOSE=1 TOOL_VERBOSE=1) and
found
that it is clang, not gcc, that is being used at this point in the make.
Based on the command issued (particularly with the --sysroot options),
I surmised that I'm picking up the wrong <mman.h>. The one in the
specified sysroot dir doesn't have a #include <features.h> (which is
not
being found). So where is the mman.h being picked up??? Well, I find
it at /usr/include/i386-linux-gnu/sys, and, lo and behold, there is a
#include <features.h> at line 23, just at the location reported with
the error. And why is clang looking in "/usr/include/i386-linux-gnu"?
Because I had defined the C_INCLUDE_PATH environment variable with this
directory. When I reset this (and LIBRARY_PATH and CPLUS_INCLUDE_PATH)
to empty, I can proceed with the make.

Here's the problem - I have to have these environment variables defined
to allow gcc to work (without them, I can't even get through configure).
Ubuntu 11.10, 12.04, and perhaps later versions, put things in
"non-standard" locations, and this is the workaround - see
"http://gcc.gnu.org/ml/gcc/2012-02/msg00314.html" for details.
That's
fine, but clang apparently uses these environment variables, too, and,
based on my results, I really don't think I want clang to pick these
up, at least not when clang has sysroot specified (as it is in the
make).

Unfortunately, the make later reverts back to using gcc (actually g++),
and it breaks again without the environment variables being defined
with the appropriate directories.

So is there an easy way to have gcc/g++ use these variables and not
clang? That should allow me to get through a build (make) cleanly.

Thanks,
Mike