I'm compiling FFmpeg from source.
./configure --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-x11grab --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264
make
make install
ldd /usr/local/bin/ffmpeg gave me this
linux-gate.so.1 => (0xb7717000)
libavdevice.so.53 => not found
libavfilter.so.2 => not found
libavformat.so.54 => not found
libavcodec.so.54 => not found
libpostproc.so.52 => not found
libswresample.so.0 => not found
libswscale.so.2 => not found
libavutil.so.51 => not found
libm.so.6 => /lib/i386-linux-gnu/tls/i686/nosegneg/libm.so.6 (0xb76e3000)
libpthread.so.0 => /lib/i386-linux-gnu/tls/i686/nosegneg/libpthread.so.0 (0xb76ca000)
libc.so.6 => /lib/i386-linux-gnu/tls/i686/nosegneg/libc.so.6 (0xb7569000)
/lib/ld-linux.so.2 (0xb7718000)
Setting $LD_LIBRARY_PATH to /usr/local/lib corrected the "not found" errors, but for the reasons mentioned here, I don't want to set $LD_LIBRARY_PATH permanantly.
I recomiled with the same commands, this time with $LD_RUN_PATH set to /usr/local/lib.
make seem to have ignored $LD_RUN_PATH when compiling.
Is there a way to use $LD_RUN_PATH without making extensive changes to the Makefile?
Do you have a reason to be compiling the binary in shared mode (like wanting to build software to link against them)? If a static 'ffmpeg' binary will work just as well for you, configure without the --enable-shared option to eliminate these dependencies.
Otherwise, you will need to let your system know where the shared libraries live, either by setting LD_LIBRARY_PATH in the environment, prefixing executions of 'ffmpeg' with LD_LIBRARY_PATH (e.g., "LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/ffmpeg"), or update your system's library path with the right location.
There is one more solution that is at the very bottom of the page you linked in your post: "LDFLAGS='-L/my/strange/path/lib -Wl,-rpath /my/strange/path/lib'". For FFmpeg, and for your situation, pass this extra parameter at configure time:
--extra-ldflags="-L/usr/local/lib -Wl,-rpath /usr/local/lib"
And the resulting 'ffmpeg' binary will know where to find the shared libraries.
Many solutions to this one.
Most probably LD_RUN_PATH is ignored because package's ./configure has already put some -Wl,-rpath options in linker's cmdline (frankly I don't know myself. I see the same behaviour here but I'm cross compiling from 486 to mips32).
try running configure like this:
./configure LDFLAGS="-L/your/lib -Wl,-rpath-link=/your/lib" CPPFLAGS="-I/your/include" --prefix=/tgt ...
I recommend using -rpath-link instead of -rpath if /your directory is different from /tgt
For anyone else who stumbles across this, the reason $LD_RUN_PATH wasn't working may have been due to this bug with the gold linker.
(The workaround is to use rpath as described in Mike's answer)
Related
I'm currently building Binutils 2.32 for the armv7l-unknown-linux-gnueabihf target, with this configure command:
chronos#localhost ~/Downloads/tarballs/binutils-2.32 $ ./configure --prefix=/usr/local/opt/arm-cross --target=armv7l-unknown-linux-gnueabihf --enable-shared --enable-host-shared --disable-static --enable-plugins --enable-gold=default --enable-ld --with-system-zlib
I ran make -j3 && make install, and no errors occured.
However, when I added /usr/local/opt/arm-cross/bin to my path and ran armv7l-unknown-linux-gnueabihf-objdump, this error occured:
armv7l-unknown-linux-gnueabihf-objdump: can't set BFD default target to `armv7l-unknown-linux-gnueabihf': invalid bfd target
How do I fix this? I searched on Stack Overflow and Google and couldn't come up with anything.
You configured with --enable-shared --enable-host-shared --disable-static. This means that it is you need to make sure that the binutils programs can find the shared objects they need. Therefore, in addition to PATH, you have to use LD_LIBRARY_PATH, or otherwise make the BFD library available to your custom binutils build.
This could however affect how other installed binutils versions find their BFD library, so it may be easier to link your version statically.
I need to compile a static FFmpeg on macOS and add this build to a Xcode project. If I download a full version from official website that is work. But this version size is huge, and I just need a few format to convert. So I need to compile by myself.
I've tired to compile and it's worked. But I am not sure how to select compile parameter.
For instance, I need to convert: ogg,flac,opus,webm files to mp3 file with the minimum size. And my compile parameter :
./configure --enable-ffmpeg --enable-small --enable-static --enable-protocol=file,http,https --enable-libvorbis \
--enable-libopus --disable-ffplay --disable-ffprobe --enable-demuxer=mp3,mp4,webm_dash_manifest,opus,flac,ogg \
--enable-decoder=mp3*,vp*,mpeg4*,opus,flac --enable-libmp3lame --disable-autodetect --disable-network --enable-pthreads
But it seems not to work, I can't convert files. Error reason is dyld: Library not loaded: /usr/local/opt/lame/lib/libmp3lame.0.dylib.But I used parameter --enable-static.
So what should I do? If I need to support a format to convert, I need to care about which respect? Thanks
--enable-static is applied to ffmpeg libraries but not its dependencies. You need to download and compile lame as static as well.
I am building a shared object on Ubuntu 16.04 which uses libgomp. My goal is to make this final object as portable as possible, by static linking anything not normally in a base distribution (using docker ubuntu or alpine images as a reference baseline). I've been able to do this with my other dependencies pretty easily, but I'm hung up on libgomp.
I can link just fine with the -fopenmp option, and get a dynamic link:
# ldd *.so
linux-vdso.so.1 => (0x00007fff01df4000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ba59db000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f9ba57b9000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9ba55a3000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9ba5386000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9ba4fbc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9ba6516000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9ba4db8000)
But if I naively add -static before -fopenmp I get:
relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Fair enough; with my other dependencies I've just built from source to enable PIC and any other options I needed. When I try to do the same with libgomp, though, I'm not having any luck. I checked out gcc 5.5 from http://gcc.gnu.org/svn/gcc, and tried building from the gcc/libgomp folder. There is a configure script already generated, but running it returns:
./config.status: line 1486: ./../../config-ml.in: No such file or directory
OK, apparently this has something to do with multilibrary support, which I don't believe I need. Running ./configure --help shows that there is an --enable-multilib option with no obvious default, but setting --enable-multilib=no or --disable-multilib still returns the same error. I've also tried running autoreconf -fiv to regenerate the configure script, but I get this error:
configure.ac:5: error: Please use exactly Autoconf 2.64 instead of 2.69.
If I explicitly install and use autoreconf2.64, I get this one:
configure.ac:65: error: Autoconf version 2.65 or higher is required
What am I missing?
What I was missing was the fact that libgomp is not buildable separate from the rest of gcc. It was just a matter of going up a level and running the whole build with -fPIC enabled:
export CFLAGS="-O3 -fPIC"
export CXXFLAGS="-O3 -fPIC"
./configure --disable-multilib --enable-languages=c,c++
make
make install
That gave me a copy of libgomp.a in /usr/local/lib64 ready for linking in to my shared object.
Follow up:
While this worked, at least in a test environment, after the comments above from Jim Cownie we decided to just disable OpenMP support from our library for now.
I am installing ffmpeg utility, but I am facing libmp3lame >= 3.98.3 not found not found error. I am able to find lame-3.99.5-1.el6.rf.x86_64.rpm and lame-libs-3.98.4-1.el6.nux.x86_64.rpm but installing these are not solving the problem. I am not able to find libmp3lame rpm to install.
Can anyone help me here?
[root#sdp-dev-03:/opt/ffmpeg] # ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --extra-libs=-ldl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --disable-ffplay --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads
ERROR: libmp3lame >= 3.98.3 not found
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
What worked for me was building lame from source. Download lame from here: https://sourceforge.net/projects/lame/files/lame/3.99/, then extract and install:
tar -zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
sudo make install
Check to see where libmp3lame.a is:
locate libmp3lame.a
Its probably in /usr/local/lib.
Now when you go to configure ffmpeg, try adding that path to the end of your ./configure string. For me it made the difference. e.g.:
--extra-ldflags=-L/usr/local/lib
For configure troubleshooting see the ffbuild/config.log in the ffmpeg source directory.
In my case it had missing references to libmath functions, even if -lm was set in host_extralibs.
For a quick-fix add -lm to the configure script:
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame -lm
I just experienced this problem. I had lame v3.99.5 installed, but ffmpeg configure was giving ERROR: libmp3lame >= 3.98.3 not found.
In addition to --extra-ldflags, I had to specify --extra-cflags. So, the configure line was:
./configure [...] --enable-libmp3lame [...] --extra-ldflags=-L/usr/local/lib --extra-cflags=-I/usr/local/include
On Ubuntu 16.04
sudo apt-get install yasm libmp3lame-dev
Then configure ffmpeg to build from source with libmp3lame:
./configure --enable-gpl --enable-libmp3lame --enable-shared
In my case the solution for ffmpeg/3.1.3 (based on https://github.com/Homebrew/legacy-homebrew/issues/44489) was to add:
--host-ldflags=-L/usr/local/lib
to the configure string.
this is my way:
install X11,and goto ffmpeg path,and code this in the Terminal:
pkg-config usr/local/lib
pkg-config usr/lib
pkg-config usr/X11/lib
then code ./configure xxxx.
Can you help me?
I try to install a ffmpeg using a brew, but i can't.
It seems like the dependencies was successfully installed.
I am using a Mac OSX 10.7.2 and the XCode 4.2.1.
I couldn't install ffmpeg.
I've tried:
brew install ffmpeg
brew install --use-clang ffmpeg
brew install --use-clang --HEAD ffmpeg
And they've all failed.
This is the result log.
$ brew install --use-clang ffmpeg
==> Downloading http://ffmpeg.org/releases/ffmpeg-0.9.1.tar.bz2
File already downloaded in /Users/brunogermano/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/ffmpeg/0.9.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bi
ERROR: libmp3lame >= 3.98.3 not found
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
==> Exit Status: 1
http://github.com/mxcl/homebrew/blob/master/Library/Formula/ffmpeg.rb#L61
==> Environment
HOMEBREW_VERSION: 0.8.1
HEAD: 44213dfb4861c1307fdc4ae41e139404f0e1ffb1
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: dual-core 64-bit penryn
OS X: 10.7.2
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 4.2.1
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 3.0 build 211
MacPorts or Fink? false
X11 installed? true
==> Build Flags
"--use-clang" was specified
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -O3 -w -pipe -march=native
CXXFLAGS: -O3 -w -pipe -march=native
CPPFLAGS: -I/usr/X11/include
LDFLAGS: -L/usr/X11/lib
MAKEFLAGS: -j2
Error: Failed executing: ./configure --prefix=/usr/local/Cellar/ffmpeg/0.9.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/clang --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --disable-ffplay
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/8456
https://github.com/mxcl/homebrew/issues/8815
https://github.com/mxcl/homebrew/issues/9399
Otherwise, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
We saved the configure log, please gist it if you report the issue:
~/Library/Logs/Homebrew/config.log
This is the brew doctor log:
$ brew doctor
Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libavcodec.52.108.0.dylib
/usr/local/lib/libavcore.0.16.1.dylib
/usr/local/lib/libavdevice.52.2.3.dylib
/usr/local/lib/libavfilter.1.74.0.dylib
/usr/local/lib/libavformat.52.93.0.dylib
/usr/local/lib/libavutil.50.36.0.dylib
/usr/local/lib/libfaad.2.0.0.dylib
/usr/local/lib/libguide.dylib
/usr/local/lib/libmp3lame.0.0.0.dylib
/usr/local/lib/libswscale.0.12.0.dylib
Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libavcodec.a
/usr/local/lib/libavcore.a
/usr/local/lib/libavdevice.a
/usr/local/lib/libavfilter.a
/usr/local/lib/libavformat.a
/usr/local/lib/libavutil.a
/usr/local/lib/libfaad.a
/usr/local/lib/libmp4ff.a
/usr/local/lib/libswscale.a
Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/libavcodec.pc
/usr/local/lib/pkgconfig/libavcore.pc
/usr/local/lib/pkgconfig/libavdevice.pc
/usr/local/lib/pkgconfig/libavfilter.pc
/usr/local/lib/pkgconfig/libavformat.pc
/usr/local/lib/pkgconfig/libavutil.pc
/usr/local/lib/pkgconfig/libswscale.pc
Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libfaad.la
/usr/local/lib/libmp3lame.la
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
NOTE: Versions of XCode newer than 4.2 don't include gcc 4.2.x.
==> /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. This is an issue if you eg. brew installed Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to the PATH variable.
Some "config" scripts were found in your path, but not in system or Homebrew folders.
`./configure` scripts often look for *-config scripts to determine if software packages
are installed, and what additional flags to use when compiling and linking.
Having additional scripts in your path can confuse software installed via Homebrew if
the config script overrides a system or Homebrew provided script of the same name.
/Library/Frameworks/Python.framework/Versions/Current/bin
python-config python2.5-config
Anyone can help me?
Actually was able to solve this error with:
$brew uninstall lame
$brew install lame
$sudo brew link lame
I installed without using the brew.
I installed manually the x264 and then I installed ffmpeg.
I had a little help from this site:
http://hunterford.me/compiling-ffmpeg-on-mac-os-x/