build error in git master

Does anybody else see the following build-error on linux-386?

  COMPILE: clang_linux/asan-x86_64/x86_64:
    /tmp/src/llvm/llvm/projects/compiler-rt/lib/asan/asan_linux.cc
In file included from
/tmp/src/llvm/llvm/projects/compiler-rt/lib/asan/asan_linux.cc:24:
In file included from /usr/include/sys/time.h:22:
In file included from /usr/include/features.h:399:
/usr/include/gnu/stubs.h:10:11: fatal error: 'gnu/stubs-64.h' file not found
# include <gnu/stubs-64.h>
          ^
1 error generated.

Hi Carsten,

We probably shouldn’t build ASan for x86_64 on 32-bit Linux. I’ll take a look at it.

few days ago i saw similar on Linux-x86_64
with slightly different err "fatal error: 'gnu/stubs-32.h' file not found"
--> after glibc-devel-i386 installation err go away

llvm/clang were configured with --enable-targets=host

Dmitry

few days ago i saw similar on Linux-x86_64
with slightly different err "fatal error: 'gnu/stubs-32.h' file not found"
--> after glibc-devel-i386 installation err go away

llvm/clang were configured with --enable-targets=host

Anything wrong or improvable in the way I configure and build:
CC=gcc CXX=g++ \
    ../llvm/configure \
    --prefix=$PREFIX \
    --libdir=$PREFIX/lib/llvm \
    --sysconfdir=$PREFIX/etc \
    --enable-shared \
    --enable-targets=all \
    --disable-expensive-checks \
    --disable-debug-runtime \
    --disable-assertions \
    --with-binutils-include=/usr/include \
    --enable-optimized

Is --enable-targets=all a bad idea? I think I copied the flags from
a distro package.

After configure is done I call "make REQUIRES_RTTI=1" also inspired
by a distro package build script.

I think your build script is OK.
r165222 should fix the problem for you.

I think your build script is OK.
r165222 should fix the problem for you.

Thanks update from git looks fine now.

Hello,

I get this error in debian unstable (arch amd64).

  COMPILE: clang_linux/asan-i386/i386: /opt/llvm/projects/compiler-rt/lib/asan/asan_linux.cc
In file included from /opt/llvm/projects/compiler-rt/lib/asan/asan_linux.cc:27:
/usr/include/sys/syscall.h:25:10: fatal error: 'asm/unistd.h' file not found
#include <asm/unistd.h>
         ^
1 error generated.

configure options:

$ ../configure \
  --disable-assertions \
  --enable-optimized \
  --disable-debug-symbols \
  --disable-debug-runtime \
  --enable-targets=host-only

same with --enable-targets=all

installed packages:

linux-libc-dev :/usr/include/x86_64-linux-gnu/asm/unistd.h
libc6-dev
libc6-dev-i386

Build fails after the following changes

r165096 "Build ASan runtime on Linux for both x86_64 and i386, same as we do with full compiler_rt and
libprofile"
r165097 "Make sure 32-bit ASan runtime is available on 64-bit Linux platforms"

I cannot test it with another linux distribution, so maybe it is debian related or just me.
Maybe I need to enable multiarch support for i386. Anyone with the same problem?

Thanks,

Maroudas Manolis

Yes, it looks like you’re missing system headers for 32-bit builds.
Is there any way/package you can use to get them? (probably there should be folder /usr/include/i386-linux-gnu/
as well as /usr/include/x86_64-linux-gnu).
In the meantime, we should think on how to test presence of necessary headers while configuring the build…

Yes, it looks like you're missing system headers for 32-bit builds.
Is there any way/package you can use to get them? (probably there should be
folder /usr/include/i386-linux-gnu/
as well as /usr/include/x86_64-linux-gnu).
In the meantime, we should think on how to test presence of necessary
headers while configuring the build...

I installed this package through multiarch

linux-libc-dev:i386 :/usr/include/i386-linux-gnu/asm/unistd.h

and now I get this error:

  COMPILE: clang_linux/asan-i386/i386: /opt/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc
/opt/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:20:10: fatal error: 'new' file not found
#include <new>
         ^
1 error generated.

Searching for 'new' I get the following results:

$ mlocate new |grep /usr/include |grep new$
/usr/include/boost/tr1/tr1/new
/usr/include/c++/4.6/new
/usr/include/c++/4.7/new

I have libstdc++6-4.7-dev installed on my system which provides /usr/include/c++/4.7/new.
Trying to install libstdc++6-4.7-dev:i386 conflicts with the already installed version of the package for amd64.

If I change the previous line to

#include <c++/4.7/new>

I get

  COMPILE: clang_linux/asan-i386/i386: /opt/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc
In file included from /opt/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:21:
/usr/include/c++/4.7/new:40:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.

yet another search this time for 'bits/c++config.h' returns:

$ mlocate bits/c++config.h
/usr/include/c++/4.6/x86_64-linux-gnu/32/bits/c++config.h
/usr/include/c++/4.6/x86_64-linux-gnu/bits/c++config.h
/usr/include/c++/4.7/x86_64-linux-gnu/32/bits/c++config.h
/usr/include/c++/4.7/x86_64-linux-gnu/bits/c++config.h

