About Clang headers on Debian

Stephan Bergmann sbergman at redhat.com
Tue Oct 8 02:22:23 PDT 2013


On 10/07/2013 11:46 PM, julien2412 wrote:
> I'm trying to build clang from svn trunk to give a try to MemorySanitizer.
> So I followed, http://clang.llvm.org/get_started.html
> but I don't know what to put in my autogen.input
> Either I get this:
> * WARNING : Cannot find Clang headers to build compiler plugins, plugins
> disabled
> or I get this:
> make: *** No rule to make target `/home/julien/llvm-svn/build/bin/clang',
> needed by
> `/home/julien/compile-libreoffice/libo_clang/compilerplugins/obj/clang-timestamp'.
> Stop
>
> Here's the end of my autogen.input when I get last message:
> CLANGBUILD=/home/julien/llvm-svn/build
> CLANGDIR=/home/julien/llvm-svn/llvm
> CC=/home/julien/llvm-svn/build/Debug+Asserts/bin/clang
> CXX=/home/julien/llvm-svn/build/Debug+Asserts/bin/clang++

The script with which I build Clang trunk is

> #!/bin/bash
> set -ex
> mkdir "${HOME?}"/clang/trunk
> svn co http://llvm.org/svn/llvm-project/llvm/trunk "${HOME?}"/clang/trunk/src
> svn co http://llvm.org/svn/llvm-project/cfe/trunk \
>  "${HOME?}"/clang/trunk/src/tools/clang
> svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk \
>  "${HOME?}"/clang/trunk/src/tools/clang/tools/extra
> svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk \
>  "${HOME?}"/clang/trunk/src/projects/compiler-rt
> mkdir "${HOME?}"/clang/trunk/build
> cd "${HOME?}"/clang/trunk/build
> "${HOME?}"/clang/trunk/src/configure --prefix="${HOME?}"/clang/trunk/inst \
>  --enable-optimized CC=gcc CXX=g++
> make -j12
> make install -j12

and then have

> CC=/home/sbergman/clang/trunk/inst/bin/clang
> CXX=/home/sbergman/clang/trunk/inst/bin/clang++
> CLANGBUILD=/home/sbergman/clang/trunk/inst
> CLANGDIR=/home/sbergman/clang/trunk/inst

in autogen.input, with CLANGBUILD = CLANGDIR (though IIRC Lubos used a 
somewhat different setup that did involve setting CLANGBUILD != CLANGDIR).

> Then if it had worked, I wanted to try this:
>
> CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins
> -fno-omit-frame-pointer -g -O2' CXXFLAGS='-fsanitize=memory
> -fsanitize-memory-track-origins -fno-omit-frame-pointer -g -O2' make
> as I read here:
> https://wiki.documentfoundation.org/Development/BuildingOnLinux#Compiler_flags

I once toyed around a little with -fsanitize=undefined, but it took some 
tweaking of solenv/gbuild/ to get the relevant flags properly into the 
build IIRC.  (I have those changes still lying around locally, but never 
came around to look into it again and clean up.  Also, 
-fsanitize=undefined started to fail rather quickly due to problems 
discussed in the thread starting at 
<http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130812/086127.html> 
"ubsan: check type_info equality via strcmp," which would need fixing in 
our cppumaker-generated headers.)

Stephan


More information about the LibreOffice mailing list