diff --git a/papi-config.patch b/papi-config.patch new file mode 100644 index 0000000..9b34cf5 --- /dev/null +++ b/papi-config.patch @@ -0,0 +1,348 @@ +commit 38290c41abbb105ca198411ec3c466ac027f5b8f +Author: Frank Winkler +Date: Fri Apr 24 16:18:22 2020 +0200 + + Fixed configure options for shared and static builds. + + 1) --with-static-lib=no (force PAPI to build shared libraries and tools) + 2) --with-shlib-tools (use internal libpfm via rpath-link) + +diff --git a/src/configure.in b/src/configure.in +index 3cf47edc1..1f58f7c8e 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -200,9 +200,13 @@ else + AC_MSG_ERROR([cannot find dlopen and dlerror symbols neither in the base system libraries nor in -ldl]) + fi + fi ++ ++# Disable LDL for static builds ++# if test "x${STATIC}" = "x"; then ++# LDL="" ++# fi + AC_SUBST(LDL) +- +- ++ + if test "$OS" = "CLE"; then + virtualtimer=times + tls=__thread +@@ -827,10 +831,6 @@ AC_ARG_WITH(static_tools, + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) + +-if test "$static_lib" = "no"; then +- AC_MSG_ERROR(Building tests and utilities static but no static papi library to be built) +-fi +- + AC_MSG_CHECKING(for linking with papi shared library of tests and utilities) + AC_ARG_WITH(shlib_tools, + [ --with-shlib-tools Specify linking with papi library of tests and utilities], +@@ -839,6 +839,14 @@ AC_ARG_WITH(shlib_tools, + [shlib_tools=no + AC_MSG_RESULT(no)]) + ++if test "$static_lib" = "no"; then ++ shlib_tools=yes ++fi ++ ++if test "$static_lib" = "no" -a "$shlib_tools" = "no"; then ++ AC_MSG_ERROR(Building tests and utilities static but no static papi library to be built) ++fi ++ + if test "$shlib_tools" = "yes"; then + if test "$shared_lib" != "yes"; then + AC_MSG_ERROR(Building static but specified shared linking for tests and utilities) +@@ -847,6 +855,8 @@ if test "$shlib_tools" = "yes"; then + AC_MSG_ERROR([Building shared but specified static linking]) + fi + LINKLIB='$(SHLIB)' ++ #WORKAROUND: if libpfm cannot be found at link time ++ LDFLAGS="$LDFLAGS -Wl,-rpath-link,$PWD/libpfm4/lib" + elif test "$shlib_tools" = "no"; then + if test "$static_lib" != "yes"; then + AC_MSG_ERROR([Building shared but specified static linking for tests and utilities]) +commit d6f4e34d083f18cfdba38dd5e4bbfb2a580b8a9e +Author: Frank Winkler +Date: Fri Apr 24 16:38:18 2020 +0200 + + Another test for "--with-static-tools". + +diff --git a/src/configure.in b/src/configure.in +index 1f58f7c8e..e8d769578 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -201,10 +201,6 @@ else + fi + fi + +-# Disable LDL for static builds +-# if test "x${STATIC}" = "x"; then +-# LDL="" +-# fi + AC_SUBST(LDL) + + if test "$OS" = "CLE"; then +@@ -831,6 +827,11 @@ AC_ARG_WITH(static_tools, + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) + ++# Disable LDL for static builds ++# if test "$STATIC" = "-static"; then ++# LDL="" ++# fi ++ + AC_MSG_CHECKING(for linking with papi shared library of tests and utilities) + AC_ARG_WITH(shlib_tools, + [ --with-shlib-tools Specify linking with papi library of tests and utilities], +commit 1c333c9954b872cda1b4d873fa81b14ec58a58a7 +Author: Frank Winkler +Date: Thu Apr 30 18:51:34 2020 +0200 + + Fixed static build. + - SDE component is disabled + - "ctest" shlib is disabled + +diff --git a/src/configure.in b/src/configure.in +index e8d769578..0eee98ea1 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -827,10 +827,11 @@ AC_ARG_WITH(static_tools, + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) + +-# Disable LDL for static builds +-# if test "$STATIC" = "-static"; then +-# LDL="" +-# fi ++# Disable LDL AND SDE for static builds ++if test "$STATIC" = "-static"; then ++ LDL="" ++ SDE_ENABLED= ++fi + + AC_MSG_CHECKING(for linking with papi shared library of tests and utilities) + AC_ARG_WITH(shlib_tools, +@@ -1768,6 +1769,7 @@ for comp in $components; do + if test "x$comp" = "xsde" ; then + LDFLAGS="$LDFLAGS $LRT" + LIBS="$LIBS $LRT" ++ SDE_ENABLED=1 + fi + done + +@@ -1862,6 +1864,7 @@ AC_SUBST(BGP_SYSDIR) + AC_SUBST(BITFLAGS) + AC_SUBST(COMPONENT_RULES) + AC_SUBST(COMPONENTS) ++AC_SUBST(SDE_ENABLED) + AC_SUBST(FTEST_TARGETS) + AC_SUBST(HAVE_NO_OVERRIDE_INIT) + AC_SUBST(BGPM_INSTALL_DIR) +diff --git a/src/ctests/Makefile.recipies b/src/ctests/Makefile.recipies +index b7c1963d7..44e19b398 100644 +--- a/src/ctests/Makefile.recipies ++++ b/src/ctests/Makefile.recipies +@@ -11,7 +11,11 @@ MPX = max_multiplex multiplex1 multiplex2 mendes-alt sdsc-mpx sdsc2-mpx \ + MPXPTHR = multiplex1_pthreads multiplex3_pthreads kufrin + MPI = mpi_hl mpi_omp_hl \ + mpifirst ++ ++ifeq ($(STATIC),) + SHARED = shlib ++endif ++ + SERIAL = serial_hl serial_hl_ll_comb\ + all_events all_native_events branches calibrate case1 case2 \ + cmpinfo code2name derived describe destroy disable_component \ +@@ -344,8 +348,10 @@ case2: case2.c $(TESTLIB) $(PAPILIB) + low-level: low-level.c $(TESTLIB) $(DOLOOPS) $(PAPILIB) + $(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) low-level.c $(TESTLIB) $(DOLOOPS) $(PAPILIB) $(LDFLAGS) -o low-level + ++ifeq ($(STATIC),) + shlib: shlib.c $(TESTLIB) $(PAPILIB) + $(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) shlib.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o shlib $(LDL) ++endif + + exeinfo: exeinfo.c $(TESTLIB) $(PAPILIB) + -$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) exeinfo.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o exeinfo +diff --git a/src/ctests/Makefile.target.in b/src/ctests/Makefile.target.in +index edc04f1b7..af64e157c 100644 +--- a/src/ctests/Makefile.target.in ++++ b/src/ctests/Makefile.target.in +@@ -10,6 +10,7 @@ INCLUDE = -I. -I@includedir@ -I$(testlibdir) -I$(validationlibdir) + LIBDIR = @libdir@ + LIBRARY = @LIBRARY@ + SHLIB = @SHLIB@ ++STATIC = @STATIC@ + PAPILIB = ../@LINKLIB@ + TESTLIB = $(testlibdir)/libtestlib.a + LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@ +diff --git a/src/utils/Makefile b/src/utils/Makefile +index 4abfd6cb8..64a2b8f9f 100644 +--- a/src/utils/Makefile ++++ b/src/utils/Makefile +@@ -48,8 +48,13 @@ papi_mem_info: papi_mem_info.o $(PAPILIB) + papi_multiplex_cost: papi_multiplex_cost.o $(PAPILIB) cost_utils.o + $(CC) -o papi_multiplex_cost papi_multiplex_cost.o cost_utils.o $(PAPILIB) -lm $(LDFLAGS) + ++ifneq ($(SDE_ENABLED),) + papi_native_avail: papi_native_avail.o $(PAPILIB) print_header.o papi_sde_interface.o + $(CC) -o papi_native_avail papi_native_avail.o $(PAPILIB) print_header.o $(LDFLAGS) papi_sde_interface.o ++else ++papi_native_avail: papi_native_avail.o $(PAPILIB) print_header.o ++ $(CC) -o papi_native_avail papi_native_avail.o $(PAPILIB) print_header.o $(LDFLAGS) ++endif + + papi_version: papi_version.o $(PAPILIB) + $(CC) -o papi_version papi_version.o $(PAPILIB) $(LDFLAGS) +@@ -65,8 +70,10 @@ cost_utils.o: ../testlib/papi_test.h cost_utils.c + print_header.o: print_header.h print_header.c + $(CC) $(INCLUDE) $(CFLAGS) $(OPTFLAGS) -c print_header.c + ++ifneq ($(SDE_ENABLED),) + papi_sde_interface.o: papi_sde_interface.c + $(CC) $(INCLUDE) $(CFLAGS) $(OPTFLAGS) -c papi_sde_interface.c ++endif + + clean: + rm -f *.o *.stderr *.stdout core *~ $(ALL) +diff --git a/src/utils/Makefile.target.in b/src/utils/Makefile.target.in +index bcdbe94e9..9c76b37af 100644 +--- a/src/utils/Makefile.target.in ++++ b/src/utils/Makefile.target.in +@@ -9,6 +9,7 @@ INCLUDE = -I. -I@includedir@ -I$(testlibdir) + LIBDIR = @libdir@ + LIBRARY = @LIBRARY@ + SHLIB = @SHLIB@ ++SDE_ENABLED = @SDE_ENABLED@ + PAPILIB = ../@LINKLIB@ + TESTLIB = $(testlibdir)/libtestlib.a + LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@ +diff --git a/src/utils/papi_native_avail.c b/src/utils/papi_native_avail.c +index ae6dbb9e5..902ed7996 100644 +--- a/src/utils/papi_native_avail.c ++++ b/src/utils/papi_native_avail.c +@@ -51,8 +51,9 @@ + + #include "papi.h" + #include "print_header.h" ++#ifdef SDE_ENABLED + #include "components/sde/interface/papi_sde_interface.h" +- ++#endif + #define EVT_LINE 80 + #define EVT_LINE_BUF_SIZE 4096 + +@@ -84,7 +85,9 @@ print_help( char **argv ) + printf( "\nGeneral command options:\n" ); + printf( "\t-h, --help print this help message\n" ); + printf( "\t-c, --check attempts to add each event\n"); ++#ifdef SDE_ENABLED + printf( "\t-sde FILE lists SDEs that are registered by the library or executable in FILE\n" ); ++#endif + printf( "\t-e EVENTNAME display detailed information about named native event\n" ); + printf( "\t-i EVENTSTR include only event names that contain EVENTSTR\n" ); + printf( "\t-x EVENTSTR exclude any event names that contain EVENTSTR\n" ); +@@ -368,6 +371,7 @@ parse_event_qualifiers( PAPI_event_info_t * info ) + return ( 1 ); + } + ++#ifdef SDE_ENABLED + void + invoke_hook_fptr( char *lib_path ) + { +@@ -394,6 +398,7 @@ invoke_hook_fptr( char *lib_path ) + dlclose(dl_handle); + return; + } ++#endif + + int + main( int argc, char **argv ) +@@ -444,6 +449,7 @@ main( int argc, char **argv ) + return 2; + } + ++#ifdef SDE_ENABLED + /* + The following code will execute if the user wants to list the SDEs in the + library (or executable) stored in flags.path. This code will not list the +@@ -514,6 +520,7 @@ skip_lib: + if( NULL != cmd ) free(cmd); + } + no_sdes: ++#endif //SDE_ENABLED + + /* Do this code if the event name option was specified on the commandline */ + if ( flags.named ) { +commit b5111efaf1b234541c94b8ef7e5791bf8eb094b3 +Author: Frank Winkler +Date: Thu May 7 09:00:53 2020 +0200 + + Added CFLAG -DSDE. + +diff --git a/src/configure.in b/src/configure.in +index 0eee98ea1..781148e5b 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -1767,6 +1767,7 @@ tests="$tests comp_tests" + # check for SDE component to determine if we need -lrt in LDFLAGS + for comp in $components; do + if test "x$comp" = "xsde" ; then ++ CFLAGS="$CFLAGS -DSDE" + LDFLAGS="$LDFLAGS $LRT" + LIBS="$LIBS $LRT" + SDE_ENABLED=1 +diff --git a/src/utils/papi_native_avail.c b/src/utils/papi_native_avail.c +index 902ed7996..7d90c4064 100644 +--- a/src/utils/papi_native_avail.c ++++ b/src/utils/papi_native_avail.c +@@ -51,9 +51,10 @@ + + #include "papi.h" + #include "print_header.h" +-#ifdef SDE_ENABLED ++#if SDE + #include "components/sde/interface/papi_sde_interface.h" + #endif ++ + #define EVT_LINE 80 + #define EVT_LINE_BUF_SIZE 4096 + +@@ -85,7 +86,7 @@ print_help( char **argv ) + printf( "\nGeneral command options:\n" ); + printf( "\t-h, --help print this help message\n" ); + printf( "\t-c, --check attempts to add each event\n"); +-#ifdef SDE_ENABLED ++#if SDE + printf( "\t-sde FILE lists SDEs that are registered by the library or executable in FILE\n" ); + #endif + printf( "\t-e EVENTNAME display detailed information about named native event\n" ); +@@ -371,7 +372,7 @@ parse_event_qualifiers( PAPI_event_info_t * info ) + return ( 1 ); + } + +-#ifdef SDE_ENABLED ++#if SDE + void + invoke_hook_fptr( char *lib_path ) + { +@@ -449,7 +450,7 @@ main( int argc, char **argv ) + return 2; + } + +-#ifdef SDE_ENABLED ++#if SDE + /* + The following code will execute if the user wants to list the SDEs in the + library (or executable) stored in flags.path. This code will not list the +@@ -520,7 +521,7 @@ skip_lib: + if( NULL != cmd ) free(cmd); + } + no_sdes: +-#endif //SDE_ENABLED ++#endif //SDE + + /* Do this code if the event name option was specified on the commandline */ + if ( flags.named ) { diff --git a/papi-nostatic.patch b/papi-nostatic.patch new file mode 100644 index 0000000..435aa5e --- /dev/null +++ b/papi-nostatic.patch @@ -0,0 +1,30 @@ +commit cc34c978778adb40df1a200059a31c8d628b10ee +Author: William Cohen +Date: Thu Jan 21 14:48:01 2021 -0500 + + Only check for libpfm.a if static libraries are being used. + + Even when static libraries are not be used papi was checking for + libpfm.a, this would cause a failure if libpfm.a wasn't installed. + Exclude checking for libpfm.a if no static libpfm library is needed. + +diff --git a/src/Rules.pfm4_pe b/src/Rules.pfm4_pe +index 61eedc8a3..65a9635c6 100644 +--- a/src/Rules.pfm4_pe ++++ b/src/Rules.pfm4_pe +@@ -32,6 +32,7 @@ ifeq (yes,$(MIC)) + FORCE_PFM_ARCH="CONFIG_PFMLIB_ARCH_X86=y" + endif + ++ifneq (,$(STATIC)) + ifeq (,$(PFM_OBJS)) + $(PFM_LIB_PATH)/libpfm.a: + ifneq (,${PFM_ROOT}) +@@ -49,6 +50,7 @@ else + endif + $(MAKE) + endif ++endif + + include Makefile.inc + diff --git a/papi.spec b/papi.spec index 04adb5f..307d5b0 100644 --- a/papi.spec +++ b/papi.spec @@ -1,3 +1,5 @@ +# Default to no static libraries +%{!?with_static: %global with_static 0} %bcond_with bundled_libpfm # rdma is not available %ifarch %{arm} @@ -9,7 +11,7 @@ Summary: Performance Application Programming Interface Name: papi Version: 6.0.0 -Release: 5%{?dist} +Release: 7%{?dist} License: BSD Requires: papi-libs = %{version}-%{release} URL: http://icl.cs.utk.edu/papi/ @@ -17,6 +19,9 @@ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz Patch1: papi-python3.patch Patch2: papi-a64fx.patch Patch3: papi-no-iozone.patch +Patch4: papi-config.patch +Patch5: papi-nostatic.patch +BuildRequires: make BuildRequires: autoconf BuildRequires: doxygen BuildRequires: ncurses-devel @@ -26,8 +31,10 @@ BuildRequires: chrpath BuildRequires: lm_sensors-devel %if %{without bundled_libpfm} BuildRequires: libpfm-devel >= 4.6.0-1 +%if %{with_static} BuildRequires: libpfm-static >= 4.6.0-1 %endif +%endif # Following required for net component BuildRequires: net-tools %if %{with_rdma} @@ -70,18 +77,22 @@ Requires: papi-libs = %{version}-%{release} PAPI-testsuite includes compiled versions of papi tests to ensure that PAPI functions on particular hardware. +%if %{with_static} %package static Summary: Static libraries for the compiling programs with PAPI Requires: papi = %{version}-%{release} %description static PAPI-static includes the static versions of the library files for the PAPI user-space libraries and interfaces. +%endif %prep %setup -q %patch1 -p1 -b .python3 %patch2 -p1 -b .a64fx %patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build # This package fails to build with LTO due to undefined symbols. LTO @@ -95,6 +106,12 @@ the PAPI user-space libraries and interfaces. %global libpfm_config --with-pfm-incdir=%{_includedir} --with-pfm-libdir=%{_libdir} %endif +%if %{with_static} +%global static_lib_config --with-static-lib=yes +%else +%global static_lib_config --with-static-lib=no +%endif + # set up environment variable for the various components # cuda # host_micpower @@ -113,8 +130,9 @@ cd src autoconf %configure --with-perf-events \ %{?libpfm_config} \ ---with-static-lib=yes --with-shared-lib=yes --with-shlib --with-shlib-tools \ ---with-components="appio coretemp example infiniband lmsensors lustre micpower mx net %{?pcp_enable} rapl sde stealtime" +%{?static_lib_config} \ +--with-shared-lib=yes --with-shlib --with-shlib-tools \ +--with-components="appio coretemp example infiniband lmsensors lustre micpower mx net %{?pcp_enable} rapl stealtime" # implicit enabled components: perf_event perf_event_uncore #components currently left out because of build configure/build issues # --with-components="bgpm coretemp_freebsd cuda host_micpower nvml vmware" @@ -166,10 +184,18 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so* /usr/share/papi/components /usr/share/papi/testlib +%if %{with_static} %files static %{_libdir}/*.a +%endif %changelog +* Thu Jan 28 2021 William Cohen - 6.0.0-7 +- By default disable genaration of static libraries. + +* Tue Jan 26 2021 Fedora Release Engineering - 6.0.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Thu Dec 17 2020 William Cohen - 6.0.0-5 - Remove iozone source code. (#1901077)