<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi all,<br>
<br>
I want to extract the GNU build-id which is creates by the linker
using -Wl,--build-id.<br>
In a BASH script I can do it this way:<br>
BUILD_ID=`readelf -n demo.debug | grep "Build ID:" | sed -e
's/.*\([a-f0-9]\{40\}\).*/\1/g'`<br>
<br>
But I'm not sure I can do that with CMake.<br>
<br>
Actually I'm working on a cmake file which provides me
split_debug_info and install_debug_info functions.<br>
That's what I have currently, but as you can see in the TODOs some
parts are missing at the moment.<br>
<br>
# find path to git executable<br>
find_program(OBJCOPY objcopy)<br>
find_program(STRIP strip)<br>
set(SYMBOLDIR "/mnt/symbols")<br>
<br>
function(split_debug_info _target)<br>
get_target_property(filename ${_target} LOCATION)<br>
add_custom_target(splitdebug<br>
COMMAND ${OBJCOPY} --only-keep-debug ${filename}
${filename}.debug<br>
COMMAND ${STRIP} -g ${filename})<br>
endfunction()<br>
<br>
function(install_debug_info _target)<br>
get_target_property(filename ${_target} LOCATION)<br>
get_filename_component(basename ${filename}.debug NAME)<br>
# TODO: get BUILDID from ${filename}.debug<br>
SET(BUILDID "1234567890")<br>
STRING(SUBSTRING "${BUILDID}" 0 2 BUILDIDPREFIX)<br>
STRING(SUBSTRING "${BUILDID}" 2 38 BUILDIDSUFFIX)<br>
# install file in product structure<br>
add_custom_target(installdebugsymbols<br>
COMMAND ${CMAKE_COMMAND} -E copy ${filename}.debug<br>
${SYMBOLDIR}/${PRODUCTNAME}/${VERSION}/${basename})<br>
# create symlink in /mnt/symbols/.build-id/nn/nnnnnnnn.debug<br>
# TODO: ln -s ${SYMBOLDIR}/${PRODUCTNAME}/${VERSION}/${basename}<br>
#
${SYMBOLDIR}/.build-id/${BUILDIDPREFIX}/${BUILDIDSUFFIX}.debug<br>
endfunction()<br>
<br>
<br>
<br>
<div class="moz-signature">-- <br>
<br>
mit freundlichen Grüßen / best regards<br>
<br>
<b>Gerhard Gappmeier</b><br>
ascolab GmbH - automation systems communication laboratory<br>
Tel.: +49 9131 691 123<br>
Fax: +49 9131 691 128<br>
Web: <a class="moz-txt-link-freetext" href="http://www.ascolab.com">http://www.ascolab.com</a><br>
GPG-KeyId: 5AAC50C4<br>
GPG-Fingerprint: 967A 15F1 2788 164D CCA3 6C46 07CD 6F82 5AAC 50C4<br>
<p style="font-family: helvetica; font-size: 8pt">
--<br>
<b>ascolab GmbH</b><br>
Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe
Steinkrauß<br>
Sitz der Gesellschaft: Am Weichselgarten 7 • 91058 Erlangen •
Germany<br>
Registernummer: HRB 9360<br>
Registergericht: Amtsgericht Fürth<br>
</p>
</div>
</body>
</html>