On Tue, Jul 21, 2015 at 6:30 PM Justin Bogner <mail at justinbogner.com> wrote:> Paweł Bylica <chfast at gmail.com> writes: > > On Tue, Jul 21, 2015 at 5:55 PM Justin Bogner <mail at justinbogner.com> > wrote: > > > > Paweł Bylica <chfast at gmail.com> writes: > > > I can confirm that the issue has been caused by NDEBUG flag. > > > > > > On Mon, Jul 13, 2015 at 6:29 PM Reid Kleckner <rnk at google.com> > wrote: > > > > > > The layout of AssertingVH has depended on NDEBUG since 2009, > which > > > predates any of our efforts to make LLVM's ABI resilient to > > mismatched > > > NDEBUG definitions between LLVM and its users. > > > > > > For now, make sure your definition of NDEBUG matches LLVM's. > In the > > long > > > run, we could conceivably do something > > > with LLVM_ENABLE_ABI_BREAKING_CHECKS to allow this mismatch. > > > > > > In practice it is very hard to make NDEBUG flag match configs of > your > > project > > > and LLVM project. You often need to build debug and release > versions of > > your > > > project and LLVM is installed as a debian package or with homebrew. > > Moreover, > > > there is not reliable way of checking if LLVM has been built with > or > > without > > > NDEBUG. > > > > FWIW, `llvm-config --assertion-mode` will tell you whether or not > your > > LLVM was built with or without NDEBUG. > > > > That's not true in all cases. In case CMAKE_BUILD_TYPE=Release, > > LLVM_ENABLE_ASSERTIONS=Off and CMAKE_CXX_FLAGS_RELEASE="" llvm-config > reports > > asserts as off but NDEBUG flag is not set. > > Um, okay, but why would you set CMAKE_CXX_FLAGS_RELEASE=""? That doesn't > make any sense... >I agree, it make no sense. But homebrew actually does that: https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/formula.rb#L615 There are many possible solutions for this case: 1. Force NDEBUG flag 2. Report a cmake error. 3. Get rid of LLVM_ENABLE_ASSERTIONS flag and relay on NDEBUG flag only.> > > > > > Can I do anything more about it? Contributions related to > > > LLVM_ENABLE_ABI_BREAKING_CHECKS needed? > > > > > > - Paweł > > > > > > _______________________________________________ > > > LLVM Developers mailing list > > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150721/f9274e74/attachment.html>
Paweł Bylica <chfast at gmail.com> writes:> On Tue, Jul 21, 2015 at 6:30 PM Justin Bogner <mail at justinbogner.com> wrote: >> Paweł Bylica <chfast at gmail.com> writes: >>> On Tue, Jul 21, 2015 at 5:55 PM Justin Bogner <mail at justinbogner.com> wrote: >>>> FWIW, `llvm-config --assertion-mode` will tell you whether or not your >>>> LLVM was built with or without NDEBUG. >>> >>> That's not true in all cases. In case CMAKE_BUILD_TYPE=Release, >>> LLVM_ENABLE_ASSERTIONS=Off and CMAKE_CXX_FLAGS_RELEASE="" >>> llvm-config reports asserts as off but NDEBUG flag is not set. >> >> Um, okay, but why would you set CMAKE_CXX_FLAGS_RELEASE=""? That >> doesn't make any sense... > > I agree, it make no sense. But homebrew actually does that: > https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/formula.rb#L615That sounds very broken - maybe ask them to fix it? In any case, `llvm-config` seems to correctly report asserts as ON in this case, despite the configuration being completely bogus: % cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=Off -DCMAKE_CXX_FLAGS_RELEASE="" ... % ninja llvm-config [94/94] Linking CXX executable bin/llvm-config % ./bin/llvm-config --assertion-mode ON The code that prints this just checks NDEBUG: llvm-config.cpp:320:> } else if (Arg == "--assertion-mode") { > #if defined(NDEBUG) > OS << "OFF\n"; > #else > OS << "ON\n"; > #endif
On Tue, Jul 21, 2015 at 6:58 PM Justin Bogner <mail at justinbogner.com> wrote:> Paweł Bylica <chfast at gmail.com> writes: > > On Tue, Jul 21, 2015 at 6:30 PM Justin Bogner <mail at justinbogner.com> > wrote: > >> Paweł Bylica <chfast at gmail.com> writes: > >>> On Tue, Jul 21, 2015 at 5:55 PM Justin Bogner <mail at justinbogner.com> > wrote: > >>>> FWIW, `llvm-config --assertion-mode` will tell you whether or not your > >>>> LLVM was built with or without NDEBUG. > >>> > >>> That's not true in all cases. In case CMAKE_BUILD_TYPE=Release, > >>> LLVM_ENABLE_ASSERTIONS=Off and CMAKE_CXX_FLAGS_RELEASE="" > >>> llvm-config reports asserts as off but NDEBUG flag is not set. > >> > >> Um, okay, but why would you set CMAKE_CXX_FLAGS_RELEASE=""? That > >> doesn't make any sense... > > > > I agree, it make no sense. But homebrew actually does that: > > > https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/formula.rb#L615 > > That sounds very broken - maybe ask them to fix it? >I've fixed that for the LLVM formula. https://github.com/Homebrew/homebrew/blob/master/Library/Formula/llvm.rb#L140> > In any case, `llvm-config` seems to correctly report asserts as ON in > this case, despite the configuration being completely bogus: >In the same time the shared cmake file LLVMConfig.cmake will have LLVM_ENABLE_ASSERTIONS set to On.> > % cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release > -DLLVM_ENABLE_ASSERTIONS=Off -DCMAKE_CXX_FLAGS_RELEASE="" > ... > % ninja llvm-config > [94/94] Linking CXX executable bin/llvm-config > % ./bin/llvm-config --assertion-mode > ON > > The code that prints this just checks NDEBUG: > > llvm-config.cpp:320: > > } else if (Arg == "--assertion-mode") { > > #if defined(NDEBUG) > > OS << "OFF\n"; > > #else > > OS << "ON\n"; > > #endif >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150721/63fcb33d/attachment.html>