Compile ffmpeg with librtmp - ios

When compiling ffmpeg for OSX, I can simply use the:
./configure --enable-librtmp --enable-gpl
command and get a build that can I/O with an rtmp stream.
If I attempt to compile for iOS using:
./configure \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-mmx \
--enable-gpl \
--enable-shared \
--enable-librtmp \
--enable-avresample \
--enable-cross-compile \
--enable-pic \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs /iPhoneOS6.1.sdk" \
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" \
--extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=6.1" \
--extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1" \
--arch=arm \
--cpu=cortex-a9 \
--prefix=compiled/armv7s
it errors out saying ERROR: librtmp cannot be found. Specifically:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -Wl,-dynamic,-search_paths_first -I/usr/local/include -L/usr/local/lib -o /var/folders/4m/8hcrycqx777_ksz6d32nrn_m0000gp/T//ffconf.b2zp97z8 /var/folders/4m/8hcrycqx777_ksz6d32nrn_m0000gp/T//ffconf.VhdlpSe1.o -lrtmp -lz -lssl -lcrypto -lm -lbz2 -lz
ld: warning: ld: warning: ignoring file /usr/local/lib/librtmp.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s): /usr/local/lib/librtmp.dylibignoring file /usr/local/lib/libz.a, file was built for archive which is not the architecture being linked (armv7s): /usr/local/lib/libz.a
Undefined symbols for architecture armv7s:
"_RTMP_Socket", referenced from:
_check_RTMP_Socket in ffconf.VhdlpSe1.o
(maybe you meant: _check_RTMP_Socket)
ld: symbol(s) not found for architecture armv7s
collect2: ld returned 1 exit status
ERROR: librtmp not found
I have already compiled openssl for ios using ios-openssl found on github and librtmp through rtmpdump

I ended up compiling librtmp and openssl using ios-librtmp and ios-openssl, installed rtmpdump and openssl using brew, export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig, and then changing the files in /usr/local/lib/pkgconfig for libcrypto.pc, libssl.pc, openssl.pc, and librtmp.pc to point to the iOS i386, armv7 & armv7s compiled libraries.

Related

Image conversion from IFF and EXR formats to JPEG format

