|
38 | 38 | #ifdef HAVE_SYS_STAT_H
|
39 | 39 | # include <sys/stat.h>
|
40 | 40 | #endif
|
| 41 | +#ifdef HAVE_STRING_H |
| 42 | +#include <string.h> |
| 43 | +#endif |
41 | 44 |
|
42 | 45 | #include "src/util/error.h"
|
43 | 46 | #include "src/util/error_strings.h"
|
@@ -127,16 +130,53 @@ static bool check_exist(char *path)
|
127 | 130 | return false;
|
128 | 131 | }
|
129 | 132 |
|
| 133 | +static void print_error(unsigned major, |
| 134 | + unsigned minor, |
| 135 | + unsigned release) |
| 136 | +{ |
| 137 | + fprintf(stderr, "************************************************\n"); |
| 138 | + fprintf(stderr, "We have detected that the runtime version\n"); |
| 139 | + fprintf(stderr, "of the PMIx library we were given is binary\n"); |
| 140 | + fprintf(stderr, "incompatible with the version we were built against:\n\n"); |
| 141 | + fprintf(stderr, " Runtime: 0x%x%02x%02x\n", major, minor, release); |
| 142 | + fprintf(stderr, " Build: 0x%0x\n\n", PMIX_NUMERIC_VERSION); |
| 143 | + fprintf(stderr, "Please update your LD_LIBRARY_PATH to point\n"); |
| 144 | + fprintf(stderr, "us to the same PMIx version used to build PRRTE.\n"); |
| 145 | + fprintf(stderr, "************************************************\n"); |
| 146 | +} |
| 147 | + |
130 | 148 | int prte_init_minimum(void)
|
131 | 149 | {
|
132 | 150 | int ret;
|
133 | 151 | char *path = NULL;
|
| 152 | + const char *rvers; |
| 153 | + char token[100]; |
| 154 | + unsigned int major, minor, release; |
134 | 155 |
|
135 | 156 | if (min_initialized) {
|
136 | 157 | return PRTE_SUCCESS;
|
137 | 158 | }
|
138 | 159 | min_initialized = true;
|
139 | 160 |
|
| 161 | + /* check to see if the version of PMIx we were given in the |
| 162 | + * library path matches the version we were built against. |
| 163 | + * Because we are using PMIx internals, we cannot support |
| 164 | + * cross version operations from inside of PRRTE. |
| 165 | + */ |
| 166 | + rvers = PMIx_Get_version(); |
| 167 | + ret = sscanf(rvers, "%s %u.%u.%u", token, &major, &minor, &release); |
| 168 | + |
| 169 | + /* check the version triplet - we know that version |
| 170 | + * 5 and above are not runtime compatible with version |
| 171 | + * 4 and below. Since PRRTE has a minimum PMIx requirement |
| 172 | + * in the v4.x series, we only need to check v4 vs 5 |
| 173 | + * and above */ |
| 174 | + if ((PMIX_VERSION_MAJOR > 4 && 4 == major) || |
| 175 | + (PMIX_VERSION_MAJOR == 4 && 5 <= major)) { |
| 176 | + print_error(major, minor, release); |
| 177 | + return PRTE_ERR_SILENT; |
| 178 | + } |
| 179 | + |
140 | 180 | /* carry across the toolname */
|
141 | 181 | pmix_tool_basename = prte_tool_basename;
|
142 | 182 |
|
|
0 commit comments