㈠ ios 怎麼配置編譯ffmpeg
一、系統環境
MAC OS X Mountain Lion 10.8.3、 XCode 5.1
二、編譯FFMpeg
1、下載ffmpeg2.2.5版本代碼,並解壓。
2、下載並解壓gas-preprocessor.pl (附件中有,zip格式,因網易博客不能上傳zip後綴的文件,故加了個.rar)
在終端中使用cp命令將它復制到 /usr/sbin/目錄,並賦予可執行許可權。
sudo cp -f gas-preprocessor/gas-preprocessor.pl /usr/sbin/chmod +x /usr/sbin/gas-preprocessor.pl
3、在ffmpeg目錄下創建一個config.sh腳本
#!/bin/bash
SDKVERSION="7.1"
ARCHS="armv7 armv7s i386"
DEVELOPER=`xcode-select -print-path`
cd "`dirname "$0"`"
REPOROOT=$(pwd)
# where we will store intermediary builds
INTERDIR="${REPOROOT}/built"
mkdir -p $INTERDIR
########################################
# Exit the script if an error happens
for ARCH in ${ARCHS}
do
if [ "${ARCH}" == "i386" ];
then
PLATFORM="iPhoneSimulator"
EXTRA_CONFIG="--arch=i386 --disable-asm --enable-cross-compile --target-os=darwin --cpu=i386"
EXTRA_CFLAGS="-arch i386"
EXTRA_LDFLAGS="-I${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk/usr/lib"
else
PLATFORM="iPhoneOS"
EXTRA_CONFIG="--arch=arm --target-os=darwin --enable-cross-compile --cpu=cortex-a9 --disable-armv5te"
EXTRA_CFLAGS="-w -arch ${ARCH}"
fi
mkdir -p "${INTERDIR}/${ARCH}"
./configure --prefix="${INTERDIR}/${ARCH}"
--disable-neon
--disable-armv6
--disable-armv6t2
--disable-ffmpeg
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-iconv
--disable-bzlib
--enable-avresample
--sysroot="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
--cc="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
--as='/usr/local/bin/gas-preprocessor.pl'
--extra-cflags="${EXTRA_CFLAGS} -miphoneos-version-min=${SDKVERSION}"
--extra-ldflags="-arch ${ARCH} ${EXTRA_LDFLAGS} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk -miphoneos-version-min=${SDKVERSION}" ${EXTRA_CONFIG}
--enable-pic
--extra-cxxflags="$CPPFLAGS -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
make && make install && make clean
done
mkdir -p "${INTERDIR}/universal/lib"
cd "${INTERDIR}/armv7/lib"
for file in *.a
do
cd ${INTERDIR}
xcrun -sdk iphoneos lipo -output universal/lib/$file -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$file
echo "Universal $file created."
done
cp -r ${INTERDIR}/armv7/include ${INTERDIR}/universal/
echo "Done."
SDKVERSION 是XCode的版本,通過`xcode-select -print-path`來獲取XCode的安裝路徑,ARCHS是編譯的三種模式,接下來在終端中cd到ffmpeg目錄,./config.sh執行就可以編譯了。等到編譯完成後,在ffmpeg目錄下會多出一個built目錄,裡面分別是armv7 armv7s i386及三個合並的universal版本了。
㈡ linux下面進行8086匯編
linux的內核中有很多匯編語言,但gcc是linux的唯一指定編譯器,說明匯編的編譯同樣使用gcc,只是命令參數不一樣
我美編寫過8086匯編,但我編譯過內核,確實不需要其他編譯器
回答補充:
原來是編輯器的問題,我還以為你找的全套流程呢。
我連vim都沒碰過,平時都是gedit,只有自動縮進一項功能,還很弱智,幫不上你了
這兒一點參考資料,貼出來,雖然有可能用不上
http://www.ibm.com/developerworks/cn/linux/l-assembly/
㈢ 如何讓FFmpeg在iOS上完美編譯
編譯mac上基於ffmepg的軟體需要先下載兩個程序:iFrameExractor和ffmpeg編譯步驟:1、在終端下:cd/iFrameExtractor/ffmpeg建議開始就執行sudo-s(獲取許可權命令)2、在終端下輸入./configure--prefix=/iFrameExtractor/ffmpeg--libdir=iFrameExtractor/ffmpeg/lib--enable-gpl--enable-static--disable-shared--enable-swscale--enable-zlib--enable-bzlib--disable-ffmpeg--disable-ffplay--disable-ffserver--enable-pthreads3、執行make這里會有一堆的編譯情況。註:最好先升級CommandLineTools,避免編譯錯誤4、執行makeinstall。(執行完後到iFrameExtractor/ffmpeg/lib文件上去看看)出現個.a文件5、用xcode打開iFrameExractor工程,確認HeaderSearchPaths里有:"$(SRCROOT)/ffmpeg"路徑。$(SRCROOT)表示工程路徑。同時可以看到iFrameExractor工程下ffmpeg文件下的.a文件都不是紅色的了。6、真機上編譯(模擬器上i386,真機上是arm的,真機還分arm6和arm7以下是針對arm7的/configure--disable-doc--disable-ffmpeg--disable-ffplay--disable-ffserver--enable-cross-compile--arch=arm--target-os=darwin--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc--as='gas-preprocessor/gas-preprocessor.pl/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc'--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk--cpu=cortex-a8--extra-cflags='-archarmv7'--extra-ldflags='-archarmv7-isysroot/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk'--enable-pic7、執行make和makeinstall就有上面的幾個.a文件,至此編譯結束。
㈣ 如何構建MIPS交叉編譯工具鏈
第一步 創建目錄以及環境變數
在當前用戶目錄下創建target-project文件夾,在該文件夾下創建mips-mole文件夾,在mips-mole文件夾下創建三個文件夾:build-tools,kernel,tools,最後,在build-tools文件夾下創建build-gcc,build-boot-gcc,build-glibc,build-binutils文件夾。命令如下:
$ cd ~
$ mkdir -p ./target-project/mips-mole/{kernel/,tools/,build-tools/{build-gcc,build-boot-gcc,build-glibc,build-binutils}}
$ tree ./target-project/mips-mole/
使用腳本構建環境變數
#! /bin/bash
注意修改/home/用戶名,修改正確後,使用source使腳本生效
$ cd target-project
$ chmod +x mips.sh
$ source mips.sh
可以使用echo査看相關變數名以觀察環境變數是否生效。
最後把linux-2.6.38.tar.bz2下載放置在kernel文件夾下,binutils-2.22.tar.gz,gcc-4.6.2.tar.gz,glibc-2.14.tar.gz,glibc-ports-2.14.tar.gz,gmp-5.0.4.tar.gz,mpc-0.9.tar.gz,mpfr-3.0.1.tar.gz下載放置在build-tools文件夾下。
第二步 安裝基於MIPS的linux頭文件
$ cd $PRJROOT/kernel
$ tar -xjvf linux-2.6.38.tar.bz2
$ cd linux-2.6.38
在指定路徑下創建include文件夾,用來存放相關頭文件。
$ mkdir -p $TARGET_PREFIX/include
保證linux源碼是干凈的。
$ make mrproper
生成需要的頭文件。
$ make ARCH=mips headers_check
$ make ARCH=mips INSTALL_HDR_PATH=dest headers_install
將dest文件夾下的所有文件復制到指定的include文件夾內。
$ cp -rv dest/include/* $TARGET_PREFIX/include
最後刪除dest文件夾
$ rm -rf dest
$ ls -l $TARGET_PREFIX/include
第三步 安裝binutils-2.22
$ cd $PRJROOT/build-tools
$ tar -xzvf binutils-2.22.tar.gz
$ cd build-binutils
$ ../binutils-2.22/configure --target=$TARGET --prefix=$PREFIX
$ make
$ make install
再安裝automake。
$ tar -xzvf automake-1.11.1.tar.gz
$ cd automake-1.11.1
$ ./configure
$ make
$ sudo make install
下面開始修改相關文件,主要是去掉-Werror。
$ cd $PRJROOT/build-tools/binutils-2.22/gas
$ ge dit configure
將下面內容
# Enable -Werror by default when using gcc
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
ERROR_ON_WARNING=yes
fi
修改為
# Enable -Werror by default when using gcc
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
ERROR_ON_WARNING=no
fi
但是,需要重新configure生成Makefile.in。
$ ./configure (在binutils/gas路徑下的configure)
$ make distclean (切記)
然後重新執行第三步,這次編譯可過。
第四步 安裝gcc引導器
$ cd $PRJROOT/build-tools
$ tar -xzvf gcc-4.6.2.tar.gz
$ tar -xjvf gmp-5.0.4.tar.bz2
$ mv gmp-5.0.4 ./gcc-4.6.2/gmp
$ tar -xzvf mpc-0.9.tar.gz
$ mv mpc-0.9 ./gcc-4.6.2/mpc
$ tar -xzvf mpfr-3.0.1.tar.gz
$ mv mpfr-3.0.1 ./gcc-4.6.2/mpfr
$ cd build-boot-gcc
$ ../gcc-4.6.2/configure --target=$TARGET --prefix=$PREFIX --disable-shared <br>--without-headers --with-newlib --enable-languages=c --disable-decimal-float <br>--disable-libgomp --disable-libmudflap --disable-libssp --disable-threads --disable-multilib
編譯並安裝gcc引導器、libgcc庫。
$ make all-gcc
$ make all-target-libgcc
$ make install-gcc
$ make install-target-libgcc
第五步 編譯glibc
$ cd $PRJROOT/build-tools
$ tar xzvf glibc-2.14.tar.gz
$ cd glibc-2.14
刪除Makefonfig文件中的內容-lgcc_eh。
$ cp -v Makeconfig{,.b腸花斑拘職餃辦邪暴矛k}
$ sed -e 's/-lgcc_eh//g' Makeconfig.bk > Makeconfig
$ cd ..
$ tar -xjvf glibc-ports-2.14.tar.bz2
$ mv glibc-ports-2.14 ./glibc-2.14/ports
$ cd build-glibc
$ CC=mipsel-linux--gcc ../glibc-2.14/configure --host=$TARGET --prefix="/usr" <br>--enable-add-ons --with-headers=$TARGET_PREFIX/include libc_cv_forced_unwind=yes <br>libc_cv_c_cleanup=yes
注意:此時如何設置了LD_LIBRARY_PATH環境變數會configure error,需要刪除該變數重新configure。
$ make
$ make install_root=$TARGET_PREFIX prefix=」」 install
第六步 完全安裝gcc
首先,也是很重要的是去掉libc等庫文件的絕對路徑。
$ cd $TARGET_PREFIX/lib
備份一下。
$ cp libc.so libc.so.bk
$ gedit libc.so
將原內容
GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a AS_NEEDED ( /lib/ld.so.1 ) )
修改為
GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld.so.1 ) )
$ cp libpthread.so libpthread.so.bk
$ gedit libpthread.so
將原內容
GROUP ( /lib/libpthread.so.0 /lib/libpthread_nonshared.a )
修改為
GROUP ( libpthread.so.0 libpthread_nonshared.a )
然後可以完全編譯gcc。
㈤ 匯編語言編程工具
windows 可以用輕松匯編開發
DOS下常用的工具MASM和TASM
Linux下的匯編工具: Linux下的匯編工具可謂百家爭鳴,不像DOS下都要給MASM和TASM給控制了。但是Linux下每一種匯編工具都有很大的區別,要想全部掌握幾乎是不可能的,下面我介紹幾種常用的匯編工具,重點介紹NASM及其使用和語法。 1、GCC GCC其實是GNU的C語言產品,但它支持Inline Assemble,在GCC中inline assemble使用就像宏一樣,但它比宏能更清楚更准確的表達機器的工作狀態。 C是匯編編程的一個高度概括,它可以減少許多匯編中的麻煩,特別是在GCC這個C編譯器中,assemble似乎起不了多大的作用。 2、GAS GAS是Linux各版本中基本的匯編工具,但它採用的是AT&T的語法標准與Intel的語法標准有很大的不同,對於DOS編程的我們來說,學習起來是非常困難的。當然如果要精通Linux下的匯編編程,學習GAS也是非常必要的,具體的語法標准可以參看Using GNU Assembler。 3、GASP GASP是GAS的擴展,它增強了GAS對宏的支持。 4、NASM NASM是linux中語法與DOS最為相像的一種匯編工具。雖說如此,它與MASM也是有著很大區別的。 l NASM的使用格式如下: Nasm �Cf -o 例如: Nasm -f elf hello.asm 將把hello.asm匯編成ELF object文件,而 Nasm -f bin hello.asm -o hello.com 會把hello.asm匯編成二進制可執行文件hello.com Nasm �Ch 將會列出NASM命令行的完整說明。 NASM不會有任何輸出,除非有錯誤發生。 -f 在Linux下主要有aout和ELF兩種,如果你不確定你的Linux系統應該用AOUT還是ELF,可以在NASM目錄中輸入 File nasm ,如果輸出nasm: ELF 32-bit LSB executable i386 (386 and up) Version 1表示是ELF,如果輸出nasm: Linux/i386 demand-paged executable (QMAGIC)表示是aout。
NASM與MASM的主要不同: 首先與linux系統一樣,nasm是區分大小寫的,Hello與hello將是不同的標識符,如果要匯編到DOS或OS/2,需要加入UPPERCASE參數。 其次,nasm中內存操作數都是以[ ]表示。 在MASM中 foo equ 1 bar dw 2 mov ax,foo mov ax,bar 將被匯編成完全不同的指令,雖然它們在MASM中的表達方式完全一樣。而NASM完全避免了這種混亂,它使用的是這樣的規則:所有對內存的操作都必須通過[ ]來實現。例如上例中對bar的操作就要寫成如下形式 mov ax,[bar]。由此可見,nasm中對offset的使用也是沒有必要的(nasm中無offset)。Nasm對[ ]的使用與masm也有所不同,所有的表達式都必須寫在[ ]中,下面舉兩個例子來說明: Masm Nasm Mov ax,table[di] Mov ax,[table+di] Mov ax,es:[di] Mov ax,[es:di] Mov ax,[di]+1 Mov ax,[di+1] Nasm 中不存儲變數類型,原因很簡單masm中通過[ ]定址方式的變數也必須要指定類型。Nasm中不支持LODS, MOVS, STOS, SCAS, CMPS, INS, OUTS,只支持lodsb、lodsw等已經指定類型的操作。Nasm中不再有assume操作,段地址完全取決於存入段寄存器的值。 關於NASM的使用方法及語法還可以參閱NASM使用手冊。
至於下載,你就自己找就是了。很容易就找到了,我給你幾個啊
輕松匯編:http://www.skycn.com/soft/20135.html#download
masm:http://download.pchome.net/development/linetools/download-10660.html
nasm:http://download.chinaunix.net/download/0008000/7201.shtml
gas:http://www.linuxsir.org/bbs/showthread.php?t=184320
gcc:http://download.chinaunix.net/download/0001000/69.shtml