georgmartius / vid.stab

Video stabilization library
http://public.hronopik.de/vid.stab/
Other
842 stars 108 forks source link

Error while loading shared libraries #37

Closed nicolazilio closed 7 years ago

nicolazilio commented 8 years ago

Dear all,

I followed this guide to compile ffmpeg. Before doing so I got the source code for the vid.stab library from GitHub and did

cmake -DCMAKE_INSTALL_PREFIX:PATH="/home/myusername/programs/ffmpeg/ffmpeg_build"
make
sudo make install

within the follwoing directory structure:

programs
    |_ ffmpeg
          |_ ffmpeg_build
                |_ lib
                      |_ pkgconfig
                |_ bin
                |_ include
                |_share
          |_ ffmpeg_sources
                |_ vid.stab
          |_ bin

At last, I compiled ffmpeg and exported LD_LIBRARY_PATH. However, when I run ffmpeg, I receive the following error message:

./ffmpeg: error while loading shared libraries: libvidstab.so.1.1: cannot open shared object file: No such file or directory

Does anybody have an idea of what could have gone wrong? I can see libvidstab.so.1.1 in ffmpeg_build/lib.

Thanks a bunch.

Nicola

georgmartius commented 8 years ago

Hi, did you also install the vid.stab library itself? It cannot be found at runtime. You can either install it in the system (with sudo make install) or use LD_LIBRARY_PATH to point the linker to the path of the lib file.

Hope it helps.

nicolazilio commented 8 years ago

It looks like I need export LD_LIBRARY_PATH before running ffmpeg every time I start a new shell, I don't know if this is the expected behaviour, but it works this way.

tlum commented 7 years ago

It depends on your intentions. Mine was to create a static build of ffmpeg because there is often a lot of trouble getting RHEL and derivative distros to agree on shared library version requirements... so I just opt to build and statically link the requirement. But to do that you have to decipher the switch to generate static libraries. In this case I was able to use:

cd ~/ffmpeg_sources
git clone https://github.com/georgmartius/vid.stab.git
cd vid.stab
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/ffmpeg_build -DBUILD_SHARED_LIBS:bool=off .
make
make install

So, if you're intending to link static libs, this error happens because vid.stab defaults to shared. If you're intending to use shared libs then that's another whole can of worms.

Also, another word of caution, be careful of the sudo make install. I don't doubt that sudo is required to do the install to the system shared library, but not only is it not required for local builds but I had it set root permissions on some of the folder structure and subsequent build steps failed because they lacked root permissions. I would use it only in the correct context.