I am using convert Desktop/iff_image.iff Desktop/iff_image.jpg to convert my images to JPEG format.
But getting as
convert: no decode delegate for this image format `Desktop/iff_image.iff' # error/constitute.c/ReadImage/552.
convert: no images defined `Desktop/iff_image.jpg' # error/convert.c/ConvertImageCommand/3127.
For .tif, .tiff, .cin, .dpx extensions it is working properly.
The issue is coming only for .iff and .exr extensions.
IFF
I am not familiar with a format named 'IFF'. Sorry to be of no help for this one...
EXR
For support of reading and writing the EXR format, your ImageMagick installation needs to have...
...access to the OpenEXR library (which also must be installed on your system);
...been built with support for the OpenEXR delegate.
In ImageMagick, 'delegates' are external programs or helper utilities which support ImageMagick to handle formats which it cannot handle on its own.
One of the most common delegates found in ImageMagick is Ghostscript. Ghostscript is required to process PDF or PostScript input files, because ImageMagick can only handle raster formats. So Ghostscript converts PDFs and PS to raster images on behalf of ImageMagick, then hands over these raster data to IM, which then does the rest of the required work.
To print the list of all built-in delegates, run this command (on Linux or Mac OS X):
convert -version | grep Delegates
The respective Windows command is:
convert -version | findstr Delegates
The output I see on my system for this command is this:
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig \
jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png \
ps rsvg tiff webp wmf x xml zlib
The list of supported delegates should have openexr amongst them. If it is not there, you need to install a version of ImageMagick that has it.
To check which compile-time options have been used to build your version of ImageMagick, run
convert -list configure
If the linen starting DELEGATES does not list openexr, the binary package for your system has not been built with OpenEXR in mind. If it is listed, but still not working, something else is wrong...
On my system, I see this:
Path: /opt/local/lib/ImageMagick-6.9.0//config-Q16/configure.xml
Name Value
-------------------------------------------------------------------------------
CC /usr/bin/clang
CFLAGS -I/opt/local/include/lqr-1 -I/opt/local/include/glib-2.0 \
-I/opt/local/lib/glib-2.0/include -I/opt/local/include \
-I/opt/local/include/freetype2 -I/opt/local/include \
-I/opt/local/include/libpng16 -pipe -Os -arch x86_64 \
-Wall -march=corei7-avx -fexceptions -D_FORTIFY_SOURCE=0 \
-D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=0 \
-DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /opt/local/lib/ImageMagick-6.9.0/modules-Q16/coders
CONFIGURE ./configure '--prefix=/opt/local' '--enable-shared' \
'--enable-static' '--disable-ltdl-install' \
'--disable-silent-rules' '--with-frozenpaths' \
'--with-openexr' '--disable-hdri' '--with-dps' \
'--with-bzlib' '--with-djvu' '--with-fontconfig' \
'--with-gslib' '--with-jbig' '--with-jpeg' '--with-lcms' \
'--with-openjp2' '--with-png' '--with-tiff' '--with-webp' \
'--with-zlib' '--with-modules' '--with-xml' \
'--without-perl' '--without-fpx' '--with-wmf' \
'--with-gvc' '--with-rsvg' '--with-lqr' '--with-pango' \
'--with-x' '--with-gs-font-dir=/opt/local/share/fonts/urw-fonts' \
'CC=/usr/bin/clang' 'CFLAGS=-pipe -Os -arch x86_64' \
'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names \
-arch x86_64' 'CPPFLAGS=-I/opt/local/include' \
'CXX=/usr/bin/clang++' 'CXXFLAGS=-pipe -Os -arch x86_64 \
-stdlib=libc++'
CONFIGURE_PATH /opt/local/etc/ImageMagick-6/
COPYRIGHT Copyright (C) 1999-2014 ImageMagick Studio LLC
CPPFLAGS -I/opt/local/include/ImageMagick-6
CXX /usr/bin/clang++
CXXFLAGS -pipe -Os -arch x86_64 -stdlib=libc++ -D_THREAD_SAFE -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib djvu mpeg fftw fontconfig freetype gslib jbig jng jpeg lcms \
lqr lzma openexr openjp2 pango png ps rsvg tiff webp wmf x xml zlib
DISTCHECK_CONFIG_FLAGS 'CC=/usr/bin/clang' 'CFLAGS=-pipe -Os -arch x86_64' \
'CPPFLAGS=-I/opt/local/include' 'CXX=/usr/bin/clang++' \
'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names \
-arch x86_64' --disable-deprecated --with-quantum-depth=16 \
--with-jemalloc=no --with-umem=no --with-autotrace=no \
--with-fpx=no --with-fontpath= --with-gs-font-dir=/opt/local/share/fonts/urw-fonts \
--with-perl=no
DOCUMENTATION_PATH /opt/local/share/doc/ImageMagick-6
EXEC-PREFIX /opt/local
EXECUTABLE_PATH /opt/local/bin
FEATURES DPC Modules
FILTER_PATH /opt/local/lib/ImageMagick-6.9.0/modules-Q16/filters
HOST x86_64-apple-darwin13.4.0
INCLUDE_PATH /opt/local/include/ImageMagick-6
LDFLAGS -L/opt/local/lib -L/opt/local/lib -Wl,-headerpad_max_install_names \
-arch x86_64 -L/opt/local/lib -L/opt/local/lib
LIB_VERSION 0x690
LIB_VERSION_NUMBER 6,9,0,0
LIBRARY_PATH /opt/local/lib/ImageMagick-6.9.0
LIBS -llcms2 -L/opt/local/lib -lfreetype -L/opt/local/lib -llqr-1 \
-lglib-2.0 -lintl -lfftw3 -L/opt/local/lib -lfontconfig -lfreetype \
-lXext -lSM -lICE -lX11 -lXt -L/opt/local/lib -llzma -lbz2 -lz \
-lltdl -lm
NAME ImageMagick
PCFLAGS -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /opt/local
QuantumDepth 16
RELEASE_DATE 2014-12-06
SHARE_PATH /opt/local/share/ImageMagick-6
SHAREARCH_PATH /opt/local/lib/ImageMagick-6.9.0/config-Q16
SVN_REVISION 17068
TARGET_CPU x86_64
TARGET_OS darwin13.4.0
TARGET_VENDOR apple
VERSION 6.9.0
WEBSITE http://www.imagemagick.org
Path: [built-in]
Name Value
----------------------------------------------------------------------------
FEATURES
NAME ImageMagick
QuantumDepth 16

Integrating ffmpeg in xcode5, Cannot find gcc

