David Peixotto
2012-Nov-27 00:52 UTC
[LLVMdev] Building llvm and clang with mixed assertion modes
Hi, 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. Thanks! -David -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121126/b4ad96ea/attachment.html>
Óscar Fuentes
2012-Nov-27 01:24 UTC
[LLVMdev] Building llvm and clang with mixed assertion modes
"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). You can also modify clang/CMakeLists.txt by changing add_definitions( -D_GNU_SOURCE ) to add_definitions( -D_GNU_SOURCE -U_DEBUG -DNDEBUG ) 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)
David Peixotto
2012-Nov-28 00:12 UTC
[LLVMdev] Building llvm and clang with mixed assertion modes
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/disablingassertions 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 theoption> 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.
Maybe Matching Threads
- [LLVMdev] Building llvm and clang with mixed assertion modes
- [LLVMdev] Add support for ldr pseudo instruction in ARM integrated assembler
- [LLVMdev] Add support for ldr pseudo instruction in ARM integrated assembler
- [LLVMdev] Add support for ldr pseudo instruction in ARM integrated assembler
- [LLVMdev] Add support for ldr pseudo instruction in ARM integrated assembler