[LLVMdev] Building llvm and clang with mixed assertion modes
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,
> build clang using LLVM as an external library, enabling/disabling
> 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
> You can also modify clang/CMakeLists.txt by changing
> add_definitions( -D_GNU_SOURCE )
> 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
> for enabling assertions:
> mkdir mybuilddir && cd mybuilddir
> cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
> (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
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