Cómo comstackr complementos VAMP para iOS ARMV7

Complementos VAMP de la Universidad Queen Mary de Londres es una sorprendente colección de software con licencia BSD. Todos estos complementos están en la base del software Sonic Visualizer . También hay disponible un complemento Sdk para comstackr complementos.

Puede crear los complementos para los objectives OSX / Linux / Win32.

La Universidad Queen Mart explica bien aquí la architecture del complemento y cómo build para las diferentes plataforms especificadas anteriormente.

Una versión de Java, jVamp también está disponible. Una envoltura de Python también.

¿Pero cómo build para la plataforma iOS?

Entonces, intenté portar Makefile al iOS.

Primero cambié el file

build/osx/Makefile.osx 

De este modo:

 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 

Luego comstack

 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 ^** 

El primer problema aquí es que hay una architecture no compatible.

Entonces, los complementos dependen del SDK. Tuve que build uno primero:

 cd /Users/loreto/Projects/AUDIO/VAMP/vamp-plugin-sdk make -f build/Makefile.osx 

Se produjeron diferentes errores ya que no tenía una biblioteca OGG / VORBIS y ninguna biblioteca LOGG. Así que modifiqué un poco el Makefile.osx eliminando estas dependencies en las banderas HOST_LIB. Tuve que mantener libsndfile de todos modos:

 HOST_LIBS = ./libvamp-hostsdk.a -L../10.8/inst/lib -lsndfile -ldl 

Entonces pude build las bibliotecas estáticas aquí:

 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 

Por supuesto, estas libs estáticas están dirigidas a archir x86_64, así que necesito agregar el arco armv7:

 ARCHFLAGS = -mmacosx-version-min=$(MINVERSION) -arch x86_64 -arch armv7 

Luego limpia y vuelve a comstackr

 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 

¡No se encontraron las definiciones de tipo para arm! El problema aquí es que el path correcto fue

 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/arm/_types.h 

Ok, arreglemos esto en Makefile.osx nuevamente:

 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 

luego crea los objectives estáticos:

 make -f build/Makefile.osx sdkstatic 

¡Guau, funcionó! ¡Tengo un vamp sdk .a para iOS! (Supongo que tenemos que decir)

 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 pero vamos a ver con otool, ya que nunca se sabe:

 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, esa es la architecture armv7.

Ahora, regrese al sdk de los complementos nuevamente y cambie el

 build/osx/Makefile.osx 

como sigue:

 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 

Vale de nuevo y haz:

 macbookproloreto:dsp loreto$ make -f build/osx/Makefile.osx 

¡Auge! Otro problema:

 /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 no encontrado

¡Pero en cuanto a Apple Docs aquí , Apple introdujo LAPACK en Accelerate.frameworks desde iOS4.0!

De hecho, clapack.h está aquí: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework /Headers/clapack.h

Entonces, agregue esto en alguna parte del …/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 

Y ahora hagámoslo nuevamente, pero permítanme revisar el arco:

 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 

¡Suena bien! Un nivel atrás en la carpeta de complementos ahora y haga

 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 el dsp / misses la carpeta tranforms – ¡Dios mío!

Otro error:

 clang: error: invalid argument '-install_name qm-vamp-plugins.a' only allowed with '-dynamiclib' make: *** [qm-vamp-plugins.a] Error 1 

Reparemos nuevamente el file 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, ahora el error es la architecture indefinida de los errores de símbolo: para mirar largamente la esencia aquí como:

  "std::cerr", referenced from: "typeinfo for std::istream", referenced from: "std::ostream::put(char)"" std::ostream::operator<<(int)", 

¡Esto me restring a las bibliotecas de impulso de C ++!

Entonces necesito boost, comstackr para iOS y luego includelo en Makefile y debería funcionar, ¿no? Esto podría tomar mucho time …

Entonces haz esto por ahora

 macbookproloreto:vamp-plugin-sdk loreto$ echo $'\360\237\215\272' 

http://i.stack.imgur.com/ff3kp.png

Después de get impulso como distribución de framework iOS desde aquí y agregar

-I / Users / loreto / Projects / AUDIO / LIBS / boost-ios / Dist / boost.framework / Headers /

Tengo el mismo error … uhm ¡Supongo que me estoy perdiendo la biblioteca C ++ estándar aquí!

 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!

Asi que

 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libc++.dylib 

Error de nuevo (doh)!

Intentado sin éxito

  -I/usr/lib/libstdc++.dylib -lstdc++ 

Atrapado en un problema de enlace muy simple.

De nuevo.

 macbookproloreto:vamp-plugin-sdk loreto$ echo $'\360\237\215\272' 

http://i.stack.imgur.com/ff3kp.png

La parte más interesante del error es la primera biblioteca estática que se está comstackndo:

 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) 

Aquí podemos ver que una de las comstackciones de la biblioteca estática no contiene la architecture adecuada.

Aquí tengo dos bibliotecas estáticas:

 lqm-dsp ../vamp-plugin-sdk/libvamp-sdk.a 

Si ejecuto otool en eso puedo ver que el time de CPU es ARM7 para ambos:

 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 

Entonces, ¿qué pasa con el desarrollador / SDK / iPhoneOS7.0.sdk / usr / lib / libc ++. Dylib?

Intente comentar en el código el uso de las bibliotecas estándar.

Probablemente solo se use para depurar.