[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Adonthell-devel] Debug symbols
From: |
Chris Frey |
Subject: |
Re: [Adonthell-devel] Debug symbols |
Date: |
Wed, 13 Jun 2012 02:47:15 -0400 |
User-agent: |
Mutt/1.4.2.2i |
On Wed, Jun 13, 2012 at 08:23:22AM +0200, Josh Glover wrote:
> This is probably a really basic problem, but I can't get adonthell
> built with debug symbols. My cmake output follows, but can anyone tell
> me how they were able to get debug symbols in adonthell and worldtest
> so that gdb is useful? :)
There's a couple ways that I've found.
One is to set the CMake build type with:
-DCMAKE_BUILD_TYPE:STRING="Debug"
This affects the -O optimization flags, and the -g flag.
There are a number of types: Debug, Release, RelWithDebugInfo, I think.
There might be another one.
The other way is to set the flags yourself:
-DCMAKE_C_FLAGS:STRING="-Wall -Werror -g"
-DCMAKE_CXX_FLAGS:STRING="-Wall -Werror -g"
Note that these flags come before the BUILD_TYPE flags, so if you try to
set -O0 and you build for Release, it will override with -O3.
Here's my full cmake command line, which I use via script:
cmake -Wdev \
-DCMAKE_INSTALL_PREFIX=/home/adonthell/progs/rootdir \
-DPYTHON_SITE_PACKAGE_DIR=/home/adonthell/progs/rootdir/lib/python2.7/dist-packages
\
-DDEVBUILD=1 \
-DCMAKE_BUILD_TYPE:STRING="Debug" \
-DCMAKE_C_FLAGS:STRING="-Wall -Werror -O0" \
-DCMAKE_CXX_FLAGS:STRING="-Wall -Werror -O0" \
-DADDITIONAL_SWIG_CXXFLAGS:STRING="-Wno-error" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
..
The -O0 really makes the game slow, but it is better for gdb debugging
sometimes.
Hope this helps,
- Chris