1
1

Per discussion at the Open MPI developer meeting last week:

1. Restore libopen-pal.la, libopen-rte.la, and libmpi.la to be
    separate entities (i.e., don't have libopen-rte.la include
    libopen-pal.la, and don't have libmpi.la include libopen-pal.la).
    Yay!
 1. Consequently, make the wrapper compilers look for flags indicating
    that the user wants to compile statically (currently: -static,
    !--static, -Bstatic, and "-Wl," in front of all of those).  If it
    is, follow a 6-way matrix for determinining which libraries to
    list on the underlying command line.
 1. To support that, add the name of a token static and dynamic
    library to look for in each of the wrapper compiler data files.
 1. Fix a long-standing typo in the opalcc wrapper data file.

This commit was SVN r27662.
Этот коммит содержится в:
Jeff Squyres 2012-12-11 01:46:59 +00:00
родитель a454341e2b
Коммит 97cc916007
12 изменённых файлов: 137 добавлений и 32 удалений

Просмотреть файл

@ -1083,6 +1083,34 @@ LTDL_CONVENIENCE
LT_INIT([dlopen win32-dll])
])
# What's the suffix of shared libraries? Inspired by generated
# Libtool code (even though we don't support several of these
# platforms, there didn't seem to be any harm in leaving in some of
# them, alhtough I did remove some that we have never/will never
# support, like OS/2).
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
OPAL_DYN_LIB_SUFFIX=dll
;;
darwin* | rhapsody*)
OPAL_DYN_LIB_SUFFIX=dylib
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
OPAL_DYN_LIB_SUFFIX=so
;;
*)
OPAL_DYN_LIB_SUFFIX=sl
;;
esac
;;
*)
OPAL_DYN_LIB_SUFFIX=so
;;
esac
AC_SUBST(OPAL_DYN_LIB_SUFFIX)
OPAL_SETUP_LIBLTDL

Просмотреть файл

@ -138,7 +138,7 @@ libmpi_la_LIBADD = \
$(MCA_ompi_FRAMEWORK_LIBS) \
$(OMPI_MPIEXT_C_LIBS) \
$(OMPI_LIBMPI_EXTRA_LIBS) \
$(top_ompi_builddir)/orte/libopen-rte-lt.la
$(top_ompi_builddir)/orte/libopen-rte.la
libmpi_la_DEPENDENCIES = $(libmpi_la_LIBADD)
libmpi_la_LDFLAGS = \
-version-info $(libmpi_so_version) \

Просмотреть файл

@ -18,6 +18,9 @@ compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX@
compiler_flags=@OMPI_WRAPPER_EXTRA_CXXFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
libs=@OMPI_WRAPPER_CXX_LIB@ -lmpi @OMPI_WRAPPER_EXTRA_LIBS@
libs_static=@OMPI_WRAPPER_CXX_LIB@ -lmpi @OMPI_WRAPPER_EXTRA_LIBS@ -lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ -lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libmpi.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libmpi.a
required_file=@OMPI_WRAPPER_CXX_REQUIRED_FILE@
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -18,6 +18,9 @@ compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX@
compiler_flags=@OMPI_WRAPPER_EXTRA_CFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
libs=-lmpi @OMPI_WRAPPER_EXTRA_LIBS@
libs_static=-lmpi @OMPI_WRAPPER_EXTRA_LIBS@ -lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ -lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libmpi.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libmpi.a
required_file=
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -18,6 +18,9 @@ preprocessor_flags=
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
libs=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -lmpi_mpifh -lmpi -lopen-rte -lopen-pal @OMPI_WRAPPER_EXTRA_LIBS@
libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -lmpi_mpifh -lmpi @OMPI_WRAPPER_EXTRA_LIBS@ -lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ -lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libmpi.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libmpi.a
required_file=@OMPI_WRAPPER_FORTRAN_REQUIRED_FILE@
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -86,17 +86,3 @@ include mca/Makefile.am
include win32/Makefile.am
include tools/Makefile.am
include dss/Makefile.am
# Set the convenience library to be the same as the non-convenience
# library, but a) it's marked as "noinst", so LT knows it's a
# convenience library, and b) no .so version number is assigned here.
# Note that we only need to make the convenience library if the ORTE
# project is being built (i.e., if there is an upper layer that needs
# to slurp in OPAL as a convenience library).
if PROJECT_ORTE
noinst_LTLIBRARIES += libopen-pal-lt.la
endif
libopen_pal_lt_la_SOURCES = $(libopen_pal_la_SOURCES)
libopen_pal_lt_la_LIBADD = $(libopen_pal_la_LIBADD)
libopen_pal_lt_la_DEPENDENCIES = $(libopen_pal_la_DEPENDENCIES)

