Linux之开源软件移植
移植环境 Utuntu 15.04
1、mplayer移植
版本:mplayer-export-snapshot.tar.bz2 /mplayer-export-2015-11-26
Linux PC 平台: ./configure && make && make install
依赖软件:yasm
2、yasm移植
版本:yasm-1.3.0
Linux PC 平台: ./configure && make && make install
mipsel平台:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1、QT 编译
版本 qt-embedded-linux-opensource-src-4.5.3
mips和mipsel的区别
mips是big-endian的mips架构
mipsel是little-endian的mips架构。
他们之间的区别就是内存中存放的数据的字节顺序相反,也就是把低位放在低地址还是高地址。
./configure --prefix=/opt/mipsel/qtopia -opensource -release -shared -Declarative -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-mips-g++ -embedded mipsel -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -no-armfpa -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/opt/mipsel/tslib/include -L/opt/mipsel/tslib/lib -confirm-license
./configure -embedded mips -little-endian -xplatform qws/linux-mips-g++ -prefix /opt/mipsel/qtopia -release -opensource -confirm-license -webkit -qt-zlib -qt-libpng -qt-libjpeg -qt-gif -I/opt/mipsel/tslib/include -L/opt/mipsel/tslib/lib -no-qt3support -make libs -nomake examples -nomake demos -no-phonon -no-phonon-backend -no-accessibility -no-scripttools
./configure -embedded mips -little-endian -xplatform qws/linux-mips-g++ -prefix /opt/mipsel/qtopia -release -opensource -confirm-license -webkit -qt-zlib -qt-libpng -qt-libjpeg -qt-gif -I/opt/mipsel/tslib/include -L/opt/mipsel/tslib/lib -no-qt3support -shared -make libs -nomake examples -nomake demos -no-phonon -no-phonon-backend -no-accessibility -no-scripttools
./configure -xplatform qws/linux-mips-g++ -prefix /opt/mipsel/qtopia -I/opt/mipsel/tslib/include -L/opt/mipsel/tslib/lib -embedded mips -little-endian -release -opensource -shared -fast -make libs -confirm-license -nomake examples -nomake demos -no-webkit -qt-zlib -qt-libpng -qt-libjpeg -no-qt3support -no-phonon -no-phonon-backend -no-accessibility -no-scripttools -no-largefile -no-exceptions -no-accessibility -no-xmlpatterns -no-phonon -no-phonon-backend -no-svg -no-gif -no-libtiff -no-openssl -no-nis -no-opengl -no-cups -no-dbus
2、mplayer编译
版本:mplayer1.0rc2
修改libvo/video_out.c添加
#ifdef HAVE_IVTV
extern vo_functions_t video_out_ivtv;
#endif
X86# ./configure --disable-gui --disable-ivtv
MIPS# ./configure --enable-cross-compile --prefix=/opt/mipsel/mplayer/ --target=mips-linux --cc=mipsel-linux-gcc --as=mipsel-linux-as --ar=mipsel-linux-ar --host-cc=gcc --disable-gui --disable-ivtv
tar -zxvf ./text.tar.gz -C /home/app/test/
3、libmad编译
4、qt-x11编译
版本:qt-x11-opensource-src-4.5.3
修改qpnghandle.cpp
#include <libpng/png.h>
error :'adoptref' was not declared in this scope, and no declarations were found by.....如上图所示。
解决方法:找到qt-x11-opensource-src-4.5.3/src/3rdparty/webkit/WebCore/JavaScriptCore/wtf/RefPtr.h在文件头部加入如下代码:
#include "PassRefPtr.h"
error: 'prepareComparison' was not declared in this scope, and no declarations were found by.....如上图所示。
解决方法:
找到qt-x11-opensource-src-4.5.3/src/xmlpatterns目录下的Makefile文件,在该文件的CXXFLAGS 后面加入:
-fpermissive
error :'erase' was not declared in this scope, and no declarations were found by....如上图所示。
解决方法:找到 qt-x11-opensource-src-4.5.3/src/corelib/tools/qmap.h文件的996行的24列,将erase改为this->erase
error :'getCachedDOMConstructor' was not declared in this scope, and no declarations were found by.....如上图所示。
解决方法:src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
添加
JSC::JSObject* getCachedDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*);
void cacheDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*, JSC::JSObject* constructor);
error :'insert' was not declared in this scope, and no declarations were found by.....如上图所示。
解决方法:找到 qt-x11-opensource-src-4.5.3/tools/porting/src/codemodel.h文件的99行的50列,将 insert 改为this->insert
X86# ./configure && make
连接第三方库文件出现undefined symbol '__gxx_personality_v0@@CXXABI_1.3' 添加 -lstdc++
undefined reference to symbol 'sincosf@@GLIBC_2.2.5' 添加 -lm
开发时,设置LIBRARY_PATH,以便gcc能够找到编译时需要的动态链接库。
发布时,设置LD_LIBRARY_PATH,以便程序加载运行时能够自动找到需要的动态链接库。
QT编译工程:
切换到工程目录
1、qmake -project 生成后缀名为*.pro的文件
2、qmake *.pro生成 Makefile
3、修改Makefile相应地方为 -rpath,/usr/local/lib否则会有段错误(仅对PC版本)
注意:qmake要根据需要选择PC还是嵌入式版本
4、wxWidgets-3.0.2编译
X86: 创建amd64目录,切换到此目录 ../configure && make 即可, 编译完后切换到 samples目录 make 编译例子
mipsel:../configure --host=mipsel-linux --prefix=/opt/mipsel/wxWidgets
export CFLAGS="-I/home/wxX11/wxX11-arm/include"
export CXXFLAGS="-I/home/wxX11/wxX11-arm/include"
export LDFLAGS="-L/home/wxX11/wxX11-arm/lib"
export CPPFLAGS="-I/home/wxX11/wxX11-arm/include"
export LIBRARY_PATH=/opt/mipsel/usr/lib:/opt/mipsel/usr/libc/lib:/opt/mipsel/usr/libc/uclibc/lib &&
export LD_LIBRARY_PATH=/opt/mipsel/usr/lib:/opt/mipsel/usr/libc/lib:/opt/mipsel/usr/libc/uclibc/lib &&
export C_INCLUDE_PATH=/opt/mipsel/usr/libc/uclibc/usr/include &&
export CPLUS_INCLUDE_PATH=/opt/mipsel/usr/include/c++/4.7.2
../configure --host=mipsel-linux --prefix=/opt/mipsel/wxWidgets --with-x11 --without-subdirs --enable-no_rtti --enable-no_exceptions --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --disable-shared
替换/usr/include /usr/local/include为相应目录
../src/stc/scintilla/lexlib/LexerNoExceptions.cxx:34:11: error: exception handling disabled, use -fexceptions to enable
Makefile:16841: recipe for target 'wxscintilla_LexerNoExceptions.o' failed
make: *** [wxscintilla_LexerNoExceptions.o] Error 1
CXXFLAGS 加-fexceptions
src/unix/displayx11.cpp修改
#include <X11/extensions/xinerama.h>
5、编译libX11
libX11-1.5.0
./configure --prefix=/opt/mipsel/libX11 --build=i686-pc-linux-gnu --host=mipsel-linux --with-freetype-config=/opt/mipsel/freetype/bin/freetype-config --with-expat-lib=/opt/mipsel/libX11/lib --with-expat-includes=/opt/mipsel/libX11/include