How to compile ffmpeg via Alchemy gcc? - c

So I created ffmpeg configuration file that makes it pure C (platform independent, but only theoretically)
So my config is simple (0.6.1,0.6.3 tested):
./configure --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-pthreads --disable-everything --enable-muxer=flv --enable-encoder=flv --enable-encoder=h263 --disable-mmx --disable-shared --prefix=bin/ --disable-protocols --disable-network --disable-optimizations --disable-debug --disable-asm --disable-stripping
Compiling this on Linux will resolve in 4 libs with totall size of 1 mb.
But I need to compile ffmpeg with custom compiler (opensource gcc analog called Adobe Alchemy, lets us compile C/c++ into Flash)
It gives me errors on nearly each and every file during standart Make:
Array #ARGV missing the # in argument 1 of shift() at /home/rupert/Downloads/alchemy-ubuntu-v0.5a/achacks/gcc line 218.
cc1: error: unrecognized command line option "-Wtype-limits"
cc1: error: unrecognized command line option "-fno-signed-zeros"
So what shall I do - how to compile ffmpeg (at least smallest part of it) via alchemy?
Update
If we would fix that errors manually (2 in configure.mak and one in alchemy gcc) we would get a really messy and long output like:
> $ make -w install
make: Entering directory `/home/rupert/Downloads/ffmpeg-0.6.1'
AR libavformat/libavformat.a
llvm-ld: error opening 'avformat/libavformat.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavformat/libavformat.a
install: cannot stat `libavformat/libavformat.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavcodec/libavcodec.a
llvm-ld: error opening 'avcodec/libavcodec.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavcodec/libavcodec.a
install: cannot stat `libavcodec/libavcodec.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libswscale/libswscale.a
llvm-ld: error opening 'swscale/libswscale.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libswscale/libswscale.a
install: cannot stat `libswscale/libswscale.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavutil/libavutil.a
llvm-ld: error opening 'avutil/libavutil.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavutil/libavutil.a
install: cannot stat `libavutil/libavutil.a': No such file or directory
llvm-ranlib: Archive file does not exist
INSTALL libavformat/avformat.h
INSTALL libavformat/avio.h
INSTALL libavformat/libavformat.pc
INSTALL libavcodec/avcodec.h
INSTALL libavcodec/avfft.h
INSTALL libavcodec/dxva2.h
INSTALL libavcodec/opt.h
INSTALL libavcodec/vaapi.h
INSTALL libavcodec/vdpau.h
INSTALL libavcodec/xvmc.h
INSTALL libavcodec/libavcodec.pc
INSTALL libswscale/swscale.h
INSTALL libswscale/libswscale.pc
INSTALL libavutil/adler32.h
INSTALL libavutil/attributes.h
INSTALL libavutil/avstring.h
INSTALL libavutil/avutil.h
INSTALL libavutil/base64.h
INSTALL libavutil/common.h
INSTALL libavutil/crc.h
INSTALL libavutil/error.h
INSTALL libavutil/fifo.h
INSTALL libavutil/intfloat_readwrite.h
INSTALL libavutil/log.h
INSTALL libavutil/lzo.h
INSTALL libavutil/mathematics.h
INSTALL libavutil/md5.h
INSTALL libavutil/mem.h
INSTALL libavutil/pixdesc.h
INSTALL libavutil/pixfmt.h
INSTALL libavutil/rational.h
INSTALL libavutil/sha1.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/libavutil.pc
LD ffmpeg_g
WARNING: While resolving call to function 'main' arguments were dropped!
Cannot yet select: 0x8e707e8: i32 = ConstantPool < i64 6881500230622117888> 0
llc[0x86c7dec]
make: *** [ffmpeg_g] Error 6
make: Leaving directory `/home/rupert/Downloads/ffmpeg-0.6.1'

FlasCC(Alchemy 2) does compile ffmpeg fine - for anyone who is trying, basically you need to download ffmpeg source. Go to ffmpeg directory, do
PATH=/cygdrive/c/PATH_TO_FLASCC/sdk/usr/bin:$PATH ./configure --prefix=/cygdrive/c/PATH_TO_FLASCC/sdk/usr
Now it's good if you run configure with some restrictions so it doesn't include every codec or filter there is(takes ages). Additional configure params from my use case:
--disable-ffserver --disable-everything --enable-filter=scale --enable-demuxer=flv --enable-muxer=ogg --enable-protocol=file --disable-network --disable-debug --disable-yasm --disable-asm --disable-stripping --enable-memalign-hack --disable-shared --enable-decoder=flashsv --enable-encoder=mpeg1video --enable-encoder=libtheora --enable-encoder=libvorbis --enable-libtheora --enable-libvorbis
Important is to --disable-everything and then enable only what you need.
Then run ./make and ./make install (with the PATH in front of those commands), it should produce and install ffmpeg libs.
When I built a test swf, all seemed to work. I've used their (modified) sample where they encode 25 dummy mpeg frames. I'm tracing the encoding progress at least and seeing the frames being encoded.
SWC is a problem though, if you would want to use that. I'm getting strange errors - first it couldn't find codec(got NULL when using the find codec function), when I specified it by name, it can't allocate codec context(also got NULL). Then I compiled it in pure Flex and it got over this one, but couldn't open the codec (basically all of those are av_ something library functions). I really don't understand why SWC doesn't work with these as with emit-swf all works perfectly fine.
Maybe someone could enlighten on the SWC / SWF differences.

