FFMPEg and gcc problem
The problem is this: I wrote a simple program that uses FFMPEG. compile as follows:
gcc -lavcodec -lavformat -lavutil -c test.c
gcc -lavcodec -lavformat -Lavut -o test test.o
Compiled开发者_Python百科 without problems, test file appears, but when you start: . / test An error occurs:
. / test: error while loading shared libraries: libavcodec.so.53: cannot open shared object file: No such file or directory
At what ffmpeg was originally built and installed and the file libavcodec.so.53 there. In what may be the problem?
You appear to be linking against libraries in a custom library directory, -Lavut
.
Check where your loader looks for the executable's libraries:
ldd ./test
If any of them are in non-standard directories (and ldd
indicates that a particular library couldn't be found), append those to the LD_LIBRARY_PATH:
LD_LIBRARY_PATH=/tmp/work/avut ./test
If you like, you can hardcode the library path into the executable with the -rpath
linker option, e.g. gcc ... -Wl,-rpath -Wl,/tmp/work/avut
.
精彩评论