主要工做是將一些庫進行靜態編譯,能夠在其它未安裝這些庫的機器上直接運行。html
若是有目標機的管理員權限的話,能夠直接安裝軟件。linux
sudo apt install libvdpau-dev
沒有沒有的話,能夠在編譯ffmpeg時禁掉vdpau:c++
./configure --enable-shared --disable-vdpau
或者使用apt source
下載源碼手動編譯成靜態庫:shell
$ apt source libvdpau-dev
E: You must put some 'source' URIs in your sources.list
由於/etc/apt/source.list裏的deb-src都被註釋掉了,能夠直接在/etc/apt/source.list中把deb-src註釋打開,或者在軟件更新中勾上源代碼更新。json
再運行apt source libvdpau-dev
會拉下來一個libvdpau-1.1.1目錄,進入目錄,配置編譯,會在src/.libs目錄生成libvdpau.a
:bash
./configure --disable-shared
./configure --disable-shared
OpenCV使用靜態庫:ui
cmake -D BUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF ..
能夠經過camke -LH ../查看當前cmake選項,能夠經過-D去設置該值。spa
同一目錄下有libxxx.a文件和libxxx.so文件,gcc默認會連接so,改變這一默認行爲的方法就是:將"-lxxx"改成"-l:libxxx.a"3d
能夠經過ldd查看可執行程序的軟件庫依賴狀況:code
./test6: /lib/x86_64-linux-gnu/libssl.so.1.0.0: version `OPENSSL_1.0.2' not found (required by ./test6) ./test6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./test6) ./test6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./test6) linux-vdso.so.1 => (0x00007ffdb6f18000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fde407ab000) libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007fde405a0000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fde40387000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fde40183000) libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007fde3fb46000) libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007fde3f893000) libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007fde3f588000) libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007fde3f367000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fde3f116000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fde3ee0e000) libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fde3ebb9000) libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fde3e993000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fde3e78b000) libvdpau.so.1 => not found libva.so.1 => /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007fde3e575000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fde3e240000) libva-drm.so.1 => /usr/lib/x86_64-linux-gnu/libva-drm.so.1 (0x00007fde3e03d000) libva-x11.so.1 => /usr/lib/x86_64-linux-gnu/libva-x11.so.1 (0x00007fde3de37000) libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fde3dbd8000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fde3d7fc000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fde3d4f8000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fde3d1f2000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fde3cfdc000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fde3cc13000) /lib64/ld-linux-x86-64.so.2 (0x00007fde409c9000) libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fde3ca0f000) libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007fde3c802000) libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fde3c5fc000) libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007fde3c3da000) libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007fde3c067000) libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007fde3be52000) libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007fde3bc05000) libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fde3b9c9000) libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fde3b7bf000) libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007fde3b5bc000) libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fde3b3ac000) libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007fde3b1a2000) libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007fde3af98000) libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007fde3ad95000) libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fde3ab92000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fde3a980000) libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007fde3a6d7000) libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fde3a434000) libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fde3a231000) libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fde3a028000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fde39e09000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fde39c01000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fde399c3000) libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fde397b5000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fde39592000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fde39377000) libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fde39122000) libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007fde38f19000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fde38cef000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fde38aeb000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fde388e5000) libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fde386c9000) libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007fde384c2000)
因爲目標機和當前Ubuntu發行版不一致,致使一些庫版本不匹配,如stdc++, libssl,把這些庫都進行了靜態編譯。最後通過編譯,軟件能夠成功在其它機子上運行。