There was some discussion about this on the Adobe Forums here. It seems rather involved, though some folks seem to have made some progress.

Try it with the new flash c compiler Adobe Flash cc. I hope it may help you to compile ffmpeg in flash.

Related

Libmodbus library not found when trying to compile mbrtu

I tried:
cd ~
git clone git://github.com/stephane/libmodbus
cd libmodbus
./autogen.sh
./configure --enable-static
make
sudo make install
sudo cp ./src/.libs/libmodbus.a /usr/local/lib/
to download, compile and install the libmodbus library. Now I have a libmodbus.a file in /usr/local/lib/.
Now I want to install mbrtu:
cd ~
git clone https://github.com/gitaeuber/mbrtu
cd mbrtu
make
sudo make install
Strangely, after make I get the error:
In file included from mbrtu.c:22:
mbrtu.h:25:12: fatal error: modbus.h: No such file or directory
25 | #include <modbus.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:9: mbrtu] Error 1
I tried adding the library path /usr/local/lib/ to $LD_LIBRARY_PATH, but that did not help at all.
Can someone explain me how I can compile and install the libmodbus library correctly?
It is not a library that is not found by the linker but an include file which is not found by the compiler. Look at the make file install to see how include files are searched. It is likely a variable INC or INCLUDE.

Eigen3 fails to install with cmake : RegexUtils not found

I try to install eigen3.3.7 with cmake on ubuntu 16 but cmake fails.
I follow the INSTALL file hints :
1) I extract the tar archive
2) Make a "build" dir named buildDir
3) Go to build dir : cd buildDir
4) Start cmake : cmake ../Eigen
Then the cmake process ends up with the error :
CMake Error at CMakeLists.txt:1 (include):
include could not find load file:
RegexUtils
CMake Error at CMakeLists.txt:2 (test_escape_string_as_regex):
Unknown CMake command "test_escape_string_as_regex".
May I ask you some hints please ?
Regards
Sylvain
I followed the advices of chtz, but it still fails, see below the console output :
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731$ cat INSTALL
Installation instructions for Eigen
***********************************
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731$ mkdir build && cd build
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731/build$ cmake ../
CMake Error at CMakeLists.txt:1 (include):
include could not find load file:
RegexUtils
CMake Error at CMakeLists.txt:2 (test_escape_string_as_regex):
Unknown CMake command "test_escape_string_as_regex".
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.5)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "/home/syl/tmp/eigen/eigen-eigen-323c052e1731/CMakeFiles/CMakeOutput.log".
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731/build$ vim ../CMakeFiles/CMakeOutput.log
Thanks for helping.
This sequence of commands seems to work properly after downloading (in my case the currently latest version eigen-3.3.7):
bunzip2 eigen-3.3.7.tar.bz2
tar -xvf eigen-3.3.7.tar
cd eigen-3.3.7/
mkdir build
cd build
cmake ../.
sudo make install

error when compiling testfiles from installed c-algorithms library

I'm trying to install and test c library c-algorithms from Github.
https://github.com/fragglet/c-algorithms/blob/master/test/test-queue.c
When I try to test the installation from the generated test folder with:
gcc -o test-arraylist `pkg-config --cflags --libs libcalg-1.0` test-arraylist.c
I get the following error massage:
test-arraylist.c:30:23: fatal error: arraylist.h: No such file or directory
compilation terminated.
I use a Vagrant box: ubuntu/xenial32 with Ubuntu 14.04.5 LTS
Prior to installation of c-algorithms:
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install pkg-config
To install the library I have done following:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
Any help would be highly apriciated
The test-arraylist.c has line #include "arraylist.h" but it is under the libcalg subdirectory not directly in the include path.
libcalg subdir should be added to the include path or you have to modify the include like #include "libcalg/arraylist.h"
If you want only run the tests, then run the
sudo make check from the build root (in your case it is the source root)
This is probably going to be stomped on by process-fetishizers.
But.
When you build in a Unix/Linux operating system (and derivatives like RTEMS), you are building off other people's libraries - so you need those libraries and their header files ( just like c-alg... ) installed in locations that your compiler can find.
To find a file that is associated with a package, use dpkg as explained here:
https://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file
But you have another problem you might not be aware of. You are trying to compile a test program using a gcc command when the software uses GNU autoconf automake and probably libtool to function PROPERLY.
Perhaps you don't understand you need to make sure autoconf, automake, and then libtool find the right configuration from one directory system to another. Fedora puts files in differing spots from Ubuntu distros.
Instead run:
autoreconf -fvi
first in the top level directory and see if this finds your header file.
THEN you run
./configure
and then
make test/check
(whichever it uses, some use recipe "all-tests", etc.)
make all
This would make all if your system is ready to handle them.

