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 ) {