I have been trying to integrate ffmpeg in xcode5.
The step [here][1]
[1]: FFMPEG integration on iphone/ ipad project says that cc parameter needs to be gcc in iphoneOs.platform.
But I could not find it in my xcode5.
It is present in xcode 4.6.3 that I have.
I tried the ./configure command with cc as gcc from xcode4.
Something like this :
./configure --prefix=armv7 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable- ffserver --enable-avresample --enable-cross-compile -- sysroot="/Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" --target-os=darwin --cc="/Applications/Xcode4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" --extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" --extra-ldflags="-arch armv7 -isysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=6.0" --arch=arm --cpu=cortex-a9 --enable-pic
It works ok but then the make command after fails like this:
libavcodec/arm/mdct_vfp.S:113:unknown register alias 'TCOS_D0_HEAD'
libavcodec/arm/mdct_vfp.S:114:unknown register alias 'TCOS_D1_HEAD'
libavcodec/arm/mdct_vfp.S:115:unknown register alias 'TCOS_S0_TAIL'
make: *** [libavcodec/arm/mdct_vfp.o] Error 1
What am I doing wrong here?? Where can I find gcc for xcode5??

How to compile VAMP Plugins to iOS ARMV7

VAMP Plugins by Queen Mary University of London is an amazing collection of BSD licensed software. All these plugins are at the basis of the Sonic Visualizer software
A plug Sdk to build plugins is available as well.
You can build the plugins for OSX / Linux / Win32 targets.
Queen Mart University explain well here the plugin architecture and how to build for different platforms specified above.
A Java version, jVamp is available as well. A Python wrapper also.
But, how to build for the iOS platform ?
So, I tried porting the Makefile to the iOS.
First I changed the file
build/osx/Makefile.osx
in this way:
CFLAGS := -O3 -ftree-vectorize -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch x86_64 -I../vamp-plugin-sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/ -DUSE_PTHREADS
CXXFLAGS := $(CFLAGS)
LDFLAGS := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch x86_64 -lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a -framework Accelerate -lpthread -exported_symbols_list=vamp-plugin.list -install_name qm-vamp-plugins.a
PLUGIN_EXT := .a
include build/general/Makefile.inc
Then build
macbookproloreto:qm-vamp-plugins loreto$ make -f build/osx/Makefile.osx
cc -O3 -ftree-vectorize -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch x86_64 -I../vamp-plugin-sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/ -DUSE_PTHREADS -I. -I../qm-dsp -c -o g2cstubs.o g2cstubs.c
c++ -O3 -ftree-vectorize -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch x86_64 -I../vamp-plugin-sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/ -DUSE_PTHREADS -I. -I../qm-dsp -c -o plugins/AdaptiveSpectrogram.o plugins/AdaptiveSpectrogram.cpp
In file included from plugins/AdaptiveSpectrogram.cpp:15:
In file included from plugins/AdaptiveSpectrogram.h:18:
In file included from ../vamp-plugin-sdk/vamp-sdk/Plugin.h:40:
In file included from /usr/bin/../lib/c++/v1/string:430:
In file included from /usr/bin/../lib/c++/v1/iosfwd:90:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/wchar.h:70:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/_types.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/sys/_types.h:32:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/sys/cdefs.h:655:2: **error: Unsupported
architecture
#error Unsupported architecture
^**
The first issue here is that there is a unsupported architecture.
So the plugins depends on the SDK I had to build that one first:
cd /Users/loreto/Projects/AUDIO/VAMP/vamp-plugin-sdk
make -f build/Makefile.osx
Different errors occurred since I had no OGG/VORBIS library and no LOGG library. So I slightly modified the Makefile.osx removing these dependencies in the HOST_LIB flags. I had to keep libsndfile anyway:
HOST_LIBS = ./libvamp-hostsdk.a -L../10.8/inst/lib -lsndfile -ldl
So I was able to build the static libraries here:
macbookproloreto:vamp-plugin-sdk loreto$ ls -l *.a
-rw-r--r-- 1 loreto staff 709840 17 Ott 23:56 libvamp-hostsdk.a
-rw-r--r-- 1 loreto staff 183720 17 Ott 23:56 libvamp-sdk.a
Of course these static libs are targeted to arch x86_64 so I need to add armv7 arch:
ARCHFLAGS = -mmacosx-version-min=$(MINVERSION) -arch x86_64 -arch armv7
Then make clean and compile again
macbookproloreto:vamp-plugin-sdk loreto$ make -f build/Makefile.osx clean
macbookproloreto:vamp-plugin-sdk loreto$ make -f build/Makefile.osx
c++ -mmacosx-version-min=10.8 -arch x86_64 -arch armv7 -O2 -Wall -I. -I../10.8/inst/include -fPIC -c -o src/vamp-sdk/PluginAdapter.o src/vamp-sdk/PluginAdapter.cpp
In file included from src/vamp-sdk/PluginAdapter.cpp:37:
In file included from ./vamp-sdk/PluginAdapter.h:40:
In file included from /usr/include/c++/4.2.1/map:64:
In file included from /usr/include/c++/4.2.1/bits/stl_tree.h:68:
In file included from /usr/include/c++/4.2.1/bits/stl_algobase.h:65:
In file included from /usr/include/c++/4.2.1/bits/c++config.h:41:
In file included from /usr/include/c++/4.2.1/bits/os_defines.h:61:
In file included from /usr/include/unistd.h:71:
In file included from /usr/include/_types.h:27:
In file included from /usr/include/sys/_types.h:33:
/usr/include/machine/_types.h:34:10: fatal error: 'arm/_types.h' file not found
#include "arm/_types.h"
^
1 error generated.
make: *** [src/vamp-sdk/PluginAdapter.o] Error 1
Type definitions for arm was not found! The problem here is that the right path was
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/arm/_types.h
Ok let's fix this in the Makefile.osx again:
ARCHFLAGS = -mmacosx-version-min=$(MINVERSION) -arch armv7
CFLAGS = $(ARCHFLAGS) -fPIC --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/
CXXFLAGS = $(ARCHFLAGS) -O2 -Wall -I. -fPIC
CPPFLAGS ="-pipe -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
then make the static targets:
make -f build/Makefile.osx sdkstatic
Wow it worked! I have a vamp host sdk .a for iOS! (I suppose to have let's say)
macbookproloreto:vamp-plugin-sdk loreto$ ls -l *.a
-rw-r--r-- 1 loreto staff 301176 18 Ott 00:35 libvamp-hostsdk.a
-rw-r--r-- 1 loreto staff 76024 18 Ott 00:35 libvamp-sdk.a
Ok but let's check with otool, since you never know:
macbookproloreto:vamp-plugin-sdk loreto$ otool -hv libvamp-sdk.a
Archive : libvamp-sdk.a
libvamp-sdk.a(PluginAdapter.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 4 1128 SUBSECTIONS_VIA_SYMBOLS
libvamp-sdk.a(RealTime.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 4 1060 SUBSECTIONS_VIA_SYMBOLS
libvamp-sdk.a(FFT.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 4 584 SUBSECTIONS_VIA_SYMBOLS
libvamp-sdk.a(acsymbols.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 3 500 SUBSECTIONS_VIA_SYMBOLS
Ok, that's the armv7 architecture.
Now, back to the plugins sdk again and change the
build/osx/Makefile.osx
as follows:
CFLAGS := -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/ -DUSE_PTHREADS
CXXFLAGS := $(CFLAGS)
include build/general/Makefile.inc
Ok back again and make:
macbookproloreto:dsp loreto$ make -f build/osx/Makefile.osx
Boom! Another problem:
/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/ -DUSE_PTHREADS -I. -c -o dsp/wavelet/Wavelet.o dsp/wavelet/Wavelet.cpp
cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/ -DUSE_PTHREADS -I. -c -o hmm/hmm.o hmm/hmm.c
hmm/hmm.c:21:10: fatal error: 'clapack.h' file not found
#include <clapack.h> /* LAPACK for matrix inversion */
^
1 error generated.
make: *** [hmm/hmm.o] Error 1
macbookproloreto:dsp loreto$ vi build/osx/Makefile.osx
LAPACK not found.
But as for Apple Docs here, Apple introduced LAPACK in the Accelerate.frameworks since iOS4.0!
In fact clapack.h is here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h
So let's add this somewhere in the ../dsp/build/Makefile.osx
CFLAGS := -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/ -DUSE_PTHREADS
And now let's make it again, but let me check the arch:
macbookproloreto:dsp loreto$ otool -hv libqm-dsp.a
Archive : libqm-dsp.a
libqm-dsp.a(Pitch.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 4 516 SUBSECTIONS_VIA_SYMBOLS
libqm-dsp.a(Chromagram.o):
Mach header
Sound good! One level back in the plugins folder now and make
In file included from plugins/AdaptiveSpectrogram.cpp:15:
plugins/AdaptiveSpectrogram.h:22:10: fatal error: 'dsp/transforms/FFT.h' file not found
#include <dsp/transforms/FFT.h>
^
1 error generated.
Uhm ok the dsp/ misses the tranforms folder - gosh!
Another error:
clang: error: invalid argument '-install_name qm-vamp-plugins.a' only allowed with '-dynamiclib'
make: *** [qm-vamp-plugins.a] Error 1
Let's fix again the Makefile.osx:
CFLAGS := -O3 -ftree-vectorize -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch armv7 -I../vamp-plugin-sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/ -DUSE_PTHREADS
CXXFLAGS := $(CFLAGS)
LDFLAGS := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch armv7 -lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a -framework Accelerate -lpthread
Ok, now the error is architecture undefined symbol errors: to long look at the gist here
like:
"std::cerr", referenced from:
"typeinfo for std::istream", referenced from:
"std::ostream::put(char)""
std::ostream::operator<<(int)",
This reminds me to the boost C++ libraries!
So I need to get boost, compile for iOS then include it in the Makefile and it should work, isn't it ? This could take long...
So do this by now
macbookproloreto:vamp-plugin-sdk loreto$ echo $'\360\237\215\272'
After getting boost as iOS framework distribution from here and adding
-I/Users/loreto/Projects/AUDIO/LIBS/boost-ios/Dist/boost.framework/Headers/
I have the same error...uhm I suppose I'm missing the standard C++ library here!
macbookproloreto:Headers loreto$ locate libc++.dylib | grep iPhoneOS7.0
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libc++.dylib
bingo!
So
-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libc++.dylib
Error again (doh) !
Tried with no success
-I/usr/lib/libstdc++.dylib
-lstdc++
Stucked on a very simple linking issue.
Again.
macbookproloreto:vamp-plugin-sdk loreto$ echo $'\360\237\215\272'
The most interesting part of the error is the first static library being compiled:
make -f build/osx/Makefile.osx
c++ -o qm-vamp-plugins.a g2cstubs.o plugins/AdaptiveSpectrogram.o plugins/BarBeatTrack.o plugins/BeatTrack.o plugins/DWT.o plugins/OnsetDetect.o plugins/ChromagramPlugin.o plugins/ConstantQSpectrogram.o plugins/KeyDetect.o plugins/MFCCPlugin.o plugins/SegmenterPlugin.o plugins/SimilarityPlugin.o plugins/TonalChangeDetect.o plugins/Transcription.o libmain.o -L../qm-dsp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch armv7 -lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a -framework Accelerate -lpthread
Undefined symbols for architecture armv7:
"std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:
_VampPlugin::Vamp::RealTime::toString() const in libvamp-sdk.a(RealTime.o)
_VampPlugin::Vamp::RealTime::toText(bool) const in libvamp-sdk.a(RealTime.o)
"std::basic_ios<char, std::char_traits<char> >::widen(char) const", referenced from:
_VampPlugin::Vamp::PluginAdapterBase::Impl::getDescriptor() in libvamp-sdk.a(PluginAdapter.o)
Here we can see that one of the static library compiled does not contain the right architecture.
I have two static libraries here:
lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a
If I run otool on that I can see that the cpu time is ARM7 for both of them:
macbookproloreto:qm-vamp-plugins loreto$ otool -hv ../vamp-plugin-sdk/libvamp-sdk.a
Archive : ../vamp-plugin-sdk/libvamp-sdk.a
../vamp-plugin-sdk/libvamp-sdk.a(PluginAdapter.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 OBJECT 4 1128 SUBSECTIONS_VIA_SYMBOLS
So what's the matter with Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libc++.dylib ?
Try commenting in the code the usage of the standard libraries.
It's probably only used for debug.

Can't compile libjpeg-turbo for iOS on Xcode 5 / Clang toolchain with SIMD / NEON support

Looks like with Xcode 5 and the removal of LLVM-GCC-4.2 and its replacement by Clang, building libjpeg-turbo for iOS devices now fails during the compilation of NEON support.
Configure step:
export PLATFORM="iPhoneOS"
export IPHONE_SDK="7.0"
export IPHONE_MIN_VERSION="5.0"
export DEVELOPER=`xcode-select --print-path`
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
export CC=`xcrun -find gcc`
export LD=`xcrun -find ld`
export IOS_CFLAGS="-arch armv7"
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
export CPPFLAGS="${CFLAGS}"
export CFLAGS="${CFLAGS} -miphoneos-version-min=${IPHONE_MIN_VERSION}"
./configure --with-jpeg8 --host arm-apple-darwin --enable-static --disable-shared
...
checking if we have SIMD optimisations for cpu type... yes (arm)
checking if the assembler is GNU-compatible and can be used... yes
...
Build step:
make -j4
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in java
echo timestamp > classnodist_noinst.stamp
Making all in simd
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -E -I.. -I../simd ./jsimdcfg.inc.h | grep -E "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's#% define#%define#g' > jsimdcfg.inc
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
if /bin/sh ../libtool --mode=compile --tag=CC /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF ".deps/jsimd_arm.Tpo" -c -o jsimd_arm.lo jsimd_arm.c; \
then mv -f ".deps/jsimd_arm.Tpo" ".deps/jsimd_arm.Plo"; else rm -f ".deps/jsimd_arm.Tpo"; exit 1; fi
/bin/sh ../libtool --mode=compile gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -c -o jsimd_arm_neon.lo jsimd_arm_neon.S
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
make[3]: *** [jsimd_arm_neon.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF .deps/jsimd_arm.Tpo -c jsimd_arm.c -o jsimd_arm.o
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Any idea how to fix this? The build succeeds if disabling SIMD support but that's obviously not great.
It has been fixed by the maintainer of libjpeg-turbo:
http://sourceforge.net/mailarchive/message.php?msg_id=31902025
What is needed is a special CLANG compatible version of gas-preprocessor:
http://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor/
There is a known issue when cross-compiling for iOS on OSX:
http://sourceforge.net/mailarchive/message.php?msg_id=30462917
In short, you need to run
$ autoreconf -fiv
in the libjpeg-turbo directory before running configure.
On OSX 10.9 and Xcode 5, below are the versions of tools that you will need to compile the lib successfully. Newer versions will not work.
autoconf 2.69
nasm 2.08.01
automake 1.13
Alternatively, you can just use the prebuilt binaries that comes with the DMG:
http://sourceforge.net/mailarchive/forum.php?thread_name=5255ABCE.8070705%40users.sourceforge.net&forum_name=libjpeg-turbo-users

Trying to compile the FFMPEG libraries for iPhoneOS platform with armv6 and arv7 architecture

I'm trying to compile the FFMPEG Libraries for IOS platform with arm7 architecture. I downloaded the FFMPEG libraries from http://www.ffmpeg.org.
I'm successfully able to build the static libraries for the i386 architecture for the iPhoneSimulator. But I need the libraries for iPhoneOS. Using the configure command I'm getting an error. Below are my command details.
For i386(which is error free):
./configure --enable-cross-compile --disable-debug --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-network --disable-everything --enable-protocol=file --enable-demuxer=mov --enable-muxer=mpegts --enable-bsf=h264_mp4toannexb --arch=i386 --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --as='./gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneOS6.1.sdk --cpu=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk' --prefix="/Users/amit/Desktop/LivuLib-master/LivuLIb/ffmpeg/bin/newLib"
For armv7:
./configure --enable-cross-compile --disable-debug --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-network --disable-everything --enable-protocol=file --enable-demuxer=mov --enable-muxer=mpegts --enable-bsf=h264_mp4toannexb --arch=armv7 --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='./gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk --cpu=cortex-a9 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' --prefix="/Users/amit/Desktop/LivuLib-master/LivuLIb/ffmpeg/bin/newLib"
For above command for Arm7 I'm getting this error:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN.
So please suggest me a possible solution. Why is it not working? Or do I need to update anything. Thanks.
I realize this question was asked about ~2.5 months ago, so the asker may have moved on, but I came across it while searching for an answer to the same issue. So, hopefully, this will be of help to someone out there!
All I really had to do was verify that ALL the paths I was using were actually pointing to something that existed.
Specifically, I was trying to run:
./configure \
--prefix=armv7 \
--disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver \
--enable-avresample --enable-cross-compile \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk" \
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" \
--extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" \
--extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -miphoneos-version-min=6.0" \
--arch=arm --cpu=cortex-a9 --enable-pic
^ from http://www.tangentsoftworks.com/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/
When I couldn't get it to work, I decided to stop being lazy and actually checked the directories listed in the paths: anything that starts with "/Applications/...".
What I found is that I didn't have "iPhoneOS6.0.sdk" (it's referenced above in the paths) installed.
Changing the script to this worked:
./configure \
--prefix=armv7 \
--disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver \
--enable-avresample --enable-cross-compile \
--sysroot="/applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk" \
--target-os=darwin --cc="/applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" \
--extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" \
--extra-ldflags="-arch armv7 -isysroot /applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.0" \
--arch=arm --cpu=cortex-a9 --enable-pic
In short, just double-check your paths. Hope that helps!

Resources