Some of projects use cmake, usually we can build like:
mkdir build && cd build
cmake ..
camke –build .
it usually a release version.
we as developer need debug version,
some doc said
cmake –build [–config Release] .
that seems indicate if want a debug version we do: make –build –config Debug .
but the –config is some sort of misleading, here is doc: https://stackoverflow.com/questions/17183248/the-option-build-of-cmake said:
If your build tool is a multi-configuration one (like devenv on Windows), the --config
argument matters. If you pass an invalid parameter as the config type here, the build tool should give an error.
If the build tool isn’t multi-config (like gcc), then the --config
argument is ignored. Instead the build type is set via the CMAKE_BUILD_TYPE
CMake variable; i.e. it’s set when running CMake, not when running the build tool.
so to build a debug version using gcc, we could:
c_debug=”Debug” # or “Release”
cmake -DCMAKE_BUILD_TYPE=$c_debug –build .
cmake –build .
sudo cmake –build . –target install
To check if debug symbol is build or not, we could check:
objdump –syms yourlib.a|orlib.so | grep debug
it should show something.
Notes: using file your.so | grep stripped to check if debug symbol build or not is NOT correct.