This problem comes from our PAPI list, but is a pfmlib problem when compiling with IBM XL C/C++. I investigated it.
First, this is a real problem that prevents creating libpfm.so. Second, I found no clean workaround (other than using gcc instead of xlC), but there is a way to create a functional lib using xlC. The line of code that causes the error in pfmlib.h:29 is #pragma GCC visibility push (default) The error report is as follows; The attribute " __attribute__((visibility("default")))" is not a valid type attribute. The attribute is ignored. The error number given by xlC is 1540-0081. The problem was reported for xlC 16.01, I did not have that and tested on our latest beta version, xlC 16.1.1-beta6. Experiments show the compiler will not recognize any valid attribute. Those are [default, protected, hidden, internal], they all get 1540-0081. This is an error that does not occur when compiling with GCC; it interprets the lines correctly, and they have the desired effect (making function names in the library hidden or visible when using the linux "nm" utility, specifically "nm -C -D libpfm4.so"). Searching the web for ways to deal with error 1540-0081, we found it has been produced by a compiler bug in another problem. For those, IBM says compile with the -qsuppress=1540-0081 flag. We tried that here; and although the xlC compiler accepted the flag, it did not fix our problem. Failing that, the only way I found to produce a usable lib was by deleting the #pragmas and changing the compile flag -fvisibility. There were three header files to modify: perf_event.h, pfmlib.h, pfmlib_perf_event.h. There are two lines in each to comment out; a ;'push' and a 'pop'. This is the grep I used to find them: ~/papi/src/libpfm4$ grep "#pragma GCC visibility" -H -n -r --include="*" The following is the result: include/perfmon/perf_event.h:25:#pragma GCC visibility push(default) include/perfmon/perf_event.h:618:#pragma GCC visibility pop include/perfmon/pfmlib.h:29:#pragma GCC visibility push(default) include/perfmon/pfmlib.h:787:#pragma GCC visibility pop include/perfmon/pfmlib_perf_event.h:28:#pragma GCC visibility push(default) include/perfmon/pfmlib_perf_event.h:66:#pragma GCC visibility pop I also modified the pfmlib4/lib/Makefile, line 36 reads: CFLAGS+=-D_REENTRANT -I. -fvisibility=hidden and the 'hidden' needs to be changed to 'default': We can't make every function hidden! CFLAGS+=-D_REENTRANT -I. -fvisibility=default This had no compile errors using xlC, and produced a libpfm.so with a lot of routines visible that are not visible when compiled with GCC, but all the ones GCC made visible are also visible in the xlC versionof the lib. The size of the xlC produced lib is virtually the same as the GCC lib. (gcc=1,377,120 bytes, xlC=1,377,680 bytes. 560 bytes more). I have no prior experience with xlC, so there may be a more elegant method of doing this. However, I believe the syntax of the #pragma's is correct, and since they work as written for gcc, I suspect an xlC compiler error. It might not exist in other versions of xlC, or may be corrected in future versions. Tony C.
_______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel