[LLVMdev] Building llvm and clang with mixed assertion modes
David Peixotto
dpeixott at codeaurora.org
Tue Nov 27 16:12:40 PST 2012
Thanks for the suggestions Oscar! I have a few comments below.
> "David Peixotto" <dpeixott at codeaurora.org> writes:
>
> > I'd like to build llvm with assertions enabled, but build clang with
> > assertions disabled. In other words, I'd like lvm in Release+Asserts
> > mode, but clang in Release mode.
> >
> > Is it possible to do this with one top level configure/make command?
> > If not, any idea how much work would it be to add this feature to
> > llvm? I'm not very familiar with llvm's build system.
>
> Dunno about the configure&make build, but with the cmake build you can do
> that by building clang standalone (build and install LLVM without clang,
then
> build clang using LLVM as an external library, enabling/disabling
assertions as
> you like).
I'd prefer to have clang and llvm build together. I have a number of scripts
that assume llvm and clang are checked out together in the same source tree
and I don't think I can modify them easily to have separate build/install
steps.
> You can also modify clang/CMakeLists.txt by changing
>
> add_definitions( -D_GNU_SOURCE )
>
> to
>
> add_definitions( -D_GNU_SOURCE -U_DEBUG -DNDEBUG )
>
This looks like it will permanently disable assertions for clang. I'd prefer
a solution that can be controlled by a flag.
> which disables assertions for clang. Then build LLVM+Clang using the
option
> for enabling assertions:
>
> mkdir mybuilddir && cd mybuilddir
> cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
> path/to/llvm/src
>
> (In the cmake build, assertions are disabled by default in Release mode)
I guess what I'd like to see is something like this:
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
-DCLANG_ENABLE_ASSERTIONS=OFF
It sounds like this is not possible with the current build system. Would it
be possible to add something like this? I'm worried that the linking could
be a bit difficult because it would need to link clang objects in the
Release directory with llvm objects in the Release+Asserts directory.
Thanks again for your input.
More information about the llvm-dev
mailing list