gcc is unable to create an executable file when installing FFmpeg - gcc

I'm trying to install FFmpeg directly from the source and I keep getting this error:
gcc is unable to create an executable file.
If gcc is a cross-compiler, use the --enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.
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.
Can anyone help? Also, yum install ffmpeg doesn't work.

Apparently, with the limited information I have, you need to at least install gcc to compile ffmpeg. See How to Compile FFmpeg on CentOS for instructions. It is designed for CentOS, but should work for RHEL and Fedora.
Alternatively you can simply use a static build of ffmpeg instead of compiling, but it doesn't have the advantage of customization that compiling provides.
Note that Stack Overflow is limited to programming questions and discussions.

Related

How to compile ffmpeg for Windows statically with MSYS2 environment?

I want to build myself standalone statically linked ffmpeg binaries for Windows from official git source code with MSYS2 environment tools. But every time I get .exe file dynamically linked to mingw libraries that crashes with "The application was unable to start correctly (0xc000007b)" error even if I put required libbz2-1.dll, libiconv-2.dll and libwinpthread-1.dll libraries in it's folder.
I'm running MSYS2 environment with
msys2_shell.cmd -mingw64
line, and use mingw64/mingw-w64-x86_64-gcc 8.2.1+20181214-1 compiler package. Then I run ./configure with
./configure --pkg-config-flags=--static --disable-shared --enable-static
line - the best options I have googled at all my efforts. Then proceed with general
make
make install
sequence.
As a result, I get binaries that run smoothly in MSYS2 environment itself, but when I run it from host Windows explorer or cmd, first of all it ask for libbz2-1.dll, libiconv-2.dll and libwinpthread-1.dll libraries and when I put them in binaries' folder, they crash with "The application was unable to start correctly (0xc000007b)" error.
I've asked about this case at official https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5&t=6439 forum but still have no response for already 5 days.
Regarding dynamic linking libraries somehow I got bandaid solution with removing *.dll.a files from mingw64\x86_64-w64-mingw32\lib folder. But it looks not very clean for me. I wish to know if it is possible to do static linkage with some compiler/make/linker parameters or with editing ./configure or Makefile files somehow?
Also 0xc000007b error still remaining.
I've managed to have desired result with media-autobuild_suite based on the same MSYS2 environment, so I know it is possible to do this somehow. But I'm very new to all this *nix things so don't understand it's bash script at all, not to mention it is pretty sophisticated by itself. The only thing I see it's producing correct ffmpeg executables running under native Windows environment not requiring dlls listed above.
According to all guides in internet I found at the moment, I should get standalone Windows executables with this toolset, but it just don't work and I'm stuck. Please, help.
I had the same problems. To solve it, I try to disable all external libraries.
My configuration:
--enable-static --enable-gpl --disable-w32threads --disable-autodetect
After compiling, I copy the libwinpthread-1.dll from /mingw64/bin to the binaries' folder. (you can use ldd ffmpeg.exe to print shared library dependencies)
ffmpeg.exe and ffprobe.exe can run successfully.
using ffmpeg-4.4 & msys2-x86_64-20210419

Differences between Apple LLVM and LLVM

I have Apple's command line tools version 9.1 installed and am working through an LLVM tutorial. I need to use some libraries like llvm/ADT and llvm/IR but get an error when I run the code.
main.cpp:1:10: fatal error: 'llvm/ADT/APFloat.h' file not found
#include "llvm/ADT/APFloat.h"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
I also don't seem to have tools such as the assembler. Are these things not usable with Apple's version? And can I install LLVM without conflicting with Apple's version?
Apple's fork misses most of the library,headers and command-line tools in the llvm trunk.
I suggest you compile a new llvm copy from trunk.
Conflicting depends on how you configure everything. You can:
Install your new copy to global location, where your $PATH configuration is responsible for choosing which version to use.
Install as a separate Xcode Toolchain.
Here is a build script I've been using:
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLLVM_APPEND_VC_REV=on -DLLVM_ENABLE_EH=on -DLLVM_ENABLE_RTTI=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM
Running ninja install will install to global location, otherwise run ninja install-xcode-toolchain to install as a separate toolchain
In your case I suggest installing to global location to avoid the trouble of messing with CFLAGS/LDFLAGS/Header Search Path. Then remove the installation manually after you are done with the tutorial
EDIT: You might also want to check out the official build guide https://llvm.org/docs/CMake.html
For your use case, in-tree building is also a feasible option(Providing you are familiar with write cmake configs)
Actually, there is no need to build the LLVM yourself. You can get prebuilt version for your platform here: http://releases.llvm.org
In your case it would be something like this:
cd /opt
wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
tar xvf clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
mv clang+llvm-5.0.0-x86_64-apple-darwin llvm-5.0.0
After that you will have everything under /opt/llvm-5.0.0, e.g.:
/opt/llvm-5.0.0/bin/clang
/opt/llvm-5.0.0/bin/llvm-config
/opt/llvm-5.0.0/lib/libc++.a
etc.
P.S. I use /opt just as an example, feel free to pick any other directory that fits you best.

Compiling Ghostscript 9.10 using mingw

