交叉編譯libpng
我用的是qt-everywhere-opensource-src-4.7.0這個版本。不同版本配置方法有些許不同,比如說配置文件的名字目錄等。
1.解壓qt-everywhere-opensource-src-4.7.0.tar.gz
2.修改配置文件(配置文件根據你開發板和編譯工具不同而不同,不清楚你什麼環境,這是我以前的配置,linux-arm-gnueabi-g++是我用的交叉編譯工具)
qt-everywhere-opensource-src-4.7.0/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf文件修改為如下內容:
QMAKE_CC
QMAKE_CXX
QMAKE_LINK
QMAKE_LINK_SHLIB
QMAKE_AR
QMAKE_OBJCOPY
QMAKE_STRIP
QMAKE_INCDIR
QMAKE_LIBDIR
QMAKE_LIBS
把這配置都指定清楚,有編譯器,lib等,看名字應該都能理解。
3.執行。
./configure -prefix-install -prefix /opt/qt4 \
-release -opensource -shared -embedded arm \
-no-fast -largefile -exceptions \
-stl -no-qt3support \
-xmlpatterns -no-multimedia -no-audio-backend \
-no-phonon -no-phonon-backend \
-svg -no-webkit -javascript-jit \
-script -scripttools -declarative \
-no-mmx -no-3dnow -no-sse -no-sse2 \
-qt-zlib -qt-gif -qt-libtiff \
-qt-libpng -qt-libmng -qt-libjpeg \
-no-openssl \
-xplatform qws/linux-arm-gnueabi-g++ \
-qt-mouse-tslib -qt-mouse-pc -no-mouse-linuxtp -no-neon
這里給你的例子configure,你要的肯定和我的不一樣,我們需求環境都不同。每個配置項的意思不可能這里都給你說清楚,你可以--help自己理解。
4.執行make。
當然,這樣你99%是編譯不過的。有些文件需要根據你交叉編譯環境進行修改。自己多嘗試吧。我也是整了一兩個個月,才慢慢知道的。
⑵ 交叉編譯libnpg庫 ./configure CC=mipsisa32-elf-gcc --host=mipsisa32-linux 求大神給予幫助
編譯安裝。關鍵要看configure後,屏幕上出現的那一堆內容的最末尾有沒有error:
沒有就可以進行下一步。至於其他的,例如warning,可以忽略。
make和make install也是一樣
⑶ 在ARM上運行交叉編譯後的opencv文件,沒有輸出
一、交叉編譯opencv
構造:
下載:各個庫的下載可以直接搜名字到官網下載
幾個關鍵解釋:
「--prefix=」 後邊跟make install時的位置,本例中,libz在make install時將安裝到/usr/arm-linux-gnueabihf中
「--host=」 後邊跟arm-linux表明使用的是ARM環境
有configure的才能進行configure配置
4)所有的makefile修改類似
Libz的交叉編譯
第一步:# ./configure --prefix=/usr/arm-linux-gnueabihf --shared
第二步:修改makefile,主要有下邊幾個,修改的時候通篇參照即可
CC=arm-linux-gnueabihf-gcc
AR=arm-linux-gnueabihf-ar rc
RANLIB=arm-linux-gnueabihf-ranlib
STRIP = arm-linux-gnueabihf-strip
如果有ARCH的話,ARCH=ARM
第三步:#sudo make
#sudo make install
Libjpeg的交叉編譯
第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static CC=arm-linux-gnueabihf-gcc
第二步:參考1)中方法修改makefile
第三步:#sudo make
#sudo make install
Libpng的交叉編譯
第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static CC=arm-linux-gnueabihf-gcc
第二步:參考1)中方法修改makefile
第三步:#sudo make
#sudo make install
Yasm的交叉編譯
第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static
第二步:修改makefile
第三步:#sudo make
#sudo make install
Libx264的交叉編譯
第一步:#CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/usr/arm-linux-gnueabihf
第二步:修改config.mak里的參數,因為makefile要調用config.mak,所以修改方法同makefile
第三步:#sudo make
#sudo make install
Libxvid的交叉編譯
第一步:首先切換目錄 #cd build/generic
第二步:#./configure --prefix=/usr/arm-linux-gnueabihf --host=arm-linux --disable-assembly
第三步:#sudo make
#sudo make install
ffmpeg的交叉編譯
第一步:
./configure --enable-cross-compile --target-os=linux --cc=arm-linux-gnueabihf-gcc --arch=arm --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --enable-ffserver --enable-swscale --enable-pthreads --disable-yasm --disable-stripping --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/arm-linux-gnueabihf/include --extra-ldflags=-L/usr/arm-linux-gnueabihf/lib --prefix=/usr/arm-linux-gnueabihf
第二步:修改makefile文件
第三步:#sudo make
#sudo make install
第四步:將ffmpeg加入pkg-config
執行#sudo gedit /etc/bash.bashrc,在末尾加入
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/arm-linux-gnueabihf /lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:/usr/arm-linux-gnueabihf /lib/
完畢後使用命令:#source /etc/bash.bashrc
或者單獨使用三個export,不過壽命只在一個終端中,終端關閉時就失效。
幾個關鍵解釋:--extra-flags指向xvid的安裝路徑,--extra-ldflags指向x264的路徑
安裝cmake-gui
執行:#sudo apt-get install cmake-qt-gui
Opencv的交叉編譯
第一步:修改opencv/platflrms/linux/目錄下的arm-gnueabi.toolchain.cmake,將其所有刪掉,寫入:
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR arm )
set( CMAKE_C_COMPILER arm-linux-gnueabihf-gcc )
set( CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ )
第二步:在opencv目錄下新建build目錄,進入build目錄,執行命令:
#cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake ../
這時,要保證出現:
第三步:使用cmake-gui打開CMakeCache.txt,去掉所有的無關項,修改CMAKE_INSTALL_PREFIX,來確定make install的目錄
第四步:#sudo make
#sudo make install
可能出現的錯誤:
opencv編譯不通過,出現skip之類的,說明ffmpeg沒編譯好,或者其編譯好了,但是pkg-config沒有設置好,一定要設置好其環境
前邊幾步不通過的話,看看命令有沒有少,或者有沒有修改好makefile
在arm上使用時,一種方法時直接將編譯好的opencv目錄下的lib文件拷貝到開發板對應的/lib目錄下,其他或者拷貝到自己指定的目錄,並設置好環境變數即可使用
⑷ 交叉編譯opencv 自動生成zlib嗎
第一步,安裝交叉編譯工具arm-linux-gcc-4.3.2
xgy@ubuntu:~/toolchain$mkdir arm
xgy@ubuntu:~/toolchain$cd arm
xgy@ubuntu:~/toolchain/arm$tar xvf arm-linux-gcc-4.3.2
解壓後,在當目錄下會多一個usr目錄,由於我不喜歡這目錄太深,然後就執行如下命令:
xgy@ubuntu:~/toolchain/arm$cp -rv usr/local/* .
xgy@ubuntu:~/toolchain/arm$rm -rf usr
接下來設置環境變數PATH,執行命令如下:
xgy@ubuntu:~/toolchain/arm$cd
xgy@ubuntu:~$vi .bashrc
在.bashrc文件的最後加入:exportPATH=$PATH:/home/xgy/toolchain/arm/4.3.2/bin 保存退出(:wq)
xgy@ubuntu:~$source .bashrc //使剛設置的值生效
到此本來交叉編譯工具就已經安裝成功了的,可經過檢查卻發現下圖中左列的arm-linux-g++,arm-linux-gcc是4.3.3版本的(用命令arm-linux-gcc -v 查看),而其它的確是版本的,4.3.2這是一個奇怪現象!
因為我曾試過用4.3.3版本的g++交叉編譯opencv2.0總是出錯如下:
在這里,我只好創建軟鏈接,使它指向右側的arm-none-linux-gnueabi-g++,arm-none-linux-gnueabi-gcc。在創建之前先對原來的兩個文件做備份。執行命令如下:
在這里再次檢查下arm-linux-gcc及arm-linux-g++的版本
命令arm-linux-gcc –v 輸出的最後一行是應該是:gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)在這里說明下,這個很重要:現在所用的arm-linux-gcc實際上使用的是~./toolchain/arm/4.3.2/bin/目錄下的arm-none-linux-gnueabi-gcc,而它的include為arm/4.3.2/arm-none-linux-gnueabi/include,對應的lib為arm/4.3.2/arm-none-linux-gnueabi/lib,也就是說,你如果用arm-linux-gcc編譯程譯的話,對頭文件它預設的就找arm/4.3.2/arm-none-linux-gnueabi/include,對庫它預設的就找 arm/4.3.2/arm-none-linux-gnueabi/lib,而不是/usr/include /usr/lib,所以如果你要加什麼.h .a .so文件的話,記著一定要把這些文件加到這兩個目錄下去,不然這個交叉編譯器會告你找不到所要的庫或頭文件。這里的原理對於其它交叉編譯器也適應(主要指目錄結構),只是可能目錄名不一樣。
OK,到此,交編譯器安裝成功!
2012-11-2 今天換了一個4.3.2版本的arm-linux-gcc沒有發現上面的問題,也許是我以前在復制的時候出錯了,用cp命令時最好使用-a選項。
由於opencv2.0依懶於zlib,png、jpeg圖形庫而我們的arm-linux-gcc 是不帶這些庫的,它只帶了一些基本的庫,所以這里我們首先就要交叉編譯這些文件,安裝到arm/4.3.2/arm-none-linux-gnueabi/include,arm/4.3.2/arm-none-linux-gnueabi/lib目錄中。庫不一定要最新的,庫的版本太新了,opencv有可能不認識。
首先安裝zlib庫,這個是後面兩個庫的編譯基礎。
xgy@ubuntu:~/tmp$ tar zxvf zlib-1.2.3.tar.gz
在當前目錄下會多一個zlib-1.2.3的目錄。
由於 zlib 庫的configure 腳本不支持交叉編譯選項,只好自己手動臨時把 gcc 修改成指向我們的交叉編譯器 arm-linux-gcc 。執行如下命令:
xgy@ubuntu:~/tmp$ cd /usr/bin
xgy@ubuntu:/usr/bin$ sudo –i //這里得切換到root用戶下才能有許可權做下面的操作。
[sudo] password for xgy: //在這里輸入xgy用戶的密碼
root@ubuntu:~# cd /usr/bin
root@ubuntu:/usr/bin# mv gcc gcc_back
root@ubuntu:/usr/bin# mv ld ld_back
root@ubuntu:/usr/bin# ln -sv/home/xgy/toolchain/arm/4.3.2/bin/arm-linux-gcc ./gcc
root@ubuntu:/usr/bin# ln -sv/home/xgy/toolchain/arm/4.3.2/bin/arm-linux-ld ./ld
下面檢查下是否換過來了
root@ubuntu:/usr/bin#gcc –v
gcc version4.3.2 (Sourcery G++ Lite 2008q3-72) //為輸出的最後一行
root@ubuntu:/usr/bin#ld -v
GNU ld (SourceryG++ Lite 2008q3-72) 2.18.50.20080215
接著切換到原來的目錄~/tmp/zlib-1.2.3執行如下命令
root@ubuntu:/usr/bin#su – xgy //注意這里和用命令 suxgy是有區別的,-表示用xgy的環境
xgy@ubuntu:~$ cdtmp/zlib-1.2.3/
xgy@ubuntu:~/tmp/zlib-1.2.3$./configure --prefix=/home/xgy/toolchain/arm/4.3.2/arm-none-linux-gnueabi/--shared
xgy@ubuntu:~/tmp/zlib-1.2.3$make (如果以前在這個目錄下執行過make ,那要先執行makeclean 然後執行make)
xgy@ubuntu:~/tmp/zlib-1.2.3$make install
然後可以去~/toolchain/arm/4.3.2/arm-none-linux-gnueabi/{include,lib}目錄下是否多了一些文件(可以另外再開一個終端查看,這樣方便點),如下圖:
在這里記著把剛才改過的gcc再改回去,不然後面會出錯!!!
接下來安裝png庫,這個是用來顯示png圖形的。
xgy@ubuntu:~/tmp$tar jxvf libpng-1.2.18.tar.bz2
xgy@ubuntu:~/tmp$cd libpng-1.2.18/
由於libpng不提供有效的configure腳本(可以查看INSTALL文件),所以只好自己動手改Makefile文件了。
xgy@ubuntu:~/tmp/libpng-1.2.18$cp scripts/makefile.linux Makefile
xgy@ubuntu:~/tmp/libpng-1.2.18$vi Makefile
CC=arm-linux-gcc //修改這里
MKDIR_P=mkdir -p
# where "make install" putslibpng12.a, libpng12.so*,
# libpng12/png.h and libpng12/pngconf.h
# Prefix must be a full pathname.
prefix=/home/xgy/toolchain/arm/4.3.2/arm-none-linux-gnueabi
exec_prefix=$(prefix)
# Where the zlib library and include filesare located.
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=/home/xgy/toolchain/arm/4.3.2/arm/arm-none-linux-gnueabi/lib //修改這里
ZLIBINC=/home/xgy/toolchain/arm/4.3.2/arm/arm-none-linux-gnueabi/include//修改這里
保存退出後執行如下命令:
xgy@ubuntu:~/tmp/libpng-1.2.18$ make
xgy@ubuntu:~/tmp/libpng-1.2.18$ makeinstall
然後可以去~/toolchain/arm/4.3.2/arm-none-linux-gnueabi/{include,lib}目錄下是否多了一些文件(可以另外再開一個終端查看,這樣方便點),如下圖:
如果有錯,檢查下前面的步聚,特別是看zlib有安裝有沒有出錯。
接下來安裝jpeg庫
xgy@ubuntu:~/tmp/libpng-1.2.18$ cd ..
xgy@ubuntu:~/tmp$tar zxvf jpegsrc.v6b.tar.gz
xgy@ubuntu:~/tmp/jpeg-6b$
xgy@ubuntu:~/tmp/jpeg-6b$ ./configure --prefix=/home/xgy/toolchain/arm/4.3.2/arm-none-linux-gnueabi/--host=arm-linux --enable-shared
按此命令進行,然後修 改makefile文件將CC的值改為arm-linux-gcc,一定得改!!
xgy@ubuntu:~/tmp/jpeg-6b$make
安裝前需要在 arm-linux 下建個目錄,不然安裝會出錯
xgy@ubuntu:~/tmp/jpeg-6b$mkdir -pv /home/xgy/toolchain/arm/4.3.2/arm-none-linux-gnueabi/man/man1
mkdir: created directory `/home/xgy/toolchain/arm/4.3.2/arm-none-linux-gnueabi/man/man1
xgy@ubuntu:~/tmp/jpeg-6b$ make install
然後可以去~/toolchain/arm/4.3.2/arm-none-linux-gnueabi/{include, lib}目錄下是否多了一些文件(可以另外再開一個終端查看,這樣方便點),如下圖:
到此,三個庫安裝完畢!
⑸ Qt creator交叉編譯帶圖片的程序出現問題,版本4.7
找不到 libQtGui.so 這個庫, 添加環境變數 LIBRARY_PATH=/opt/Qt4.7/lib 試試
另外你使是用 arm-linux-gcc 編譯程序, 需要保證 QT 下的 libQtGui.so 庫也是用 arm-linux-gcc 編譯的, 否則編譯鏈接會出問題
⑹ 在ubantu12.04版本環境下,使用交叉編譯工具編譯opencv,老出現這個問題,求大神指教!
整個項目的結構圖:
編寫DetectFaceDemo.java,代碼如下:
[java] view
plainprint?
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路徑會多列印一個『/』,因此總是出現如下錯誤
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我們將第一個字元去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路徑會多列印一個『/』,因此總是出現如下錯誤
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我們將第一個字元去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
3.編寫測試類:
[java] view
plainprint?
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//運行結果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//運行結果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png
⑺ 小白求助,如何在ubuntu的QT creator下完成交叉編譯
你需要先安裝嵌入式版本的Qt
以下是我編譯Qt時的命令:樓主看著自行改
./configure -prefix /opt/QtEmbedded-4.7.3 -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-phonon -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -confirm-license -qt-mouse-tslib
然後把生成的Qt的qmake所在的目錄加入的Qt creater中,工具鏈就選你上面的那個arm-linux-g++
然後新建項目的時候就可以選擇 Embedded什麼來著
這樣就搞定了!
⑻ linux里opencv怎麼交叉編譯
一、交叉編譯opencv 構造: 下載:各個庫的下載可以直接搜名字到官網下載 幾個關鍵解釋: 「--prefix=」 後邊跟make install時的位置,本例中,libz在make install時將安裝到/usr/arm-linux-gnueabihf中 「--host=」 後邊跟arm-linux表明使用的是ARM環境 有configure的才能進行configure配置 4)所有的makefile修改類似 Libz的交叉編譯 第一步:# ./configure --prefix=/usr/arm-linux-gnueabihf --shared 第二步:修改makefile,主要有下邊幾個,修改的時候通篇參照即可 CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar rc RANLIB=arm-linux-gnueabihf-ranlib STRIP = arm-linux-gnueabihf-strip 如果有ARCH的話,ARCH=ARM 第三步:#sudo make #sudo make install Libjpeg的交叉編譯 第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static CC=arm-linux-gnueabihf-gcc 第二步:參考1)中方法修改makefile 第三步:#sudo make #sudo make install Libpng的交叉編譯 第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static CC=arm-linux-gnueabihf-gcc 第二步:參考1)中方法修改makefile 第三步:#sudo make #sudo make install Yasm的交叉編譯 第一步:#./configure --host=arm-linux --prefix=/usr/arm-linux-gnueabihf --enable-shared --enable-static 第二步:修改makefile 第三步:#sudo make #sudo make install Libx264的交叉編譯 第一步:#CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/usr/arm-linux-gnueabihf 第二步:修改config.mak里的參數,因為makefile要調用config.mak,所以修改方法同makefile 第三步:#sudo make #sudo make install Libxvid的交叉編譯 第一步:首先切換目錄 #cd build/generic 第二步:#./configure --prefix=/usr/arm-linux-gnueabihf --host=arm-linux --disable-assembly 第三步:#sudo make #sudo make install ffmpeg的交叉編譯 第一步: ./configure --enable-cross-compile --target-os=linux --cc=arm-linux-gnueabihf-gcc --arch=arm --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --enable-ffserver --enable-swscale --enable-pthreads --disable-yasm --disable-stripping --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/arm-linux-gnueabihf/include --extra-ldflags=-L/usr/arm-linux-gnueabihf/lib --prefix=/usr/arm-linux-gnueabihf 第二步:修改makefile文件 第三步:#sudo make #sudo make install 第四步:將ffmpeg加入pkg-config 執行#sudo gedit /etc/bash.bashrc,在末尾加入 export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib/ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/arm-linux-gnueabihf /lib/pkgconfig export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:/usr/arm-linux-gnueabihf /lib/ 完畢後使用命令:#source /etc/bash.bashrc 或者單獨使用三個export,不過壽命只在一個終端中,終端關閉時就失效。 幾個關鍵解釋:--extra-flags指向xvid的安裝路徑,--extra-ldflags指向x264的路徑 安裝cmake-gui 執行:#sudo apt-get install cmake-qt-gui Opencv的交叉編譯 第一步:修改opencv/platflrms/linux/目錄下的arm-gnueabi.toolchain.cmake,將其所有刪掉,寫入: set( CMAKE_SYSTEM_NAME Linux ) set( CMAKE_SYSTEM_PROCESSOR arm ) set( CMAKE_C_COMPILER arm-linux-gnueabihf-gcc ) set( CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ ) 第二步:在opencv目錄下新建build目錄,進入build目錄,執行命令: #cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake ../ 這時,要保證出現: 第三步:使用cmake-gui打開CMakeCache.txt,去掉所有的無關項,修改CMAKE_INSTALL_PREFIX,來確定make install的目錄 第四步:#sudo make #sudo make install 可能出現的錯誤: opencv編譯不通過,出現skip之類的,說明ffmpeg沒編譯好,或者其編譯好了,但是pkg-config沒有設置好,一定要設置好其環境 前邊幾步不通過的話,看看命令有沒有少,或者有沒有修改好makefile 在arm上使用時,一種方法時直接將編譯好的opencv目錄下的lib文件拷貝到開發板對應的/lib目錄下,其他或者拷貝到自己指定的目錄,並設置好環境變數即可使用
⑼ mingw下的libpng編譯問題,要瘋了,求助
很多朋友都知道如何在linux平台如何編譯比特幣程序,但是,到了windows平台, 就會感覺到無從下手. 其實, 比特幣程序是跨平台的. 你要編譯windows版的比特幣程序,基本上有兩種方法,一種是在linux平台 (推薦ubuntu 13.10)通過交叉編譯的方法來編譯
⑽ OpenCV交叉編譯時用到的幾個依賴庫
OpenCV交叉編譯時用到的幾個依賴庫。在BB Black 入門基礎之OpenCV的交叉編譯 一文中用到。大家有需要的可以拿去用。
↑收起
文件列表
.deps
----|ControlResource.Po
----|DCU99Editor.Po
----|DuplexEditor.Po
.eclipseme.tmp
----|emulation
----|----|PhoneBook.jad
----|----|PhoneBook.jar
verified
----|classes
----|----|com
----|----|----|north
----|----|----|----|phonebook
----|----|----|----|----|model
----|----|----|----|----|----|Account.class
----|----|----|----|----|----|ApplicationException.class
----|----|----|----|----|----|Index.class
----|----|----|----|----|----|Model$AccountFilter.class
----|----|----|----|----|----|Model$IndexFilter.class
----|----|----|----|----|----|Model.class
----|----|----|----|----|----|Preference.class
----|----|----|----|----|----|UserModel.class
ui
----|ConfirmationDialog.class
----|DetailInfoUI.class
----|Dialog.class
----|DialogListener.class
----|IndexFunctionUI$ListIndex.class
----|IndexFunctionUI.class
----|ListMerchantGroupUI.class
----|ListPhoneUI.class
----|LoginUI.class
----|MerchantGroupDetailInfoUI.class
----|NewPhoneUI.class
----|SearchPhoneUI.class
----|Title.class
----|UIController$1.class
----|UIController$EventID.class
----|UIController.class
----|WaitCanvas$1.class
----|WaitCanvas.class
----|WelcomeUI.class
PhoneBookMIDlet.class
.myeclipse
----|CVS
----|----|Repository
----|----|Root
.settings
----|CVS
----|----|Entries
----|----|Repository
----|----|Root
org.eclipse.core.resources.prefs
.svn
----|prop-base
props
text-base
----|readme.txt.svn-base
tmp
----|prop-base
props
text-base
all-wcprops
dir-prop-base
entries
format
.tmp_versions
----|dw4002.mod
dependence
----|ffmpeg-0.10.3.tar.bz2
----|jpegsrc.v8d.tar.gz
----|libpng-1.5.14.tar.gz
----|libv4l-0.6.1.gz
----|tiff-4.0.3.tar.gz
----|x264-snapshot-20120528-2245-stable.tar.bz2
----|xvidcore-1.3.2.tar.gz
----|zlib127.zip
..dir.dat
._CotEditor_346
._PortVaR
.classpath
.cproject
.cxl
.depend
.dw4002.ko.cmd
.dw4002.mod.o.cmd
.dw4002.o.cmd
.exe
.gitignore
.htaccess
.message
.pdf
.project
.qmake.internal.cache
.screenrc
.synopsys_dc.setup
.synopsys_pt.setup
.untf
.vimrc
.xhdl3.xref
