Skip to content

Commit 5ee270a

Browse files
committed
install: Run ldconfig when installing on Unix. Closes #15596.
If ldconfig fails it emits a warning. This is very possible when installing to a non-system directory, so the warning tries to indicate that it may not be a problem.
1 parent ad82cb5 commit 5ee270a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/etc/install.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,11 @@ elif [ "$CFG_OSTYPE" = "Darwin" ]
293293
then
294294
CFG_LD_PATH_VAR=DYLD_LIBRARY_PATH
295295
CFG_OLD_LD_PATH_VAR=$DYLD_LIBRARY_PATH
296+
UNIX=1
296297
else
297298
CFG_LD_PATH_VAR=LD_LIBRARY_PATH
298299
CFG_OLD_LD_PATH_VAR=$LD_LIBRARY_PATH
300+
UNIX=1
299301
fi
300302

301303
flag uninstall "only uninstall from the installation prefix"
@@ -466,6 +468,17 @@ while read p; do
466468
# The manifest lists all files to install
467469
done < "${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}/rustlib/manifest.in"
468470

471+
# Run ldconfig to make dynamic libraries available to the linker
472+
if [ $UNIX -eq 1 ]
473+
then
474+
ldconfig
475+
if [ $? -ne 0 ]
476+
then
477+
warn "failed to run ldconfig."
478+
warn "this may happen when not installing as root, in which case you know what you are doing and it's probably fine."
479+
fi
480+
fi
481+
469482
# Sanity check: can we run the installed binaries?
470483
#
471484
# As with the verification above, make sure the right LD_LIBRARY_PATH-equivalent
@@ -494,7 +507,6 @@ then
494507
fi
495508
fi
496509

497-
498510
echo
499511
echo " Rust is ready to roll."
500512
echo

0 commit comments

Comments
 (0)