Programowanie w systemie UNIX/depend
Zależności ( ang dependencies)[1]

uaktualnianie systemu[edytuj]
sudo apt-get update sudo apt-get autoremove sudo apt-get install -f
Pierwsze polecenie zaktualizuje listę pakietów, drugie usunie wszystkie pakiety, które nie są już potrzebne, a trzecie polecenie zainstaluje wszystkie pakiety, które są potrzebne innym pakietom, ale jeszcze nie zostały zainstalowane.[4]
Jak narysować graf zależności?[edytuj]
I used grep and sed to extract the include graph of the source code for this project. Then tred (which edits graph specifications to remove transitive edges. i.e, if A->B and B->C and A->C, it'll remove A->C) showed me a few of my includes were redundant. I used dot to draw the dependencies.[5]
Jak sprawdzić zależności?[edytuj]
Biblioteka
- pakiety
- dev
- non-dev
Program[edytuj]
wykonywalny[edytuj]
Za pomocą komendy ldd[6]
ldd /path/to/program
lub bezpieczniej (program ldd może uruchamiać badany program co jest potencjalnie szkodliwe, gdy pochodzi z nieznanego źródła) [7]
objdump -p /path/to/program | grep NEEDED
readelf -d /bin/ls | grep 'NEEDED'
Żródła[edytuj]
Jeśli program był zainstalowany za pomocą autotools to wyszukujemy ( grep) w pliku configure.ac : [10]
- AC_SEARCH_LIBS (
- AC_CHECK_HEADERS
- PKG_CHECK_MODULES
czynny proces[edytuj]
sudo pldd <PID>
sudo pmap <PID>
biblioteki[edytuj]
Biblioteki [11]
dzielone[edytuj]
Lista bibliotek dzielonych ( ang. shared library), pliki z rozszerzeniem "so"
ldconfig -p
Sprawdzamy czy są i jakie wersje maja zainstalowane biblioteki "libname" ( nazwa do zmiany) [12]
ldconfig -v | grep libname
Zależności bibliotek dzielonych[13]
pakiety[edytuj]
W ubuntu :
sudo apt-get build-dep <package>
lub
dpkg -l | grep -i nazwa_paklietu
sudo apt list --installed | grep -i nazwa_pakietu
Pakiety dev: [14]
to build things based on libfoo, you need libfoo-dev
repozytoria pakietów[edytuj]
Lista [15]
- plik /etc/apt/sources.list
- pliki w katalogu /etc/apt/sources.list.d/
sudo grep -rhE ^deb /etc/apt/sources.list*
sudo apt-cache policy
pakiet deb[edytuj]
Zależności pakietu za pomocą apt:
apt-cache showpkg package-name
apt-cache depends package-name
lub apt-file [16]
apt-file search fontconfig/fontconfig.h
lub [17]
dpkg -I package.deb
lub rekursywnie (zależności zależności: "it resolves dependencies recursively, i.e., not only does it show the direct dependencies of a package, but also the dependencies' dependencies.")[18]
apt-rdepends package
odwrotne[edytuj]
Pakiety zależne od pakietu (reverse dependencies):
apt-cache rdepends package-name
Jak uruchomić stary program na nowym systemi ?[edytuj]
- snap[19]
- live OS: uruchomić system bez instalacji za pomoca live CD lub usb
- emulator
- maszyna virtualna[20][21]
Zobacz również[edytuj]
- wikipedia: Piekło zależności
- autoapt[22]
- checkinstall
- autodeb
- biicode is a c/c++ dependency manager.
Źródła[edytuj]
- ↑ askubuntu question: what-are-dependencies
- ↑ stackoverflow question: find-a-directory-in-shared-library-search-path
- ↑ ostechnix: list-dependencies-package-linux
- ↑ askubuntu question: cant-install-several-development-libraries
- ↑ m-trustworthy by Claude
- ↑ man ldd
- ↑ How to check what libraries are used by a program or process on Linux Posted on August 7, 2014 by Dan Nanni
- ↑ unix.stackexchange question how-to-find-out-the-dynamic-libraries-executables-loads-when-run
- ↑ stackoverflow question how-do-i-find-the-direct-shared-object-dependencies-of-a-linux-elf-binary
- ↑ unix.stackexchange question: get-list-of-required-libraries-when-installing-something-from-source
- ↑ yolinux TUTORIAL: LibraryArchives-StaticAndDynamic
- ↑ linuxquestions : bash-command-to-list-installed-libraries-and-version-numbers
- ↑ simplified.guide: linux show-shared-library-dependency
- ↑ stackoverflow question: how-to-install-gtk-development-dependencies-on-ubuntu
- ↑ tecadmin : view-installed-repositories-in-ubuntu
- ↑ apt-file command with examples by Computer Hope
- ↑ askubuntu question how-can-i-check-dependency-list-for-a-deb-package
- ↑ checking-package-dependencies-with-apt-rdepends-on-debian-ubuntu
- ↑ ubuntu blog: how-to-preserve-old-software-with-snaps
- ↑ help.ubuntu : VirtualMachines
- ↑ osboxes : ubuntu
- ↑ AutoApt