I think this has to do with the debian way of installing header files (and libraries) in order to offer multiarch
support.

The only workaround for me at the moment is to build without the changes introduced by commits r165096 and r165097
which is something I am trying to avoid.

Any help would be appreciated.

Thanks,

Maroudas Manolis

Hello,

I'm getting the same type of error:

COMPILE: clang_linux/asan-i386/i386: /home/stephen/Workspace/clang-standalone-workspace/build/project/clang-standalone/bootstrap/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_mac.cc
/home/stephen/Workspace/clang-standalone-workspace/build/project/clang-standalone/bootstrap/src/llvm/projects/compiler-rt/lib/asan/asan_linux.cc:24:10: fatal error:
      'sys/time.h' file not found
#include <sys/time.h>

which seems confusing as I configured my LLVM build with ./configure --enable-targets=x86_64 (I also tried this with --enable-targets=host on a Ubuntu 12.04 64 bit system) which should not have included the i386 support and thus not need the multiarch support...

Any suggestion on how to constrain the compiler-rt build to x86_64 target only?

Thanks!
Stephen

Sounds like we need to test whether x86_64 and/or i386 build works by compiling a simple test program.

Sounds like we need to test whether x86_64 and/or i386 build works by compiling a simple test program.

Yes. I’ll check if compiling a simple program (w/o including all the system headers we need) is enough to reason
about whether we can target i386. If the fix is not-trivial I’ll revert the change to un-break people.

Maroudas, Stephen

Could you test if CMake build of LLVM (http://llvm.org/docs/CMake.html) would work on your platform?
You’d need to install cmake 2.8.8 and follow the build instructions.

$ mkdir mybuilddir
$ cd mybuilddir
$ cmake path/to/llvm/source/root
$ make

I’m specifically interested in the contents of mybuilddir/lib/clang/3.2/lib/linux

Could you test if CMake build of LLVM (http://llvm.org/docs/CMake.html)
would work on your platform?
You'd need to install cmake 2.8.8 and follow the build instructions.

$ mkdir mybuilddir
$ cd mybuilddir
$ cmake path/to/llvm/source/root
$ make

I'm specifically interested in the contents
of mybuilddir/lib/clang/3.2/lib/linux

Yes, CMake build completes without errors for me, no need for i386 headers :slight_smile:

$ cmake --version
cmake version 2.8.9

$ ls -1 lib/clang/3.2/lib/linux/
libclang_rt.asan-x86_64.a
libclang_rt.tsan-x86_64.a
libclang_rt.x86_64.a

$ ./bin/clang -v
clang version 3.2 (trunk 165441)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Could you test if CMake build of LLVM (http://llvm.org/docs/CMake.html)
would work on your platform?
You’d need to install cmake 2.8.8 and follow the build instructions.

$ mkdir mybuilddir
$ cd mybuilddir
$ cmake path/to/llvm/source/root
$ make

I’m specifically interested in the contents
of mybuilddir/lib/clang/3.2/lib/linux

Yes, CMake build completes without errors for me, no need for i386 headers :slight_smile:

Thanks for this test! I’ve submitted some checks to compiler-rt build system.
Could you check if configure+make build doesn’t attempt to build 32-bit libraries on your systems now (r165504 or later)?

Alex,

Used cmake v2.8.9, build completed succesfully and the contents of lib/clang/3.2/lib/linux is

drwxrwxr-x 2 stephen stephen 4096 Oct 9 10:48 .
drwxrwxr-x 3 stephen stephen 4096 Oct 9 10:37 …
-rw-rw-r-- 1 stephen stephen 333316 Oct 9 10:48 libclang_rt.asan-x86_64.a
-rw-rw-r-- 1 stephen stephen 555106 Oct 9 10:48 libclang_rt.tsan-x86_64.a
-rw-rw-r-- 1 stephen stephen 246870 Oct 9 10:48 libclang_rt.x86_64.a

Stephen

Alex

Thanks for this test! I’ve submitted some checks to compiler-rt build system.
Could you check if configure+make build doesn’t attempt to build 32-bit libraries on your systems now (r165504 or later)?

Looks beautiful. Contents for lib/clang/3.2/lib/linux is

drwxrwxr-x 2 stephen stephen 4096 Oct 9 11:27 .
drwxrwxr-x 3 stephen stephen 4096 Oct 9 11:27 …
-rw-r–r-- 1 stephen stephen 302336 Oct 9 11:27 libclang_rt.asan-x86_64.a
-rw-r–r-- 1 stephen stephen 203584 Oct 9 11:27 libclang_rt.full-x86_64.a
-rw-r–r-- 1 stephen stephen 8560 Oct 9 11:27 libclang_rt.profile-x86_64.a
-rw-r–r-- 1 stephen stephen 528730 Oct 9 11:27 libclang_rt.tsan-x86_64.a

I used svn r165517 and built with both --enable-targets=x86_64 and --enable-targets=host

Thanks for your help!
Stephen

Thanks for this test! I've submitted some checks to compiler-rt build
system.
Could you check if configure+make build doesn't attempt to build 32-bit
libraries on your systems now (r165504 or later)?

It builds again! tested on r165519

Thanks for fixing this!

Maroudas Manolis