Install ffmpeg-light with cabal

I want to install the ffmpeg-light library from hackage via cabal on Windows 10 (64 bit). So I downloaded ffmpeg and extracted it to C:\FFmpeg.
At first pkg-config was complaining that it could not find various packages. I solved this problem with .pc files.
When I tried to use the command: cabal install ffmpeg-light cabal complained about missing C-libraries, being exactly those for which I created the .pc files.
Then I tried the command: cabal install ffmpeg-light --extra-lib-dirs=C:\FFmpeg\lib. Now I have a different error message, which says:
Enums.hsc:7:32: fatal error: libavcodec/avcodec.h: No such file or directory
Edit:
Then I tried the following command:
cabal install ffmpeg-light --extra-lib-dirs=C:\FFmpeg\lib \
--extra-include-dirs=C:\FFmpeg\include
Now first the compiler gives some warnings about deprecated functions in ffmpeg and redundant imports in ffmpeg-light, but compiles 11 of 11. But the build is still not successfull.
In-place registering ffmpeg-light-0.11.1...
setup-Simple-Cabal-1.22.5.0-x86_64-windows-ghc-7.10.3.exe:
'C:\Haskell\bin\ghc-pkg.exe' exited with an error:
ffmpeg-light-0.11.1: Warning: haddock-interfaces:
C:\Users\HOLEYC~1\AppData\Local\Temp\cabal-tmp-2824\ffmpeg-light-0.11.1\dist\doc\html\ffmpeg-light\ffmpeg-light.haddock
doesn't exist or isn't a file
ffmpeg-light-0.11.1: Warning: haddock-html:
C:\Users\HOLEYC~1\AppData\Local\Temp\cabal-tmp-2824\ffmpeg-light-0.11.1\dist\doc\html\ffmpeg-light
doesn't exist or isn't a directory
ffmpeg-light-0.11.1: library-dirs: C:FFmpeglib is a relative path which makes
no sense (as there is nothing for it to be relative to). You can make paths
relative to the package database itself by using ${pkgroot}. (use --force to
override)
ffmpeg-light-0.11.1: include-dirs: C:FFmpeginclude is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cabal: Error: some packages failed to install:
ffmpeg-light-0.11.1 failed during the building phase. The exception was:
ExitFailure 1
Some additional information:
cabal version: cabal-install version 1.22.6.0
using version 1.22.5.0 of the Cabal library
gcc version of my installed Haskell platform: 5.2.0
Example .pc file I used for pkg-config:
Name: libavcodec
Description: Library for ffmpeg
Version: 57
Cflags: -IC:\FFmpeg\include
Libs: -LC:\FFmpeg\lib -llibavcodec
OK. I figured it out. The --ghc-pkg-options="--force" option was needed.
cabal install ffmpeg-light --extra-lib-dirs=C:\FFmpeg\lib --extra-include-dirs=C:\FFmpeg\include --ghc-pkg-options="--force"

Installing gcc manually redhat

I am working on a system on which I am a non-root user.
While trying to install gcc 5.1 in a custom directory as the present shared version of gcc isn't working for postgresql installation, I started out by
wget gcc 5.1.
After unzipping the folder, ran the commands below:
cd /seq/genome_portal/lib
mkdir bld
mkdir gcc
cd bld
/seq/genome_portal/lib/gcc-5.1/configure --prefix=/seq/genome_portal/lib/gcc
However config.log still shows this error:
/../../redhat_6_x86_64/pkgs/gcc_4.9.0/libexec/gcc/x86_64-redhat-linux/4.9.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
The prerequisites that come after
./contrib/download_prerequisites
are gmp,mpfr and mpc. I started with gmp and ended up in the same error as above. I somehow need to tell these programs that I do not want to use the existing gcc.
But I get the same error as mentioned before. Any advice as to how I can proceed to install it?
Building a compiler is much more complicated that building a straightforward utility; just running configure is not enough.
Primarily, you need to read the instructions; they are provided in the GCC source directory in the INSTALL subdirectory. They are in HTML so point your browser at it.
I know you didn't do this yet because the step on configuration makes very clear you should be using an out-of-source configuration; e.g., something like:
mkdir ../bld
cd ../bld
../gcc-5.1/configure ...
rather than running ./configure.
Regarding the missing dependencies, there's a "prerequisites" section in the docs. To get MPFR and other helpful things you can run:
cd gcc-5.1
./contrib/download_prerequisites
ETA: This should work:
rm -rf newgcc
mkdir newgcc
cd newgcc
tar xzf gcc-5.1.tar.gz
cd gcc-5.1
./contrib/download_prerequisites
mkdir ../bld
cd ../bld
../gcc-5.1/configure <configopts>
make -j8
make install
(or whatever -j you prefer).

Resources