PAPI fails to compile with gcc 8

Issue #2183 new
Roland Haas created an issue

gcc8 includes a warning when a string format may not fit into its buffer in sprintf calls:

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, "%s/%s", debugfs_mnt, d1->d_name);

and since PAPI hard-codes an option -Werror 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.

A workaround would be to patch out the -Werror option, which is annoying on a production system anyway, or to try and only selectively disable the buffer warning.

Keyword: PAPI

Comments (1)

  1. Federico Cipolletta

    Dear Roland,

    Actually I was trying to run a test on green-prairies at CCRG at RIT, and although I was not having issues during compilation, but at runtime I received an error regarding the In particular I had an error of this kind:

    error while loading shared libraries: cannot open shared objet file: No such file or directory

    In reality, I searched into the cluster and found the in /usr/lib64. On the other hand, also linking this path to the PATH, LD_LIBRARY_PATH and LIBRARY_PATH enviromental variables, did not changed anything.

    At the end, after several trials, I managed to make the simulation run excluding ExternalLibraries/PAPI from the thornlist.

    I don’t know how much this can be related to your issue, but maybe it could be usefule for new users.


    Federico Cipolletta.

  2. Log in to comment