@@ -285,6 +285,19 @@ then
285
285
CFG_LIBDIR_RELATIVE=bin
286
286
fi
287
287
288
+ if [ " $CFG_OSTYPE " = " pc-mingw32" ] || [ " $CFG_OSTYPE " = " w64-mingw32" ]
289
+ then
290
+ CFG_LD_PATH_VAR=PATH
291
+ CFG_OLD_LD_PATH_VAR=$PATH
292
+ elif [ " $CFG_OSTYPE " = " Darwin" ]
293
+ then
294
+ CFG_LD_PATH_VAR=DYLD_LIBRARY_PATH
295
+ CFG_OLD_LD_PATH_VAR=$DYLD_LIBRARY_PATH
296
+ else
297
+ CFG_LD_PATH_VAR=LD_LIBRARY_PATH
298
+ CFG_OLD_LD_PATH_VAR=$LD_LIBRARY_PATH
299
+ fi
300
+
288
301
flag uninstall " only uninstall from the installation prefix"
289
302
opt verify 1 " verify that the installed binaries run correctly"
290
303
valopt prefix " /usr/local" " set installation prefix"
@@ -312,11 +325,13 @@ then
312
325
if [ -z " ${CFG_UNINSTALL} " ]
313
326
then
314
327
msg " verifying platform can run binaries"
328
+ export $CFG_LD_PATH_VAR =" ${CFG_SRC_DIR} /lib" :$CFG_OLD_LD_PATH_VAR
315
329
" ${CFG_SRC_DIR} /bin/rustc" --version > /dev/null
316
330
if [ $? -ne 0 ]
317
331
then
318
332
err " can't execute rustc binary on this platform"
319
333
fi
334
+ export $CFG_LD_PATH_VAR =$CFG_OLD_LD_PATH_VAR
320
335
fi
321
336
fi
322
337
@@ -452,17 +467,31 @@ while read p; do
452
467
done < " ${CFG_SRC_DIR} /${CFG_LIBDIR_RELATIVE} /rustlib/manifest.in"
453
468
454
469
# Sanity check: can we run the installed binaries?
470
+ #
471
+ # As with the verification above, make sure the right LD_LIBRARY_PATH-equivalent
472
+ # is in place. Try first without this variable, and if that fails try again with
473
+ # the variable. If the second time tries, print a hopefully helpful message to
474
+ # add something to the appropriate environment variable.
455
475
if [ -z " ${CFG_DISABLE_VERIFY} " ]
456
476
then
457
477
msg " verifying installed binaries are executable"
458
- " ${CFG_PREFIX} /bin/rustc" --version > /dev/null
478
+ " ${CFG_PREFIX} /bin/rustc" --version 2> /dev/null 1 > /dev/null
459
479
if [ $? -ne 0 ]
460
480
then
461
- ERR=" can't execute installed rustc binary. "
462
- ERR=" ${ERR} installation may be broken. "
463
- ERR=" ${ERR} if this is expected then rerun install.sh with \` --disable-verify\` "
464
- ERR=" ${ERR} or \` make install\` with \` --disable-verify-install\` "
465
- err " ${ERR} "
481
+ export $CFG_LD_PATH_VAR =" ${CFG_PREFIX} /lib" :$CFG_OLD_LD_PATH_VAR
482
+ " ${CFG_PREFIX} /bin/rustc" --version > /dev/null
483
+ if [ $? -ne 0 ]
484
+ then
485
+ ERR=" can't execute installed rustc binary. "
486
+ ERR=" ${ERR} installation may be broken. "
487
+ ERR=" ${ERR} if this is expected then rerun install.sh with \` --disable-verify\` "
488
+ ERR=" ${ERR} or \` make install\` with \` --disable-verify-install\` "
489
+ err " ${ERR} "
490
+ else
491
+ echo
492
+ echo " please ensure '${CFG_PREFIX} /lib' is added to ${CFG_LD_PATH_VAR} "
493
+ echo
494
+ fi
466
495
fi
467
496
fi
468
497
0 commit comments