[TOC]
概述
库是已经写好的,成熟的,可以复用的代码。程序员编程的时候都要依赖很多基础的底层库。本质上来说库是一种可执行代码的二进制形式,可以被操作系统载入内存执行。库有两种:静态库(.a、.lib)和动态库(.so、.dll)。
回顾将源程序到可执行程序的过程:
查看静态库连接的外部库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| (base) readelf -d libvision.so
Dynamic section at offset 0x579150 contains 35 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libopencv_calib3d.so.2.4] 0x0000000000000001 (NEEDED) Shared library: [libopencv_highgui.so.2.4] 0x0000000000000001 (NEEDED) Shared library: [libopencv_imgproc.so.2.4] 0x0000000000000001 (NEEDED) Shared library: [libopencv_core.so.2.4] 0x0000000000000001 (NEEDED) Shared library: [libQnnHtp.so] 0x0000000000000001 (NEEDED) Shared library: [libQnnSystem.so] 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000e (SONAME) Library soname: [libvision.so] 0x000000000000001d (RUNPATH) Library runpath: [/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/qnn/v2.5.0/prebuilt/linux-x86_64-debug:/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/qnn/v2.5.0/target/linux-x86_64/lib:/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/flatbuffers/2.0.0/prebuilt/linux-x86_64-debug/v2.5.0:/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/3d-landmark/v6.0/lib/linux-x86_64:/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/lib:/home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/3rdparty:] 0x000000000000000c (INIT) 0x2a2000 0x000000000000000d (FINI) 0x4aeff4 0x0000000000000019 (INIT_ARRAY) 0x574588 0x000000000000001b (INIT_ARRAYSZ) 800 (bytes) 0x000000000000001a (FINI_ARRAY) 0x5748a8 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x260 0x0000000000000005 (STRTAB) 0x999b0 0x0000000000000006 (SYMTAB) 0x26ea0 0x000000000000000a (STRSZ) 1686853 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000003 (PLTGOT) 0x57b000 0x0000000000000002 (PLTRELSZ) 332808 (bytes) 0x0000000000000014 (PLTREL) RELA 0x0000000000000017 (JMPREL) 0x250b90 0x0000000000000007 (RELA) 0x23f1a8 0x0000000000000008 (RELASZ) 72168 (bytes)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| (base) ldd libvision.so linux-vdso.so.1 (0x00007ffdf5f32000) libopencv_calib3d.so.2.4 => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/lib/libopencv_calib3d.so.2.4 (0x00007f37388e5000) libopencv_highgui.so.2.4 => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/lib/libopencv_highgui.so.2.4 (0x00007f37385d1000) libopencv_imgproc.so.2.4 => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/lib/libopencv_imgproc.so.2.4 (0x00007f37380b9000) libopencv_core.so.2.4 => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/opencv/opencv_2.4.13.4/linux-x86_64/lib/libopencv_core.so.2.4 (0x00007f3737c0e000) libQnnHtp.so => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/qnn/v2.5.0/target/linux-x86_64/lib/libQnnHtp.so (0x00007f3734276000) libQnnSystem.so => /home/frewen/02.ProjectSpace/01.WorkSpace/perception-vision-ability/thirdparty/qnn/v2.5.0/target/linux-x86_64/lib/libQnnSystem.so (0x00007f3734064000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3733e67000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3733d18000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3733cfb000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3733b09000) libopencv_features2d.so.2.4 => not found libopencv_flann.so.2.4 => not found libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3733ae6000) libgtk-x11-2.0.so.0 => /lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007f373368a000) libgdk-x11-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007f37335cf000) libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f373356f000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f3733446000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f373343c000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f373341e000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3733418000) libc++.so.1 => /lib/x86_64-linux-gnu/libc++.so.1 (0x00007f3733356000) libc++abi.so.1 => /lib/x86_64-linux-gnu/libc++abi.so.1 (0x00007f373331e000) /lib64/ld-linux-x86-64.so.2 (0x00007f373ebd7000) libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f3733318000) libpangocairo-1.0.so.0 => /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f3733306000) libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f37331c7000) libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f37331bf000) libatk-1.0.so.0 => /lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f3733195000) libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f3733072000) libgdk_pixbuf-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f373304a000) libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f3732e69000) libpangoft2-1.0.so.0 => /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f3732e4e000) libpango-1.0.so.0 => /lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f3732dff000) libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f3732db8000) libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f3732bae000) libXinerama.so.1 => /lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f3732ba9000) libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007f3732b97000) libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f3732b88000) libXcursor.so.1 => /lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f3732b7b000) libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f3732b76000) libXdamage.so.1 => /lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f3732b71000) libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f3732b5c000) libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007f3732b50000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f3732adb000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f3732ab1000) libpixman-1.so.0 => /lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f3732a0a000) libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f373294b000) libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f3732913000) libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f373290c000) libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f37328fd000) libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007f373289d000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f3732872000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f3732856000) libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f3732750000) libfribidi.so.0 => /lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007f3732733000) libthai.so.0 => /lib/x86_64-linux-gnu/libthai.so.0 (0x00007f3732728000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f37326fa000) libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f37326f1000) libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f37326e9000) libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f37326e1000) libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f373268a000) libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f37325f9000) libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f37325cc000) libdatrie.so.1 => /lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007f37325c0000) libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f37325a6000) (base)
|