Compile x264 with ndk-r4b

Source: Internet
Author: User

 

Reprinted: http://blog.csdn.net/zgyulongfei/article/details/7440254

Step: 1. decompress the x264 package. Assume that the decompressed directory is libx264.

2. Create a script file myconfig. Sh in the libx264 directory, and paste the code in myconfig. Sh.

The script is as follows:

# !/bin/sh export ARM_ROOT=/home/frank/android-ndk-r4bexport ARM_INC=$ARM_ROOT/build/platforms/android-8/arch-arm/usr/include/export ARM_LIB=$ARM_ROOT/build/platforms/android-8/arch-arm/usr/lib/export ARM_TOOL=$ARM_ROOT/build/prebuilt/linux-x86/arm-eabi-4.4.0export ARM_LIBO=$ARM_TOOL/lib/gcc/arm-eabi/4.4.0export PATH=$ARM_TOOL/bin:$PATHexport ARM_PRE=arm-eabi ./configure --disable-gpac --extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID  -Wa,--noexecstack -MMD -MP " --extra-ldflags="-nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack  -Wl,-z,nocopyreloc -Wl,-soname,/system/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -nostdlib $ARM_LIB/crtbegin_dynamic.o $ARM_LIB/crtend_android.o -lc -lm -ldl -lgcc" --cross-prefix=${ARM_PRE}- --disable-asm --host=arm-linux --disable-shared

 

3, change the first configuration export arm_root =/home/Frank/android-ndk-r4b to the path of your ndk-r4b.

4. Open the terminal, locate the terminal to the libx264 directory, enter sudo Sh./myconfig. Sh 5, and enter make when prompted to run make.

6. If the program can be compiled normally, congratulations, you have succeeded. You don't have to read the following content. If you enter make, you will see the information: /bin/sh: Arm-Eabi-GCC: The command is not found, so you and I have encountered this problem. Please refer to step 2.

7. Enter sudo gedit/etc/profile on the terminal and locate the file at the end of the opened text, enter the following script # Set arm-Eabi-GCC environment export arm_eabi_gcc =/opt/Java/ndk/android-ndk-r4b/build/prebuilt/linux-x86/bin export Path = $ arm_eabi_gcc: $ PATH Note: arm_eabi_gcc in/opt/Java/ndk/android-ndk-r4b is my ndk-r4b path, you have to modify according to your own ndk path! Save and close the text. This step aims to add environment variables for ARM-Eabi-GCC.

8. The configuration modified in the previous step takes effect only after the computer is restarted. To make the configuration take effect immediately, enter source/etc/profile on the terminal, and then enter: echo $ path: Check whether the path of arm_eabi_gcc is included in the output content. If yes, check Step 1. Otherwise, check carefully and reconfigure the environment variables.

9. After the environment variable is configured, enter the command: make. If you do not prompt that the arm-Eabi-GCC command is not found and the program is being compiled, congratulations, you will compile libx264successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.