I am using msys2 Mingw (gcc 4.8.2 for i686 32-bit) for building Ghostscript 9.10. After running make, gs.exe was created successfully. Followed by that I ran "make so" for creating libgs library. Libgs.so, Libgs.so.9.10 were created which are of the same file size. But I found both of them to be PE executables. After renaming extension to .exe, they produced the same output as done by gs.exe. What I require is libgs.dll, libgs.a to be created, but instead "make so" creates libgs.so which is in fact a PE executable. I also tried using patch found on site:https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-ghostscript/mingw-build.patch, but still the output remains the same. Has anyone been successful in this? Kindly help me.
I presume if you follow the steps taken in the build script connected to the patch you linked, everything will work out fine. I think most of it is just to make it use the "system"'s 3rd party libraries instead of those in the GS source. I'd guess running the configure command would do.
Alternatively, you could just download the MSYS2 base system from here, and do a pacman -Syu mingw-w64-i686-ghostscript. It should download and install the binary package without you having to build it yourself.
If you really want to build it yourself, download the PKGBUILD and patch, and run makepkg from the aforementioned MSYS2 shell and have that build it for you.
Have just completed testing of gs 9.15 built executables using the a patch
MINGW-packages-master.zip from https://github.com/Alexpux/MINGW-packages
Without implementing the zlib patch and PKGBUILD and using a MINGW 4.7.3 32/64
without by ghostscript used libs installed.
They did not work as is while using msys1 pathe'd up ahead of Windoze.
I simply edited the the MINGW Build and 32/64 bit type in makefile in
and set them to =1 there. and as i built without GTK defined in ./configure
SOC_LOADER_PLAIN manually to gs.c
Check the makefile after ./configure ahead of make or make so though , , .
All went well except for the COMPILE_INITS
mkromfs build that failed so I had to set that to =0 and build without that
feature. For me personally preferred as one can patch the gs fonts and libs
much easier.
The builds run as charm with full cpu optimisers implemented
only disabling gcse and guess-branch-probability, easily outperforming
the binaries provided by http://www.ghostscript.com/ by all means.
HPC !

Building FFmpeg on RHEL4

StackOverflow has yet to fail me, so don't let me down this time!
I need to build FFmpeg on RHEL4 ... yes, 4!
The version of make on RHEL4 is 3.80, and the Makefile that ./configure generates when configuring FFmpeg does not seem to be compatible. When I make it throws a parse error every time.
This happens on pretty much every software pkg I try and build.
My applications group (at work) will not upgrade this machine, so please skip the suggestions to upgrade to RHEL5 or 6.
What are my options for installing FFmpeg?
Your question specified that doing a proper upgrade (i.e., upgrading the system's GNU Make package) is out of the question. However, since you have privileges to the system C compiler, I recommend building GNU Make 3.82 (latest and greatest) and installing it in your home directory for personal use.
Software is at: http://mirrors.kernel.org/gnu/make/
Unpack it, configure, build, and install:
./configure --prefix=$HOME
make
make install
Note that the last step is not prefixed by 'sudo'. This will install 'make' as ~/bin/make. After configuring FFmpeg, call '~/bin/make` and everything should build fine.
I just tested this myself.

Is it possible to install 2 different versions of GCC at the same time?

I am using Ubuntu 9.10
For a particular piece of code I require GCC 3.2 but I have a higher version. Is it possible to install multiple versions and use whichever one I want to ?
Have you searched the Ubuntu package archive for gcc ?
If gcc 3.3 is ok, you could download the gcc-3.3 and related .deb packages for dapper and I suspect it will install and happily co-exist with the gcc 4.4 you get with karmic. (You'll have to be sure to invoke it as gcc-3.3.)
Otherwise you would have to:
download the relevant gcc source bundle
build it yourself with an installdir some place out of the way like /opt/gcc-3.3
make sure to set your PATH correctly when you need it.
yes, you can have multiple installations. You can invoke specific version using gcc-3.2.
you can search repository using apt-cache search gcc-3 to find a package to install using apt-get install. quick search shows only gcc-3.3 in repository, if that version does not work for you, you have to dig a bit more or install by hand. Other poster gave more details
Consider accepting previous answers to questions you have been answered, otherwise you will not get responses.
It is possible to have more than one, but they need to be named differently and installed to different folders. See tutorials for building cross-compiling GCC but do not build for different architecture. However, note that compiling GCC yourself is rather difficult, so fixing the application that you need to compile might be easier.
It is possible to install several versions of gcc on the same machine, where the default version is located here:
/usr/bin/gcc
Then your alternate versions could be located here:
/usr/local/gcc
Certainly adding packages is a simpler way to do it, but if you are interested in installing from source you can download the specific version you want from here:
https://bigsearcher.com/mirrors/gcc/releases/
Then to easily distinguish the versions you can add a suffix or prefix:
./configure --prefix=/usr/local/gcc --program-suffix=-10
So in this case your alternate executable would become gcc-10. Then simply perform make and make install as usual.
Please note that if you get an error about GMP, MPFR or MPC files being missing then install them using:
./contrib/download_prerequisites
For details please see https://gcc.gnu.org/faq.html#multiple and Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+
Then you should have the new gcc program installed in /usr/local/gcc/bin instead of the default /usr/bin/gcc, so you have to add it to your PATH in your .bashrc file (this is how I did it for bash):
export PATH=$PATH/usr/local/gcc/bin
So now I can so that I have both the default gcc and the gcc-10 by doing:
$ which gcc
/usr/bin/gcc
$ which gcc-10
/usr/local/gcc/bin/gcc-10

Resources