[Darshan-users] Compilation problems when using darshan-log-format.h in C++
Snyder, Shane
ssnyder at mcs.anl.gov
Fri Jan 24 15:28:42 CST 2020
Thanks for sharing this with us, Francois. I don't think we've had many users writing C++ analysis routines for Darshan logs, so probably explains why we haven't ran into this yet.
I went ahead and pushed your fix to the master branch and we'll include it in our next release.
Let us know if you have any more issues!
--Shane
On 1/23/20 6:39 AM, François Trahay wrote:
Hello,
I'm working on a C++ software that reads darshan files, and I face a compilation problem when compiling with g++. You can reproduce the problem with test_darshan-log-format.cpp:
$ cat test_darshan-log-format.cpp:
extern "C"
{
#include <darshan-log-format.h>
}
$ g++ -c test_darshan-log-format.cpp -I/home/trahay/Soft/opt/darshan/darshan-util/install/include
In file included from test_darshan-log-format.cpp:3:
/home/trahay/Soft/opt/darshan/darshan-util/install/include/darshan-log-format.h:135:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
135 | X(DARSHAN_NULL_MOD, "NULL", DARSHAN_NULL_VER, NULL) \
| ^~~~~~
/home/trahay/Soft/opt/darshan/darshan-util/install/include/darshan-log-format.h:161:23: note: in definition of macro ‘X’
161 | #define X(a, b, c, d) b,
| ^
/home/trahay/Soft/opt/darshan/darshan-util/install/include/darshan-log-format.h:164:5: note: in expansion of macro ‘DARSHAN_MODULE_IDS’
164 | DARSHAN_MODULE_IDS
| ^~~~~~~~~~~~~~~~~~
[...]
The problem comes from darshan-log-format.h that defines "static char * const darshan_module_names[]" instead of "static const char * const darshan_module_names[]".
The attached patch fixes the problem.
François
_______________________________________________
Darshan-users mailing list
Darshan-users at lists.mcs.anl.gov<mailto:Darshan-users at lists.mcs.anl.gov>
https://lists.mcs.anl.gov/mailman/listinfo/darshan-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-users/attachments/20200124/f9571076/attachment.html>
More information about the Darshan-users
mailing list