Просмотреть файл

@ -79,6 +79,9 @@ struct options_data_t {
char **comp_flags_prefix;
char **link_flags;
char **libs;
char **libs_static;
char *dyn_lib_file;
char *static_lib_file;
char *req_file;
char *path_includedir;
char *path_libdir;
@ -100,6 +103,7 @@ static int default_data_idx = -1;
#define COMP_WANT_COMPILE 0x010
#define COMP_WANT_LINK 0x020
#define COMP_WANT_PMPI 0x040
#define COMP_WANT_STATIC 0x080
static void
options_data_init(struct options_data_t *data)
@ -124,6 +128,10 @@ options_data_init(struct options_data_t *data)
data->link_flags[0] = NULL;
data->libs = (char **) malloc(sizeof(char*));
data->libs[0] = NULL;
data->libs_static = (char **) malloc(sizeof(char*));
data->libs_static[0] = NULL;
data->dyn_lib_file = NULL;
data->static_lib_file = NULL;
data->req_file = NULL;
data->path_includedir = NULL;
data->path_libdir = NULL;
@ -149,6 +157,9 @@ options_data_free(struct options_data_t *data)
opal_argv_free(data->comp_flags_prefix);
opal_argv_free(data->link_flags);
opal_argv_free(data->libs);
opal_argv_free(data->libs_static);
if (NULL != data->dyn_lib_file) free(data->dyn_lib_file);
if (NULL != data->static_lib_file) free(data->static_lib_file);
if (NULL != data->req_file) free(data->req_file);
if (NULL != data->path_includedir) free(data->path_includedir);
if (NULL != data->path_libdir) free(data->path_libdir);
@ -323,6 +334,16 @@ data_callback(const char *key, const char *value)
opal_argv_count(options_data[parse_options_idx].libs),
values);
opal_argv_free(values);
} else if (0 == strcmp(key, "libs_static")) {
char **values = opal_argv_split(value, ' ');
opal_argv_insert(&options_data[parse_options_idx].libs_static,
opal_argv_count(options_data[parse_options_idx].libs_static),
values);
opal_argv_free(values);
} else if (0 == strcmp(key, "dyn_lib_file")) {
if (NULL != value) options_data[parse_options_idx].dyn_lib_file = strdup(value);
} else if (0 == strcmp(key, "static_lib_file")) {
if (NULL != value) options_data[parse_options_idx].static_lib_file = strdup(value);
} else if (0 == strcmp(key, "required_file")) {
if (NULL != value) options_data[parse_options_idx].req_file = strdup(value);
} else if (0 == strcmp(key, "project_short")) {
@ -696,6 +717,13 @@ main(int argc, char *argv[])
/* remove element from user_argv */
opal_argv_delete(&user_argc, &user_argv, i, 1);
--i;
} else if (0 == strcmp(user_argv[i], "-static") ||
0 == strcmp(user_argv[i], "--static") ||
0 == strcmp(user_argv[i], "-Bstatic") ||
0 == strcmp(user_argv[i], "-Wl,-static") ||
0 == strcmp(user_argv[i], "-Wl,--static") ||
0 == strcmp(user_argv[i], "-Wl,-Bstatic")) {
flags |= COMP_WANT_STATIC;
} else if ('-' != user_argv[i][0]) {
disable_flags = false;
flags |= COMP_SHOW_ERROR;
@ -793,10 +821,66 @@ main(int argc, char *argv[])
/* link flags and libs */
if (flags & COMP_WANT_LINK) {
bool have_static_lib;
bool have_dyn_lib;
bool use_static_libs;
char *filename;
struct stat buf;
opal_argv_insert(&exec_argv, exec_argc, options_data[user_data_idx].link_flags);
exec_argc = opal_argv_count(exec_argv);
opal_argv_insert(&exec_argv, exec_argc, options_data[user_data_idx].libs);
/* Are we linking statically? If so, decide what libraries to
list. It depends on two factors:
1. Was --static (etc.) specified?
2. Does OMPI have static, dynamic, or both libraries installed?
Here's a matrix showing what we'll do in all 6 cases:
What's installed --static no --static
---------------- ---------- -----------
ompi .so libs -lmpi -lmpi
ompi .a libs all all
ompi both libs all -lmpi
*/
filename = opal_os_path( false, options_data[user_data_idx].path_libdir, options_data[user_data_idx].static_lib_file, NULL );
if (0 == stat(filename, &buf)) {
have_static_lib = true;
} else {
have_static_lib = false;
}
filename = opal_os_path( false, options_data[user_data_idx].path_libdir, options_data[user_data_idx].dyn_lib_file, NULL );
if (0 == stat(filename, &buf)) {
have_dyn_lib = true;
} else {
have_dyn_lib = false;
}
/* Determine which set of libs to use: dynamic or static. Be
pedantic to make the code easy to read. */
if (flags & COMP_WANT_STATIC) {
if (have_static_lib) {
use_static_libs = true;
} else {
use_static_libs = false;
}
} else {
if (have_dyn_lib) {
use_static_libs = false;
} else {
use_static_libs = true;
}
}
if (use_static_libs) {
opal_argv_insert(&exec_argv, exec_argc, options_data[user_data_idx].libs_static);
} else {
opal_argv_insert(&exec_argv, exec_argc, options_data[user_data_idx].libs);
}
exec_argc = opal_argv_count(exec_argv);
}

Просмотреть файл

@ -18,6 +18,9 @@ compiler_flags_prefix=@OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX@
compiler_flags=@OPAL_WRAPPER_EXTRA_CXXFLAGS@
linker_flags=@OPAL_WRAPPER_EXTRA_LDFLAGS@
libs=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
libs_static=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libopen-pal.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libopen-pal.a
required_file=
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -11,13 +11,16 @@ version=@OPAL_VERSION@
language=C
compiler_env=CC
compiler_flags_env=CFLAGS
compiler=@OPAL_WRAPPER_CC@
compiler=@WRAPPER_CC@
extra_includes=@OPAL_WRAPPER_EXTRA_INCLUDES@
preprocessor_flags=@OPAL_WRAPPER_EXTRA_CPPFLAGS@
compiler_flags_prefix=@OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX@
compiler_flags=@OPAL_WRAPPER_EXTRA_CFLAGS@
linker_flags=@OPAL_WRAPPER_EXTRA_LDFLAGS@
libs=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
libs_static=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libopen-pal.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libopen-pal.a
required_file=
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -37,7 +37,7 @@ lib_LTLIBRARIES = libopen-rte.la
libopen_rte_la_SOURCES =
libopen_rte_la_LIBADD = \
$(MCA_orte_FRAMEWORK_LIBS) \
$(top_ompi_builddir)/opal/libopen-pal-lt.la
$(top_ompi_builddir)/opal/libopen-pal.la
libopen_rte_la_DEPENDENCIES = $(libopen_rte_la_LIBADD)
libopen_rte_la_LDFLAGS = -version-info $(libopen_rte_so_version)
@ -63,17 +63,3 @@ include tools/Makefile.am
include orted/Makefile.am
include test/mpi/Makefile.include
include test/system/Makefile.include
# Set the convenience library to be the same as the non-convenience
# library, but a) it's marked as "noinst", so LT knows it's a
# convenience library, and b) no .so version number is assigned here.
# Note that we only need to make the convenience library if the OMPI
# project is being built (i.e., if there is an upper layer that needs
# to slurp in ORTE as a convenience library).
if PROJECT_ORTE
noinst_LTLIBRARIES += libopen-rte-lt.la
endif
libopen_rte_lt_la_SOURCES = $(libopen_rte_la_SOURCES)
libopen_rte_lt_la_LIBADD = $(libopen_rte_la_LIBADD)
libopen_rte_lt_la_DEPENDENCIES = $(libopen_rte_la_DEPENDENCIES)

Просмотреть файл

@ -18,6 +18,9 @@ compiler_flags_prefix=@ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX@
compiler_flags=@ORTE_WRAPPER_EXTRA_CXXFLAGS@
linker_flags=@ORTE_WRAPPER_EXTRA_LDFLAGS@
libs=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@
libs_static=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ -lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libopen-rte.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libopen-rte.a
required_file=
includedir=${includedir}
libdir=${libdir}

Просмотреть файл

@ -18,6 +18,9 @@ compiler_flags_prefix=@ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX@
compiler_flags=@ORTE_WRAPPER_EXTRA_CFLAGS@
linker_flags=@ORTE_WRAPPER_EXTRA_LDFLAGS@
libs=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@
libs_static=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ -lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@
dyn_lib_file=libopen-rte.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=libopen-rte.a
required_file=
includedir=${includedir}
libdir=${libdir}