Friday, January 11, 2013

Compile OpenCore-amr for iOS Projects


I really had a hard time compiling OpenCore-amr for my iphone application meant for ios 6.0.

Special thanks to all those people / websites who guided me and i was able to finish up the task.

Follow the steps and may be it could help you :

Step - 1 : I downloaded from http://kakola.googlecode.com/files/opencore-amr-0.1.2.tar.gz

Step - 2 : Place this folder on your macbook
               (i placed in a folder named Compile-Opencore)

Step - 3 : Open the Terminal

Step - 4 : Change the directory to move to the downloaded opencore-amr-0.1.2 directory
               $ cd /Users/Swati/Compile-Opencore/opencore-amr-0.1.2 


Step - 5 : Execute configure
              $ /Users/Swati/Compile-Opencore/opencore-amr
             -0.1.2/configure

This command will start Checking like : 
             checking for a BSD-compatible install... /usr/bin/install -c
             checking for gcc... gcc

             checking if libtool supports shared libraries... yes
             checking if gcc supports -c -o file.o... yes
             checking if gcc supports -c -o file.o... (cached) yes
etc...

Step - 6 : Call make
               $ make

Step - 7 : Call make install
               $ sudo make install 
               Password:

Step - 8 : Remember to check path of xcode
               $ xcode-select -print-path
               /Applications/Xcode.app/Contents/Developer

Step - 9 : Execute shell script
               $ /Users/Swati/Compile-Opencore/opencore-amr
              -0.1.2/build_osx.sh 

Step - 10 : configure library for armv7s
                $ <path_idz_configure.sh> <architecture> <ios_version>
                   <path_configure_opencore-amr-0.1.2>
                $ /Users/swatisrivastava/Documents/Swati/Compile
                  -Opencore/opencore-amr-0.1.2/idz_configure.sh armv7s 
                  6.0 /Users/Swati/Compile-Opencore/opencore-amr
                 -0.1.2/configure

Above step may result in errors like : 
configure: error: source directory already configured; run "make distclean" there first
make: *** No rule to make target `clean'.  Stop.
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.

Step - 11 : Do cleaning if error occurs in Step - 9
                 $ make distclean

Step - 12 : Again configure for armv7s
                 $ /Users/Swati/Compile-Opencore/opencore-amr
                    -0.1.2/idz_configure.sh  armv7s 6.0 /Users/Swati/
                    Compile-Opencore/opencore-amr-0.1.2/configure

Step - 13 : Configure for armv7 also
                 $ /Users/Swati/Compile-Opencore/opencore-amr-0.1.2/
                     idz_configure.sh  armv7 6.0 /Users/Swati/Compile-Opencore
                     /opencore-amr-0.1.2/configure

Step - 14 : Configure for i386 also
                 $ /Users/Swati/Compile-Opencore/opencore-amr-0.1.2/
                     idz_configure.sh i386  6.0 /Users/Swati/Compile-Opencore/
                     opencore-amr-0.1.2/configure

Step - 15 : You can view the libraries here:

Inside your opencore-amr-0.1.2 folder : you can see 6 new folders :
build-iPhoneOS-armv7 and install-iPhoneOS-armv7
build-iPhoneOS-armv7s and install-iPhoneOS-armv7s
build-iPhoneSimulator-i386 and install-iPhoneSimulator-i386

goto install-iPhoneOs-armv7 folder >> lib folder >> here u can see library files specific to armv7 architecture namely : 
   a) libopencore-amrnb.a 
   b) libopencore-amrwb.a






Similarly u can get libraries of each architecture.

Step - 16 :  Command to create a single "Universal" .a library that contains the features of all 3 libraries
                  $ lipo -create 
                  <path_of_armv7_libopencore-amrnb.a>
                  <path_of_armv7s_libopencore-amrnb.a> 
                  <path_of_i386_libopencore-amrnb.a>
                  -output <path_universal_libopencore-amrnb.a>

                                                   &

                  $ lipo -create 
                  <path_of_armv7_libopencore-amrwb.a>
                  <path_of_armv7s_libopencore-amrwb.a> 
                  <path_of_i386_libopencore-amrwb.a>
                  -output <path_universal_libopencore-amrwb.a>

Hope it helps.
Enjoy compiling...
:)

11 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. I solved previous trouble, but now I'm stuck on error
      $ ./idz_configure.sh armv7s 6.1 ./configure
      >>libtool: link: `wrapper.lo' is not a valid libtool object

      What's wrong? Do you have any opinion?

      Delete
    2. God, why are they just compile after my messages? :)
      Thanks you, Swati!

      Delete
  2. Instead of armv7s have u tried fr i386 and armv7???

    ReplyDelete
    Replies
    1. Hi Swati,thanks for the nice info.I am implementing amr codec on ios,but I am getting stucked at step 10 and getting the same error again and again(even after make clean/make distclean).Could you please suggest how to overcome from this error and share a idz_configure.sh file.Thanks.

      Delete
  3. Hi,Swati,I tried to follow your steps but failed at Step 10 with an error "idz_configure.sh: no such file or directory".Where is the idz_configure.sh coming from? Is it generated by any of your step? Could you please share an idz_configure.sh file example with me? Please note,at Step 9,I have made the following changes in build_osx.sh: (a)change "/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" to "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7" to reflect my mac dev environment;(b)delete "-arch ppc" since I don't need to support ppc CPU.
    Thanks a lot for advice or help in advance!
    -Alex

    ReplyDelete
  4. Hi Swati,

    Thanks a lot for this nice info.I was trying installing amr codec on ios but after configuring at step 10,I am getting the same error whatever you have mentioned and the same error persists even after configuring again(after doing make clean/make distclean).Could you please suggest how to overcome from this error and share any idz_configure.sh that will work.Thanks

    ReplyDelete
  5. Even i am stuck at Step 10 with the below error, any help is appreciated.

    configure: error: in `/Users/admin/Avinash/Samples/Compile-Opencore/opencore-amr-iOS-master':
    configure: error: C++ compiler cannot create executables

    ReplyDelete
    Replies
    1. Is the content properly downloaded in step -1?. One of my friends faced similar issue but re-downloading helped him as some files were missing in the folder.

      Delete
  6. Nice Work Guys, So when you need any converter for one file to another then use this;

    Solo File Converter

    ReplyDelete