<html>#2183: PAPI fails to compile with gcc 8
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Roland Haas</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>invalid</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td>development version</td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

<p>Changes (by Roland Haas):</p>
<p><table>
<tr><td>status:</td><td>invalid (was new)</td></tr>
</table></p>
<p>gcc8 includes a warning when a string format may not fit into its buffer in sprintf calls:</p>
<div class="codehilite"><pre><span></span>gcc  -Wno-override-init  -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/data/rhaas/postdoc/gr/cactus/ET_trunk/arrangements/ExternalLibraries/PAPI/dist/papi-5.3.0/src/libpfm4/lib/../include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -D_REENTRANT -I. -DCONFIG_PFMLIB_ARCH_X86 -DCONFIG_PFMLIB_ARCH_X86_64 -I. -c pfmlib_perf_event_pmu.c
pfmlib_perf_event_pmu.c: In function ‘gen_tracepoint_table’:
pfmlib_perf_event_pmu.c:349:36: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=]
   snprintf(d2path, MAXPATHLEN, &quot;%s/%s&quot;, debugfs_mnt, d1-&gt;d_name);
</pre></div>


<p>and since PAPI hard-codes an option <code>-Werror</code> it fails to compile. The same issue persists with PAPI 5.6.0 which seems to be the newest version for which a tarball is available.</p>
<p>A workaround would be to patch out the <code>-Werror</code> option, which is annoying on a production system anyway, or to try and only selectively disable the buffer warning.</p>
<p><strong>Keyword:</strong> PAPI</p>
<p>Comment (by Roland Haas):</p>
<p>This seems to (no longer) happen with papi 5.3.0 and gcc8 or gcc9. No idea why, as there are still warnings while compiling.</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2183/papi-fails-to-compile-with-gcc-8'>https://bitbucket.org/einsteintoolkit/tickets/issues/2183/papi-fails-to-compile-with-gcc-8</a></p>
</html>