@@ -285,6 +285,19 @@ then
285285 CFG_LIBDIR_RELATIVE=bin
286286fi
287287
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+
288301flag uninstall " only uninstall from the installation prefix"
289302opt verify 1 " verify that the installed binaries run correctly"
290303valopt prefix " /usr/local" " set installation prefix"
@@ -312,11 +325,13 @@ then
312325 if [ -z " ${CFG_UNINSTALL} " ]
313326 then
314327 msg " verifying platform can run binaries"
328+ export $CFG_LD_PATH_VAR =" ${CFG_SRC_DIR} /lib" :$CFG_OLD_LD_PATH_VAR
315329 " ${CFG_SRC_DIR} /bin/rustc" --version > /dev/null
316330 if [ $? -ne 0 ]
317331 then
318332 err " can't execute rustc binary on this platform"
319333 fi
334+ export $CFG_LD_PATH_VAR =$CFG_OLD_LD_PATH_VAR
320335 fi
321336fi
322337
@@ -452,17 +467,31 @@ while read p; do
452467done < " ${CFG_SRC_DIR} /${CFG_LIBDIR_RELATIVE} /rustlib/manifest.in"
453468
454469# 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.
455475if [ -z " ${CFG_DISABLE_VERIFY} " ]
456476then
457477 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
459479 if [ $? -ne 0 ]
460480 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
466495 fi
467496fi
468497
0 commit comments